@@ -54,8 +54,8 @@ use rustc_errors::{DiagArgFromDisplay, DiagCtxtHandle, StashKey};
54
54
use rustc_hir:: def:: { DefKind , LifetimeRes , Namespace , PartialRes , PerNS , Res } ;
55
55
use rustc_hir:: def_id:: { CRATE_DEF_ID , LOCAL_CRATE , LocalDefId } ;
56
56
use rustc_hir:: {
57
- self as hir, AngleBrackets , ConstArg , GenericArg , HirId , ItemLocalMap , LangItem ,
58
- LifetimeSource , LifetimeSyntax , ParamName , TraitCandidate ,
57
+ self as hir, AngleBrackets , AttributeMap , ConstArg , GenericArg , HirId , ItemLocalMap , LangItem ,
58
+ LifetimeSource , LifetimeSyntax , MaybeOwner , OwnerId , ParamName , TraitCandidate ,
59
59
} ;
60
60
use rustc_index:: { Idx , IndexSlice , IndexVec } ;
61
61
use rustc_macros:: extension;
@@ -429,7 +429,7 @@ fn compute_hir_hash(
429
429
} )
430
430
}
431
431
432
- pub fn lower_to_hir ( tcx : TyCtxt < ' _ > , ( ) : ( ) ) -> hir:: Crate < ' _ > {
432
+ pub fn lower_to_hir ( tcx : TyCtxt < ' _ > , ( ) : ( ) ) -> hir:: Crate {
433
433
let sess = tcx. sess ;
434
434
// Queries that borrow `resolver_for_lowering`.
435
435
tcx. ensure_done ( ) . output_filenames ( ( ) ) ;
@@ -466,7 +466,27 @@ pub fn lower_to_hir(tcx: TyCtxt<'_>, (): ()) -> hir::Crate<'_> {
466
466
// Don't hash unless necessary, because it's expensive.
467
467
let opt_hir_hash =
468
468
if tcx. needs_crate_hash ( ) { Some ( compute_hir_hash ( tcx, & owners) ) } else { None } ;
469
- hir:: Crate { owners, opt_hir_hash }
469
+
470
+ for ( def_id, owner) in owners. drain_enumerated ( ..) {
471
+ let feed = tcx. super_duper_perf_hack_experiment ( def_id) ;
472
+ feed. hir_owner ( owner) ;
473
+ tcx. super_duper_perf_hack_experiment2 ( OwnerId { def_id } ) . hir_attr_map (
474
+ match owner. as_owner ( ) {
475
+ Some ( o) => & o. attrs ,
476
+ None => AttributeMap :: EMPTY ,
477
+ } ,
478
+ ) ;
479
+ feed. opt_hir_owner_nodes ( owner. as_owner ( ) . map ( |i| & i. nodes ) ) ;
480
+ match owner {
481
+ MaybeOwner :: Owner ( _) => feed. local_def_id_to_hir_id ( HirId :: make_owner ( def_id) ) ,
482
+ MaybeOwner :: NonOwner ( hir_id) => feed. local_def_id_to_hir_id ( hir_id) ,
483
+ MaybeOwner :: Phantom => { }
484
+ }
485
+ tcx. super_duper_perf_hack_experiment2 ( OwnerId { def_id } )
486
+ . in_scope_traits_map ( owner. as_owner ( ) . map ( |owner_info| & owner_info. trait_map ) ) ;
487
+ }
488
+
489
+ hir:: Crate { opt_hir_hash }
470
490
}
471
491
472
492
#[ derive( Copy , Clone , PartialEq , Debug ) ]
0 commit comments