about summary refs log tree commit diff
path: root/src/librustc_resolve
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-09-01 20:31:29 +0000
committerbors <bors@rust-lang.org>2018-09-01 20:31:29 +0000
commit28bcffead74d5e17c6cb1f7de432e37f93a6b50c (patch)
tree1abf601a008600ac3a23c22c1ce003c571dee816 /src/librustc_resolve
parentf39f218ec33d93e8a1b0ac4282f62ee35e02c18a (diff)
parent7a083ca25f14833d704d2efba5ca9b431f6c65ad (diff)
downloadrust-28bcffead74d5e17c6cb1f7de432e37f93a6b50c.tar.gz
rust-28bcffead74d5e17c6cb1f7de432e37f93a6b50c.zip
Auto merge of #53815 - F001:if-let-guard, r=petrochenkov
refactor match guard

This is the first step to implement RFC 2294: if-let-guard. Tracking issue: https://github.com/rust-lang/rust/issues/51114

The second step should be introducing another variant `IfLet` in the Guard enum. I separated them into 2 PRs for the convenience of reviewers.

r? @petrochenkov
Diffstat (limited to 'src/librustc_resolve')
-rw-r--r--src/librustc_resolve/lib.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index 95d5fba9668..0f6a9742309 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -2701,7 +2701,10 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
         // This has to happen *after* we determine which pat_idents are variants
         self.check_consistent_bindings(&arm.pats);
 
-        walk_list!(self, visit_expr, &arm.guard);
+        match arm.guard {
+            Some(ast::Guard::If(ref expr)) => self.visit_expr(expr),
+            _ => {}
+        }
         self.visit_expr(&arm.body);
 
         self.ribs[ValueNS].pop();