diff options
author | Lukas Wirth <[email protected]> | 2021-06-02 19:00:39 +0100 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-06-02 19:00:39 +0100 |
commit | ded4e7cc836dd2f00ab5825e783c11e52db18d38 (patch) | |
tree | 3805a801ee5b55ade76953d822844958350f8bd9 /crates/hir_ty/src/infer | |
parent | 5be653d426e3e3fd253f41f85e7d280a82037da9 (diff) |
Fix bind patterns always being treated as ref taking patterns
Diffstat (limited to 'crates/hir_ty/src/infer')
-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 | } |