about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-12-20 22:05:36 +0100
committerGitHub <noreply@github.com>2019-12-20 22:05:36 +0100
commitf465f95b4b9302434246209c968c90b8704b8099 (patch)
tree3d49dc52df9407baab3b8eb64b39dd26ecc5e44c
parenteaee9d11ee39ef58d2985a87f296d20eb1ee1345 (diff)
parent4414f0d0e0e30f961b26a1f357fb78118be16cc7 (diff)
downloadrust-f465f95b4b9302434246209c968c90b8704b8099.tar.gz
rust-f465f95b4b9302434246209c968c90b8704b8099.zip
Rollup merge of #67428 - Centril:ibp-explicit-match, r=matthewjasper
`is_binding_pat`: use explicit match & include or-pats in grammar

r? @matthewjasper @nikomatsakis
-rw-r--r--src/librustc/middle/region.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs
index aa6f2839828..e050e5f8942 100644
--- a/src/librustc/middle/region.rs
+++ b/src/librustc/middle/region.rs
@@ -1173,6 +1173,7 @@ fn resolve_local<'tcx>(
     ///        | VariantName(..., P&, ...)
     ///        | [ ..., P&, ... ]
     ///        | ( ..., P&, ... )
+    ///        | ... "|" P& "|" ...
     ///        | box P&
     fn is_binding_pat(pat: &hir::Pat) -> bool {
         // Note that the code below looks for *explicit* refs only, that is, it won't
@@ -1212,6 +1213,7 @@ fn resolve_local<'tcx>(
                 pats3.iter().any(|p| is_binding_pat(&p))
             }
 
+            PatKind::Or(ref subpats) |
             PatKind::TupleStruct(_, ref subpats, _) |
             PatKind::Tuple(ref subpats, _) => {
                 subpats.iter().any(|p| is_binding_pat(&p))
@@ -1221,7 +1223,13 @@ fn resolve_local<'tcx>(
                 is_binding_pat(&subpat)
             }
 
-            _ => false,
+            PatKind::Ref(_, _) |
+            PatKind::Binding(hir::BindingAnnotation::Unannotated, ..) |
+            PatKind::Binding(hir::BindingAnnotation::Mutable, ..) |
+            PatKind::Wild |
+            PatKind::Path(_) |
+            PatKind::Lit(_) |
+            PatKind::Range(_, _, _) => false,
         }
     }