@@ -1562,8 +1562,8 @@ fn check_for_loop_over_map_kv<'a, 'tcx>(
1562
1562
}
1563
1563
1564
1564
struct 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 > ,
1567
1567
span_low : Option < Span > ,
1568
1568
span_high : Option < Span > ,
1569
1569
}
@@ -1578,10 +1578,10 @@ impl<'tcx> Delegate<'tcx> for MutatePairDelegate {
1578
1578
fn borrow ( & mut self , _: HirId , sp : Span , cmt : & cmt_ < ' tcx > , _: ty:: Region < ' _ > , bk : ty:: BorrowKind , _: LoanCause ) {
1579
1579
if let ty:: BorrowKind :: MutBorrow = bk {
1580
1580
if let Categorization :: Local ( id) = cmt. cat {
1581
- if Some ( id) == self . node_id_low {
1581
+ if Some ( id) == self . hir_id_low {
1582
1582
self . span_low = Some ( sp)
1583
1583
}
1584
- if Some ( id) == self . node_id_high {
1584
+ if Some ( id) == self . hir_id_high {
1585
1585
self . span_high = Some ( sp)
1586
1586
}
1587
1587
}
@@ -1590,16 +1590,16 @@ impl<'tcx> Delegate<'tcx> for MutatePairDelegate {
1590
1590
1591
1591
fn mutate ( & mut self , _: HirId , sp : Span , cmt : & cmt_ < ' tcx > , _: MutateMode ) {
1592
1592
if let Categorization :: Local ( id) = cmt. cat {
1593
- if Some ( id) == self . node_id_low {
1593
+ if Some ( id) == self . hir_id_low {
1594
1594
self . span_low = Some ( sp)
1595
1595
}
1596
- if Some ( id) == self . node_id_high {
1596
+ if Some ( id) == self . hir_id_high {
1597
1597
self . span_high = Some ( sp)
1598
1598
}
1599
1599
}
1600
1600
}
1601
1601
1602
- fn decl_without_init ( & mut self , _: NodeId , _: Span ) { }
1602
+ fn decl_without_init ( & mut self , _: HirId , _: Span ) { }
1603
1603
}
1604
1604
1605
1605
impl < ' tcx > MutatePairDelegate {
@@ -1635,7 +1635,7 @@ fn mut_warn_with_span(cx: &LateContext<'_, '_>, span: Option<Span>) {
1635
1635
}
1636
1636
}
1637
1637
1638
- fn check_for_mutability ( cx : & LateContext < ' _ , ' _ > , bound : & Expr ) -> Option < NodeId > {
1638
+ fn check_for_mutability ( cx : & LateContext < ' _ , ' _ > , bound : & Expr ) -> Option < HirId > {
1639
1639
if_chain ! {
1640
1640
if let ExprKind :: Path ( ref qpath) = bound. node;
1641
1641
if let QPath :: Resolved ( None , _) = * qpath;
@@ -1648,7 +1648,7 @@ fn check_for_mutability(cx: &LateContext<'_, '_>, bound: &Expr) -> Option<NodeId
1648
1648
if let PatKind :: Binding ( bind_ann, ..) = pat. node;
1649
1649
if let BindingAnnotation :: Mutable = bind_ann;
1650
1650
then {
1651
- return Some ( node_id) ;
1651
+ return Some ( cx . tcx . hir ( ) . node_to_hir_id ( node_id) ) ;
1652
1652
}
1653
1653
}
1654
1654
}
@@ -1660,11 +1660,11 @@ fn check_for_mutability(cx: &LateContext<'_, '_>, bound: &Expr) -> Option<NodeId
1660
1660
fn check_for_mutation (
1661
1661
cx : & LateContext < ' _ , ' _ > ,
1662
1662
body : & Expr ,
1663
- bound_ids : & [ Option < NodeId > ] ,
1663
+ bound_ids : & [ Option < HirId > ] ,
1664
1664
) -> ( Option < Span > , Option < Span > ) {
1665
1665
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 ] ,
1668
1668
span_low : None ,
1669
1669
span_high : None ,
1670
1670
} ;
@@ -1938,16 +1938,15 @@ fn is_iterator_used_after_while_let<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, it
1938
1938
past_while_let : false ,
1939
1939
var_used_after_while_let : false ,
1940
1940
} ;
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) {
1943
1942
walk_block ( & mut visitor, enclosing_block) ;
1944
1943
}
1945
1944
visitor. var_used_after_while_let
1946
1945
}
1947
1946
1948
1947
struct VarUsedAfterLoopVisitor < ' a , ' tcx : ' a > {
1949
1948
cx : & ' a LateContext < ' a , ' tcx > ,
1950
- def_id : NodeId ,
1949
+ def_id : HirId ,
1951
1950
iter_expr_id : HirId ,
1952
1951
past_while_let : bool ,
1953
1952
var_used_after_while_let : bool ,
@@ -2052,9 +2051,9 @@ enum VarState {
2052
2051
2053
2052
/// Scan a for loop for variables that are incremented exactly once.
2054
2053
struct 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
2058
2057
done : bool ,
2059
2058
}
2060
2059
@@ -2108,7 +2107,7 @@ impl<'a, 'tcx> Visitor<'tcx> for IncrementVisitor<'a, 'tcx> {
2108
2107
struct InitializeVisitor < ' a , ' tcx : ' a > {
2109
2108
cx : & ' a LateContext < ' a , ' tcx > , // context reference
2110
2109
end_expr : & ' tcx Expr , // the for loop. Stop scanning here.
2111
- var_id : NodeId ,
2110
+ var_id : HirId ,
2112
2111
state : VarState ,
2113
2112
name : Option < Name > ,
2114
2113
depth : u32 , // depth of conditional expressions
@@ -2119,7 +2118,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InitializeVisitor<'a, 'tcx> {
2119
2118
fn visit_stmt ( & mut self , stmt : & ' tcx Stmt ) {
2120
2119
// Look for declarations of the variable
2121
2120
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 {
2123
2122
if let PatKind :: Binding ( .., ident, _) = local. pat . node {
2124
2123
self . name = Some ( ident. name ) ;
2125
2124
@@ -2191,11 +2190,11 @@ impl<'a, 'tcx> Visitor<'tcx> for InitializeVisitor<'a, 'tcx> {
2191
2190
}
2192
2191
}
2193
2192
2194
- fn var_def_id ( cx : & LateContext < ' _ , ' _ > , expr : & Expr ) -> Option < NodeId > {
2193
+ fn var_def_id ( cx : & LateContext < ' _ , ' _ > , expr : & Expr ) -> Option < HirId > {
2195
2194
if let ExprKind :: Path ( ref qpath) = expr. node {
2196
2195
let path_res = cx. tables . qpath_def ( qpath, expr. hir_id ) ;
2197
2196
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) ) ;
2199
2198
}
2200
2199
}
2201
2200
None
@@ -2376,7 +2375,7 @@ fn check_infinite_loop<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, cond: &'tcx Expr, e
2376
2375
/// All variables definition IDs are collected
2377
2376
struct VarCollectorVisitor < ' a , ' tcx : ' a > {
2378
2377
cx : & ' a LateContext < ' a , ' tcx > ,
2379
- ids : FxHashSet < NodeId > ,
2378
+ ids : FxHashSet < HirId > ,
2380
2379
def_ids : FxHashMap < def_id:: DefId , bool > ,
2381
2380
skip : bool ,
2382
2381
}
@@ -2390,7 +2389,7 @@ impl<'a, 'tcx> VarCollectorVisitor<'a, 'tcx> {
2390
2389
then {
2391
2390
match def {
2392
2391
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) ) ;
2394
2393
} ,
2395
2394
Def :: Static ( def_id, mutable) => {
2396
2395
self . def_ids. insert( def_id, mutable) ;
0 commit comments