@@ -5,8 +5,8 @@ use rustc_data_structures::base_n;
5
5
use rustc_data_structures:: fingerprint:: Fingerprint ;
6
6
use rustc_data_structures:: fx:: FxHashMap ;
7
7
use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
8
- use rustc_hir:: def_id:: { CrateNum , DefId , LOCAL_CRATE } ;
9
- use rustc_hir:: { HirId , ItemId } ;
8
+ use rustc_hir:: def_id:: { CrateNum , DefId , LocalDefId , LOCAL_CRATE } ;
9
+ use rustc_hir:: ItemId ;
10
10
use rustc_query_system:: ich:: { NodeIdHashingMode , StableHashingContext } ;
11
11
use rustc_session:: config:: OptLevel ;
12
12
use rustc_span:: source_map:: Span ;
@@ -179,15 +179,11 @@ impl<'tcx> MonoItem<'tcx> {
179
179
180
180
pub fn local_span ( & self , tcx : TyCtxt < ' tcx > ) -> Option < Span > {
181
181
match * self {
182
- MonoItem :: Fn ( Instance { def, .. } ) => {
183
- def. def_id ( ) . as_local ( ) . map ( |def_id| tcx. hir ( ) . local_def_id_to_hir_id ( def_id) )
184
- }
185
- MonoItem :: Static ( def_id) => {
186
- def_id. as_local ( ) . map ( |def_id| tcx. hir ( ) . local_def_id_to_hir_id ( def_id) )
187
- }
188
- MonoItem :: GlobalAsm ( item_id) => Some ( item_id. hir_id ( ) ) ,
182
+ MonoItem :: Fn ( Instance { def, .. } ) => def. def_id ( ) . as_local ( ) ,
183
+ MonoItem :: Static ( def_id) => def_id. as_local ( ) ,
184
+ MonoItem :: GlobalAsm ( item_id) => Some ( item_id. def_id ) ,
189
185
}
190
- . map ( |hir_id | tcx. hir ( ) . span ( hir_id ) )
186
+ . map ( |def_id | tcx. def_span ( def_id ) )
191
187
}
192
188
193
189
// Only used by rustc_codegen_cranelift
@@ -355,7 +351,7 @@ impl<'tcx> CodegenUnit<'tcx> {
355
351
// The codegen tests rely on items being process in the same order as
356
352
// they appear in the file, so for local items, we sort by node_id first
357
353
#[ derive( PartialEq , Eq , PartialOrd , Ord ) ]
358
- pub struct ItemSortKey < ' tcx > ( Option < HirId > , SymbolName < ' tcx > ) ;
354
+ pub struct ItemSortKey < ' tcx > ( Option < LocalDefId > , SymbolName < ' tcx > ) ;
359
355
360
356
fn item_sort_key < ' tcx > ( tcx : TyCtxt < ' tcx > , item : MonoItem < ' tcx > ) -> ItemSortKey < ' tcx > {
361
357
ItemSortKey (
@@ -366,10 +362,7 @@ impl<'tcx> CodegenUnit<'tcx> {
366
362
// instances into account. The others don't matter for
367
363
// the codegen tests and can even make item order
368
364
// unstable.
369
- InstanceDef :: Item ( def) => def
370
- . did
371
- . as_local ( )
372
- . map ( |def_id| tcx. hir ( ) . local_def_id_to_hir_id ( def_id) ) ,
365
+ InstanceDef :: Item ( def) => def. did . as_local ( ) ,
373
366
InstanceDef :: VtableShim ( ..)
374
367
| InstanceDef :: ReifyShim ( ..)
375
368
| InstanceDef :: Intrinsic ( ..)
@@ -380,10 +373,8 @@ impl<'tcx> CodegenUnit<'tcx> {
380
373
| InstanceDef :: CloneShim ( ..) => None ,
381
374
}
382
375
}
383
- MonoItem :: Static ( def_id) => {
384
- def_id. as_local ( ) . map ( |def_id| tcx. hir ( ) . local_def_id_to_hir_id ( def_id) )
385
- }
386
- MonoItem :: GlobalAsm ( item_id) => Some ( item_id. hir_id ( ) ) ,
376
+ MonoItem :: Static ( def_id) => def_id. as_local ( ) ,
377
+ MonoItem :: GlobalAsm ( item_id) => Some ( item_id. def_id ) ,
387
378
} ,
388
379
item. symbol_name ( tcx) ,
389
380
)
0 commit comments