diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-02 19:01:42 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-02 19:01:42 +0100 |
commit | 5193728e1d650e6732a42ac5afd57609ff82e407 (patch) | |
tree | 3805a801ee5b55ade76953d822844958350f8bd9 /crates/hir_ty/src/infer/pat.rs | |
parent | 5be653d426e3e3fd253f41f85e7d280a82037da9 (diff) | |
parent | ded4e7cc836dd2f00ab5825e783c11e52db18d38 (diff) |
Merge #9114
9114: Fix bind patterns always being treated as ref taking patterns r=Veykril a=Veykril
Fixes #9107
bors r+
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/infer/pat.rs')
-rw-r--r-- | crates/hir_ty/src/infer/pat.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs index 83e0a7a9e..c97b49544 100644 --- a/crates/hir_ty/src/infer/pat.rs +++ b/crates/hir_ty/src/infer/pat.rs | |||
@@ -290,6 +290,10 @@ fn is_non_ref_pat(body: &hir_def::body::Body, pat: PatId) -> bool { | |||
290 | Expr::Literal(Literal::String(..)) => false, | 290 | Expr::Literal(Literal::String(..)) => false, |
291 | _ => true, | 291 | _ => true, |
292 | }, | 292 | }, |
293 | Pat::Bind { mode: BindingAnnotation::Mutable, subpat: Some(subpat), .. } | ||
294 | | Pat::Bind { mode: BindingAnnotation::Unannotated, subpat: Some(subpat), .. } => { | ||
295 | is_non_ref_pat(body, *subpat) | ||
296 | } | ||
293 | Pat::Wild | Pat::Bind { .. } | Pat::Ref { .. } | Pat::Box { .. } | Pat::Missing => false, | 297 | Pat::Wild | Pat::Bind { .. } | Pat::Ref { .. } | Pat::Box { .. } | Pat::Missing => false, |
294 | } | 298 | } |
295 | } | 299 | } |