@@ -54,8 +54,8 @@ use rustc_errors::{DiagArgFromDisplay, DiagCtxtHandle, StashKey};
5454use rustc_hir:: def:: { DefKind , LifetimeRes , Namespace , PartialRes , PerNS , Res } ;
5555use rustc_hir:: def_id:: { CRATE_DEF_ID , LOCAL_CRATE , LocalDefId } ;
5656use 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 ,
5959} ;
6060use rustc_index:: { Idx , IndexSlice , IndexVec } ;
6161use rustc_macros:: extension;
@@ -429,7 +429,7 @@ fn compute_hir_hash(
429429 } )
430430}
431431
432- pub fn lower_to_hir ( tcx : TyCtxt < ' _ > , ( ) : ( ) ) -> hir:: Crate < ' _ > {
432+ pub fn lower_to_hir ( tcx : TyCtxt < ' _ > , ( ) : ( ) ) -> hir:: Crate {
433433 let sess = tcx. sess ;
434434 // Queries that borrow `resolver_for_lowering`.
435435 tcx. ensure_done ( ) . output_filenames ( ( ) ) ;
@@ -466,7 +466,27 @@ pub fn lower_to_hir(tcx: TyCtxt<'_>, (): ()) -> hir::Crate<'_> {
466466 // Don't hash unless necessary, because it's expensive.
467467 let opt_hir_hash =
468468 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 }
470490}
471491
472492#[ derive( Copy , Clone , PartialEq , Debug ) ]
0 commit comments