Skip to content

Commit 659859c

Browse files
committed
save-analysis: walk path expressions
This is actually kinda hard to hit, but it fixes missing the `foo` in `for _ in foo {}`.
1 parent 83c2d95 commit 659859c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/librustc_save_analysis/dump_visitor.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,6 +1369,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor<'l> for DumpVisitor<'l, 'tcx, 'll,
13691369
}
13701370

13711371
fn visit_expr(&mut self, ex: &'l ast::Expr) {
1372+
debug!("visit_expr {:?}", ex.node);
13721373
self.process_macro_use(ex.span, ex.id);
13731374
match ex.node {
13741375
ast::ExprKind::Call(ref _f, ref _args) => {
@@ -1462,6 +1463,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor<'l> for DumpVisitor<'l, 'tcx, 'll,
14621463
ast::ExprKind::WhileLet(ref pattern, ref subexpression, ref block, _) => {
14631464
let value = self.span.snippet(subexpression.span);
14641465
self.process_var_decl(pattern, value);
1466+
debug!("for loop, walk sub-expr: {:?}", subexpression.node);
14651467
visit::walk_expr(self, subexpression);
14661468
visit::walk_block(self, block);
14671469
}
@@ -1556,6 +1558,10 @@ impl<'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor<'l> for DumpVisitor<'l, 'tcx, 'll,
15561558
self.visit_expr(&arm.body);
15571559
}
15581560

1561+
fn visit_path(&mut self, p: &'l ast::Path, id: NodeId) {
1562+
self.process_path(id, p, None);
1563+
}
1564+
15591565
fn visit_stmt(&mut self, s: &'l ast::Stmt) {
15601566
self.process_macro_use(s.span, s.id);
15611567
visit::walk_stmt(self, s)

0 commit comments

Comments
 (0)