@@ -79,7 +79,7 @@ use std::mem;
7979use std:: ops:: { Bound , Deref } ;
8080use std:: sync:: Arc ;
8181
82- use super :: { ImplPolarity , RvalueScopes } ;
82+ use super :: { ImplPolarity , ResolverOutputs , RvalueScopes } ;
8383
8484pub trait OnDiskCache < ' tcx > : rustc_data_structures:: sync:: Sync {
8585 /// Creates a new `OnDiskCache` instance from the serialized data in `data`.
@@ -1067,10 +1067,9 @@ pub struct GlobalCtxt<'tcx> {
10671067 pub consts : CommonConsts < ' tcx > ,
10681068
10691069 definitions : RwLock < Definitions > ,
1070- cstore : Box < CrateStoreDyn > ,
10711070
10721071 /// Output of the resolver.
1073- pub ( crate ) untracked_resolutions : ty:: ResolverOutputs ,
1072+ pub ( crate ) untracked_resolutions : ty:: ResolverGlobalCtxt ,
10741073 untracked_resolver_for_lowering : Steal < ty:: ResolverAstLowering > ,
10751074 /// The entire crate as AST. This field serves as the input for the hir_crate query,
10761075 /// which lowers it from AST to HIR. It must not be read or used by anything else.
@@ -1233,10 +1232,7 @@ impl<'tcx> TyCtxt<'tcx> {
12331232 lint_store : Lrc < dyn Any + sync:: Send + sync:: Sync > ,
12341233 arena : & ' tcx WorkerLocal < Arena < ' tcx > > ,
12351234 hir_arena : & ' tcx WorkerLocal < hir:: Arena < ' tcx > > ,
1236- definitions : Definitions ,
1237- cstore : Box < CrateStoreDyn > ,
1238- untracked_resolutions : ty:: ResolverOutputs ,
1239- untracked_resolver_for_lowering : ty:: ResolverAstLowering ,
1235+ resolver_outputs : ResolverOutputs ,
12401236 krate : Lrc < ast:: Crate > ,
12411237 dep_graph : DepGraph ,
12421238 on_disk_cache : Option < & ' tcx dyn OnDiskCache < ' tcx > > ,
@@ -1245,6 +1241,11 @@ impl<'tcx> TyCtxt<'tcx> {
12451241 crate_name : & str ,
12461242 output_filenames : OutputFilenames ,
12471243 ) -> GlobalCtxt < ' tcx > {
1244+ let ResolverOutputs {
1245+ definitions,
1246+ global_ctxt : untracked_resolutions,
1247+ ast_lowering : untracked_resolver_for_lowering,
1248+ } = resolver_outputs;
12481249 let data_layout = TargetDataLayout :: parse ( & s. target ) . unwrap_or_else ( |err| {
12491250 s. emit_fatal ( err) ;
12501251 } ) ;
@@ -1253,7 +1254,7 @@ impl<'tcx> TyCtxt<'tcx> {
12531254 & interners,
12541255 s,
12551256 & definitions,
1256- & * cstore,
1257+ & * untracked_resolutions . cstore ,
12571258 // This is only used to create a stable hashing context.
12581259 & untracked_resolutions. source_span ,
12591260 ) ;
@@ -1268,7 +1269,6 @@ impl<'tcx> TyCtxt<'tcx> {
12681269 interners,
12691270 dep_graph,
12701271 definitions : RwLock :: new ( definitions) ,
1271- cstore,
12721272 prof : s. prof . clone ( ) ,
12731273 types : common_types,
12741274 lifetimes : common_lifetimes,
@@ -1369,7 +1369,7 @@ impl<'tcx> TyCtxt<'tcx> {
13691369 if let Some ( id) = id. as_local ( ) {
13701370 self . definitions_untracked ( ) . def_key ( id)
13711371 } else {
1372- self . cstore . def_key ( id)
1372+ self . untracked_resolutions . cstore . def_key ( id)
13731373 }
13741374 }
13751375
@@ -1383,7 +1383,7 @@ impl<'tcx> TyCtxt<'tcx> {
13831383 if let Some ( id) = id. as_local ( ) {
13841384 self . definitions_untracked ( ) . def_path ( id)
13851385 } else {
1386- self . cstore . def_path ( id)
1386+ self . untracked_resolutions . cstore . def_path ( id)
13871387 }
13881388 }
13891389
@@ -1393,7 +1393,7 @@ impl<'tcx> TyCtxt<'tcx> {
13931393 if let Some ( def_id) = def_id. as_local ( ) {
13941394 self . definitions_untracked ( ) . def_path_hash ( def_id)
13951395 } else {
1396- self . cstore . def_path_hash ( def_id)
1396+ self . untracked_resolutions . cstore . def_path_hash ( def_id)
13971397 }
13981398 }
13991399
@@ -1402,7 +1402,7 @@ impl<'tcx> TyCtxt<'tcx> {
14021402 if crate_num == LOCAL_CRATE {
14031403 self . sess . local_stable_crate_id ( )
14041404 } else {
1405- self . cstore . stable_crate_id ( crate_num)
1405+ self . untracked_resolutions . cstore . stable_crate_id ( crate_num)
14061406 }
14071407 }
14081408
@@ -1413,7 +1413,7 @@ impl<'tcx> TyCtxt<'tcx> {
14131413 if stable_crate_id == self . sess . local_stable_crate_id ( ) {
14141414 LOCAL_CRATE
14151415 } else {
1416- self . cstore . stable_crate_id_to_crate_num ( stable_crate_id)
1416+ self . untracked_resolutions . cstore . stable_crate_id_to_crate_num ( stable_crate_id)
14171417 }
14181418 }
14191419
@@ -1432,8 +1432,9 @@ impl<'tcx> TyCtxt<'tcx> {
14321432 } else {
14331433 // If this is a DefPathHash from an upstream crate, let the CrateStore map
14341434 // it to a DefId.
1435- let cnum = self . cstore . stable_crate_id_to_crate_num ( stable_crate_id) ;
1436- self . cstore . def_path_hash_to_def_id ( cnum, hash)
1435+ let cstore = & * self . untracked_resolutions . cstore ;
1436+ let cnum = cstore. stable_crate_id_to_crate_num ( stable_crate_id) ;
1437+ cstore. def_path_hash_to_def_id ( cnum, hash)
14371438 }
14381439 }
14391440
@@ -1445,7 +1446,7 @@ impl<'tcx> TyCtxt<'tcx> {
14451446 let ( crate_name, stable_crate_id) = if def_id. is_local ( ) {
14461447 ( self . crate_name , self . sess . local_stable_crate_id ( ) )
14471448 } else {
1448- let cstore = & self . cstore ;
1449+ let cstore = & * self . untracked_resolutions . cstore ;
14491450 ( cstore. crate_name ( def_id. krate ) , cstore. stable_crate_id ( def_id. krate ) )
14501451 } ;
14511452
@@ -1520,7 +1521,7 @@ impl<'tcx> TyCtxt<'tcx> {
15201521 /// Note that this is *untracked* and should only be used within the query
15211522 /// system if the result is otherwise tracked through queries
15221523 pub fn cstore_untracked ( self ) -> & ' tcx CrateStoreDyn {
1523- & * self . cstore
1524+ & * self . untracked_resolutions . cstore
15241525 }
15251526
15261527 /// Note that this is *untracked* and should only be used within the query
@@ -1546,7 +1547,7 @@ impl<'tcx> TyCtxt<'tcx> {
15461547 let hcx = StableHashingContext :: new (
15471548 self . sess ,
15481549 & * definitions,
1549- & * self . cstore ,
1550+ & * self . untracked_resolutions . cstore ,
15501551 & self . untracked_resolutions . source_span ,
15511552 ) ;
15521553 f ( hcx)
@@ -2364,7 +2365,7 @@ impl<'tcx> TyCtxt<'tcx> {
23642365 st,
23652366 self . sess ,
23662367 & self . definitions . read ( ) ,
2367- & * self . cstore ,
2368+ & * self . untracked_resolutions . cstore ,
23682369 // This is only used to create a stable hashing context.
23692370 & self . untracked_resolutions . source_span ,
23702371 )
0 commit comments