@@ -56,7 +56,6 @@ use crate::hir::def_id::DefId;
56
56
use crate :: hir:: Node ;
57
57
use crate :: middle:: region;
58
58
use std:: { cmp, fmt} ;
59
- use syntax:: ast:: DUMMY_NODE_ID ;
60
59
use syntax_pos:: { Pos , Span } ;
61
60
use crate :: traits:: { ObligationCause , ObligationCauseCode } ;
62
61
use crate :: ty:: error:: TypeError ;
@@ -182,8 +181,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
182
181
let cm = self . sess . source_map ( ) ;
183
182
184
183
let scope = region. free_region_binding_scope ( self ) ;
185
- let node = self . hir ( ) . as_local_node_id ( scope) . unwrap_or ( DUMMY_NODE_ID ) ;
186
- let tag = match self . hir ( ) . find ( node) {
184
+ let node = self . hir ( ) . as_local_hir_id ( scope) . unwrap_or ( hir :: DUMMY_HIR_ID ) ;
185
+ let tag = match self . hir ( ) . find_by_hir_id ( node) {
187
186
Some ( Node :: Block ( _) ) | Some ( Node :: Expr ( _) ) => "body" ,
188
187
Some ( Node :: Item ( it) ) => Self :: item_scope_tag ( & it) ,
189
188
Some ( Node :: TraitItem ( it) ) => Self :: trait_item_scope_tag ( & it) ,
@@ -192,7 +191,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
192
191
} ;
193
192
let ( prefix, span) = match * region {
194
193
ty:: ReEarlyBound ( ref br) => {
195
- let mut sp = cm. def_span ( self . hir ( ) . span ( node) ) ;
194
+ let mut sp = cm. def_span ( self . hir ( ) . span_by_hir_id ( node) ) ;
196
195
if let Some ( param) = self . hir ( )
197
196
. get_generics ( scope)
198
197
. and_then ( |generics| generics. get_named ( & br. name ) )
@@ -205,7 +204,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
205
204
bound_region : ty:: BoundRegion :: BrNamed ( _, ref name) ,
206
205
..
207
206
} ) => {
208
- let mut sp = cm. def_span ( self . hir ( ) . span ( node) ) ;
207
+ let mut sp = cm. def_span ( self . hir ( ) . span_by_hir_id ( node) ) ;
209
208
if let Some ( param) = self . hir ( )
210
209
. get_generics ( scope)
211
210
. and_then ( |generics| generics. get_named ( & name) )
@@ -217,15 +216,15 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
217
216
ty:: ReFree ( ref fr) => match fr. bound_region {
218
217
ty:: BrAnon ( idx) => (
219
218
format ! ( "the anonymous lifetime #{} defined on" , idx + 1 ) ,
220
- self . hir ( ) . span ( node) ,
219
+ self . hir ( ) . span_by_hir_id ( node) ,
221
220
) ,
222
221
ty:: BrFresh ( _) => (
223
222
"an anonymous lifetime defined on" . to_owned ( ) ,
224
- self . hir ( ) . span ( node) ,
223
+ self . hir ( ) . span_by_hir_id ( node) ,
225
224
) ,
226
225
_ => (
227
226
format ! ( "the lifetime {} as defined on" , fr. bound_region) ,
228
- cm. def_span ( self . hir ( ) . span ( node) ) ,
227
+ cm. def_span ( self . hir ( ) . span_by_hir_id ( node) ) ,
229
228
) ,
230
229
} ,
231
230
_ => bug ! ( ) ,
@@ -1451,8 +1450,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
1451
1450
format ! ( " for lifetime parameter `{}` in coherence check" , name)
1452
1451
}
1453
1452
infer:: UpvarRegion ( ref upvar_id, _) => {
1454
- let var_node_id = self . tcx . hir ( ) . hir_to_node_id ( upvar_id. var_path . hir_id ) ;
1455
- let var_name = self . tcx . hir ( ) . name ( var_node_id) ;
1453
+ let var_name = self . tcx . hir ( ) . name_by_hir_id ( upvar_id. var_path . hir_id ) ;
1456
1454
format ! ( " for capture of `{}` by closure" , var_name)
1457
1455
}
1458
1456
infer:: NLL ( ..) => bug ! ( "NLL variable found in lexical phase" ) ,
0 commit comments