@@ -1562,8 +1562,8 @@ fn check_for_loop_over_map_kv<'a, 'tcx>(
15621562}
15631563
15641564struct MutatePairDelegate {
1565- node_id_low : Option < NodeId > ,
1566- node_id_high : Option < NodeId > ,
1565+ hir_id_low : Option < HirId > ,
1566+ hir_id_high : Option < HirId > ,
15671567 span_low : Option < Span > ,
15681568 span_high : Option < Span > ,
15691569}
@@ -1578,10 +1578,10 @@ impl<'tcx> Delegate<'tcx> for MutatePairDelegate {
15781578 fn borrow ( & mut self , _: HirId , sp : Span , cmt : & cmt_ < ' tcx > , _: ty:: Region < ' _ > , bk : ty:: BorrowKind , _: LoanCause ) {
15791579 if let ty:: BorrowKind :: MutBorrow = bk {
15801580 if let Categorization :: Local ( id) = cmt. cat {
1581- if Some ( id) == self . node_id_low {
1581+ if Some ( id) == self . hir_id_low {
15821582 self . span_low = Some ( sp)
15831583 }
1584- if Some ( id) == self . node_id_high {
1584+ if Some ( id) == self . hir_id_high {
15851585 self . span_high = Some ( sp)
15861586 }
15871587 }
@@ -1590,16 +1590,16 @@ impl<'tcx> Delegate<'tcx> for MutatePairDelegate {
15901590
15911591 fn mutate ( & mut self , _: HirId , sp : Span , cmt : & cmt_ < ' tcx > , _: MutateMode ) {
15921592 if let Categorization :: Local ( id) = cmt. cat {
1593- if Some ( id) == self . node_id_low {
1593+ if Some ( id) == self . hir_id_low {
15941594 self . span_low = Some ( sp)
15951595 }
1596- if Some ( id) == self . node_id_high {
1596+ if Some ( id) == self . hir_id_high {
15971597 self . span_high = Some ( sp)
15981598 }
15991599 }
16001600 }
16011601
1602- fn decl_without_init ( & mut self , _: NodeId , _: Span ) { }
1602+ fn decl_without_init ( & mut self , _: HirId , _: Span ) { }
16031603}
16041604
16051605impl < ' tcx > MutatePairDelegate {
@@ -1635,7 +1635,7 @@ fn mut_warn_with_span(cx: &LateContext<'_, '_>, span: Option<Span>) {
16351635 }
16361636}
16371637
1638- fn check_for_mutability ( cx : & LateContext < ' _ , ' _ > , bound : & Expr ) -> Option < NodeId > {
1638+ fn check_for_mutability ( cx : & LateContext < ' _ , ' _ > , bound : & Expr ) -> Option < HirId > {
16391639 if_chain ! {
16401640 if let ExprKind :: Path ( ref qpath) = bound. node;
16411641 if let QPath :: Resolved ( None , _) = * qpath;
@@ -1648,7 +1648,7 @@ fn check_for_mutability(cx: &LateContext<'_, '_>, bound: &Expr) -> Option<NodeId
16481648 if let PatKind :: Binding ( bind_ann, ..) = pat. node;
16491649 if let BindingAnnotation :: Mutable = bind_ann;
16501650 then {
1651- return Some ( node_id) ;
1651+ return Some ( cx . tcx . hir ( ) . node_to_hir_id ( node_id) ) ;
16521652 }
16531653 }
16541654 }
@@ -1660,11 +1660,11 @@ fn check_for_mutability(cx: &LateContext<'_, '_>, bound: &Expr) -> Option<NodeId
16601660fn check_for_mutation (
16611661 cx : & LateContext < ' _ , ' _ > ,
16621662 body : & Expr ,
1663- bound_ids : & [ Option < NodeId > ] ,
1663+ bound_ids : & [ Option < HirId > ] ,
16641664) -> ( Option < Span > , Option < Span > ) {
16651665 let mut delegate = MutatePairDelegate {
1666- node_id_low : bound_ids[ 0 ] ,
1667- node_id_high : bound_ids[ 1 ] ,
1666+ hir_id_low : bound_ids[ 0 ] ,
1667+ hir_id_high : bound_ids[ 1 ] ,
16681668 span_low : None ,
16691669 span_high : None ,
16701670 } ;
@@ -1938,16 +1938,15 @@ fn is_iterator_used_after_while_let<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, it
19381938 past_while_let : false ,
19391939 var_used_after_while_let : false ,
19401940 } ;
1941- let def_hir_id = cx. tcx . hir ( ) . node_to_hir_id ( def_id) ;
1942- if let Some ( enclosing_block) = get_enclosing_block ( cx, def_hir_id) {
1941+ if let Some ( enclosing_block) = get_enclosing_block ( cx, def_id) {
19431942 walk_block ( & mut visitor, enclosing_block) ;
19441943 }
19451944 visitor. var_used_after_while_let
19461945}
19471946
19481947struct VarUsedAfterLoopVisitor < ' a , ' tcx : ' a > {
19491948 cx : & ' a LateContext < ' a , ' tcx > ,
1950- def_id : NodeId ,
1949+ def_id : HirId ,
19511950 iter_expr_id : HirId ,
19521951 past_while_let : bool ,
19531952 var_used_after_while_let : bool ,
@@ -2052,9 +2051,9 @@ enum VarState {
20522051
20532052/// Scan a for loop for variables that are incremented exactly once.
20542053struct IncrementVisitor < ' a , ' tcx : ' a > {
2055- cx : & ' a LateContext < ' a , ' tcx > , // context reference
2056- states : FxHashMap < NodeId , VarState > , // incremented variables
2057- depth : u32 , // depth of conditional expressions
2054+ cx : & ' a LateContext < ' a , ' tcx > , // context reference
2055+ states : FxHashMap < HirId , VarState > , // incremented variables
2056+ depth : u32 , // depth of conditional expressions
20582057 done : bool ,
20592058}
20602059
@@ -2108,7 +2107,7 @@ impl<'a, 'tcx> Visitor<'tcx> for IncrementVisitor<'a, 'tcx> {
21082107struct InitializeVisitor < ' a , ' tcx : ' a > {
21092108 cx : & ' a LateContext < ' a , ' tcx > , // context reference
21102109 end_expr : & ' tcx Expr , // the for loop. Stop scanning here.
2111- var_id : NodeId ,
2110+ var_id : HirId ,
21122111 state : VarState ,
21132112 name : Option < Name > ,
21142113 depth : u32 , // depth of conditional expressions
@@ -2119,7 +2118,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InitializeVisitor<'a, 'tcx> {
21192118 fn visit_stmt ( & mut self , stmt : & ' tcx Stmt ) {
21202119 // Look for declarations of the variable
21212120 if let StmtKind :: Local ( ref local) = stmt. node {
2122- if local. pat . id == self . var_id {
2121+ if local. pat . hir_id == self . var_id {
21232122 if let PatKind :: Binding ( .., ident, _) = local. pat . node {
21242123 self . name = Some ( ident. name ) ;
21252124
@@ -2191,11 +2190,11 @@ impl<'a, 'tcx> Visitor<'tcx> for InitializeVisitor<'a, 'tcx> {
21912190 }
21922191}
21932192
2194- fn var_def_id ( cx : & LateContext < ' _ , ' _ > , expr : & Expr ) -> Option < NodeId > {
2193+ fn var_def_id ( cx : & LateContext < ' _ , ' _ > , expr : & Expr ) -> Option < HirId > {
21952194 if let ExprKind :: Path ( ref qpath) = expr. node {
21962195 let path_res = cx. tables . qpath_def ( qpath, expr. hir_id ) ;
21972196 if let Def :: Local ( node_id) = path_res {
2198- return Some ( node_id) ;
2197+ return Some ( cx . tcx . hir ( ) . node_to_hir_id ( node_id) ) ;
21992198 }
22002199 }
22012200 None
@@ -2376,7 +2375,7 @@ fn check_infinite_loop<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, cond: &'tcx Expr, e
23762375/// All variables definition IDs are collected
23772376struct VarCollectorVisitor < ' a , ' tcx : ' a > {
23782377 cx : & ' a LateContext < ' a , ' tcx > ,
2379- ids : FxHashSet < NodeId > ,
2378+ ids : FxHashSet < HirId > ,
23802379 def_ids : FxHashMap < def_id:: DefId , bool > ,
23812380 skip : bool ,
23822381}
@@ -2390,7 +2389,7 @@ impl<'a, 'tcx> VarCollectorVisitor<'a, 'tcx> {
23902389 then {
23912390 match def {
23922391 Def :: Local ( node_id) | Def :: Upvar ( node_id, ..) => {
2393- self . ids. insert( node_id) ;
2392+ self . ids. insert( self . cx . tcx . hir ( ) . node_to_hir_id ( node_id) ) ;
23942393 } ,
23952394 Def :: Static ( def_id, mutable) => {
23962395 self . def_ids. insert( def_id, mutable) ;
0 commit comments