@@ -5,8 +5,8 @@ use rustc_data_structures::base_n;
55use rustc_data_structures:: fingerprint:: Fingerprint ;
66use rustc_data_structures:: fx:: FxHashMap ;
77use 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 ;
1010use rustc_query_system:: ich:: { NodeIdHashingMode , StableHashingContext } ;
1111use rustc_session:: config:: OptLevel ;
1212use rustc_span:: source_map:: Span ;
@@ -179,15 +179,11 @@ impl<'tcx> MonoItem<'tcx> {
179179
180180 pub fn local_span ( & self , tcx : TyCtxt < ' tcx > ) -> Option < Span > {
181181 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 ) ,
189185 }
190- . map ( |hir_id | tcx. hir ( ) . span ( hir_id ) )
186+ . map ( |def_id | tcx. def_span ( def_id ) )
191187 }
192188
193189 // Only used by rustc_codegen_cranelift
@@ -355,7 +351,7 @@ impl<'tcx> CodegenUnit<'tcx> {
355351 // The codegen tests rely on items being process in the same order as
356352 // they appear in the file, so for local items, we sort by node_id first
357353 #[ derive( PartialEq , Eq , PartialOrd , Ord ) ]
358- pub struct ItemSortKey < ' tcx > ( Option < HirId > , SymbolName < ' tcx > ) ;
354+ pub struct ItemSortKey < ' tcx > ( Option < LocalDefId > , SymbolName < ' tcx > ) ;
359355
360356 fn item_sort_key < ' tcx > ( tcx : TyCtxt < ' tcx > , item : MonoItem < ' tcx > ) -> ItemSortKey < ' tcx > {
361357 ItemSortKey (
@@ -366,10 +362,7 @@ impl<'tcx> CodegenUnit<'tcx> {
366362 // instances into account. The others don't matter for
367363 // the codegen tests and can even make item order
368364 // 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 ( ) ,
373366 InstanceDef :: VtableShim ( ..)
374367 | InstanceDef :: ReifyShim ( ..)
375368 | InstanceDef :: Intrinsic ( ..)
@@ -380,10 +373,8 @@ impl<'tcx> CodegenUnit<'tcx> {
380373 | InstanceDef :: CloneShim ( ..) => None ,
381374 }
382375 }
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 ) ,
387378 } ,
388379 item. symbol_name ( tcx) ,
389380 )
0 commit comments