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