@@ -12,7 +12,7 @@ use rustc_ast::ptr::P;
1212use rustc_ast:: token;
1313use rustc_ast:: tokenstream:: TokenStream ;
1414use rustc_ast:: visit:: { self , AssocCtxt , Visitor } ;
15- use rustc_ast:: { AstLike , Block , Inline , ItemKind , MacArgs } ;
15+ use rustc_ast:: { AstLike , Block , Inline , ItemKind , Local , MacArgs } ;
1616use rustc_ast:: { MacCallStmt , MacStmtStyle , MetaItemKind , ModKind , NestedMetaItem } ;
1717use rustc_ast:: { NodeId , PatKind , Path , StmtKind , Unsafe } ;
1818use rustc_ast_pretty:: pprust;
@@ -1161,6 +1161,11 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
11611161 } ) ;
11621162 }
11631163
1164+ // This is needed in order to set `lint_node_id` for `let` statements
1165+ fn visit_local ( & mut self , local : & mut P < Local > ) {
1166+ assign_id ! ( self , & mut local. id, || noop_visit_local( local, self ) ) ;
1167+ }
1168+
11641169 fn flat_map_arm ( & mut self , arm : ast:: Arm ) -> SmallVec < [ ast:: Arm ; 1 ] > {
11651170 let mut arm = configure ! ( self , arm) ;
11661171
@@ -1307,6 +1312,8 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
13071312 }
13081313
13091314 // The placeholder expander gives ids to statements, so we avoid folding the id here.
1315+ // We don't use `assign_id!` - it will be called when we visit statement's contents
1316+ // (e.g. an expression, item, or local)
13101317 let ast:: Stmt { id, kind, span } = stmt;
13111318 noop_flat_map_stmt_kind ( kind, self )
13121319 . into_iter ( )
0 commit comments