@@ -37,7 +37,7 @@ use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE, LocalDefId};
3737use rustc_hir:: definitions:: { DefPathData , Definitions , DisambiguatorState } ;
3838use rustc_hir:: intravisit:: VisitorExt ;
3939use rustc_hir:: lang_items:: LangItem ;
40- use rustc_hir:: { self as hir, Attribute , HirId , Node , TraitCandidate } ;
40+ use rustc_hir:: { self as hir, Attribute , HirId , MaybeOwner , Node , OwnerInfo , TraitCandidate } ;
4141use rustc_index:: IndexVec ;
4242use rustc_macros:: { HashStable , TyDecodable , TyEncodable } ;
4343use rustc_query_system:: cache:: WithDepNode ;
@@ -1272,6 +1272,11 @@ impl<'tcx> TyCtxt<'tcx> {
12721272 TyCtxtFeed { tcx : self , key : ( ) }
12731273 }
12741274
1275+ pub fn super_duper_perf_hack_experiment ( self , key : LocalDefId ) -> TyCtxtFeed < ' tcx , LocalDefId > {
1276+ self . dep_graph . assert_eval_always ( ) ;
1277+ TyCtxtFeed { tcx : self , key }
1278+ }
1279+
12751280 /// Only used in the resolver to register the `CRATE_DEF_ID` `DefId` and feed
12761281 /// some queries for it. It will panic if used twice.
12771282 pub fn create_local_crate_def_id ( self , span : Span ) -> TyCtxtFeed < ' tcx , LocalDefId > {
@@ -1326,24 +1331,25 @@ impl<'tcx> TyCtxtFeed<'tcx, LocalDefId> {
13261331
13271332 // Fills in all the important parts needed by HIR queries
13281333 pub fn feed_hir ( & self ) {
1329- self . local_def_id_to_hir_id ( HirId :: make_owner ( self . def_id ( ) ) ) ;
1330-
13311334 let node = hir:: OwnerNode :: Synthetic ;
13321335 let bodies = Default :: default ( ) ;
1333- let attrs = hir:: AttributeMap :: EMPTY ;
1334-
1336+ let attrs = hir:: AttributeMap :: empty ( ) ;
13351337 let ( opt_hash_including_bodies, _) =
13361338 self . tcx . hash_owner_nodes ( node, & bodies, & attrs. map , attrs. define_opaque ) ;
13371339 let node = node. into ( ) ;
1338- self . opt_hir_owner_nodes ( Some ( self . tcx . arena . alloc ( hir:: OwnerNodes {
1339- opt_hash_including_bodies,
1340- nodes : IndexVec :: from_elem_n (
1341- hir:: ParentedNode { parent : hir:: ItemLocalId :: INVALID , node } ,
1342- 1 ,
1343- ) ,
1344- bodies,
1340+ self . hir_owner ( MaybeOwner :: Owner ( self . tcx . arena . alloc ( OwnerInfo {
1341+ nodes : hir:: OwnerNodes {
1342+ opt_hash_including_bodies,
1343+ nodes : IndexVec :: from_elem_n (
1344+ hir:: ParentedNode { parent : hir:: ItemLocalId :: INVALID , node } ,
1345+ 1 ,
1346+ ) ,
1347+ bodies,
1348+ } ,
1349+ parenting : Default :: default ( ) ,
1350+ attrs,
1351+ trait_map : Default :: default ( ) ,
13451352 } ) ) ) ;
1346- self . feed_owner_id ( ) . hir_attr_map ( attrs) ;
13471353 }
13481354}
13491355
0 commit comments