@@ -79,7 +79,7 @@ use std::mem;
79
79
use std:: ops:: { Bound , Deref } ;
80
80
use std:: sync:: Arc ;
81
81
82
- use super :: { ImplPolarity , RvalueScopes } ;
82
+ use super :: { ImplPolarity , ResolverOutputs , RvalueScopes } ;
83
83
84
84
pub trait OnDiskCache < ' tcx > : rustc_data_structures:: sync:: Sync {
85
85
/// Creates a new `OnDiskCache` instance from the serialized data in `data`.
@@ -1067,10 +1067,9 @@ pub struct GlobalCtxt<'tcx> {
1067
1067
pub consts : CommonConsts < ' tcx > ,
1068
1068
1069
1069
definitions : RwLock < Definitions > ,
1070
- cstore : Box < CrateStoreDyn > ,
1071
1070
1072
1071
/// Output of the resolver.
1073
- pub ( crate ) untracked_resolutions : ty:: ResolverOutputs ,
1072
+ pub ( crate ) untracked_resolutions : ty:: ResolverGlobalCtxt ,
1074
1073
untracked_resolver_for_lowering : Steal < ty:: ResolverAstLowering > ,
1075
1074
/// The entire crate as AST. This field serves as the input for the hir_crate query,
1076
1075
/// 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> {
1233
1232
lint_store : Lrc < dyn Any + sync:: Send + sync:: Sync > ,
1234
1233
arena : & ' tcx WorkerLocal < Arena < ' tcx > > ,
1235
1234
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 ,
1240
1236
krate : Lrc < ast:: Crate > ,
1241
1237
dep_graph : DepGraph ,
1242
1238
on_disk_cache : Option < & ' tcx dyn OnDiskCache < ' tcx > > ,
@@ -1245,6 +1241,11 @@ impl<'tcx> TyCtxt<'tcx> {
1245
1241
crate_name : & str ,
1246
1242
output_filenames : OutputFilenames ,
1247
1243
) -> GlobalCtxt < ' tcx > {
1244
+ let ResolverOutputs {
1245
+ definitions,
1246
+ global_ctxt : untracked_resolutions,
1247
+ ast_lowering : untracked_resolver_for_lowering,
1248
+ } = resolver_outputs;
1248
1249
let data_layout = TargetDataLayout :: parse ( & s. target ) . unwrap_or_else ( |err| {
1249
1250
s. emit_fatal ( err) ;
1250
1251
} ) ;
@@ -1253,7 +1254,7 @@ impl<'tcx> TyCtxt<'tcx> {
1253
1254
& interners,
1254
1255
s,
1255
1256
& definitions,
1256
- & * cstore,
1257
+ & * untracked_resolutions . cstore ,
1257
1258
// This is only used to create a stable hashing context.
1258
1259
& untracked_resolutions. source_span ,
1259
1260
) ;
@@ -1268,7 +1269,6 @@ impl<'tcx> TyCtxt<'tcx> {
1268
1269
interners,
1269
1270
dep_graph,
1270
1271
definitions : RwLock :: new ( definitions) ,
1271
- cstore,
1272
1272
prof : s. prof . clone ( ) ,
1273
1273
types : common_types,
1274
1274
lifetimes : common_lifetimes,
@@ -1369,7 +1369,7 @@ impl<'tcx> TyCtxt<'tcx> {
1369
1369
if let Some ( id) = id. as_local ( ) {
1370
1370
self . definitions_untracked ( ) . def_key ( id)
1371
1371
} else {
1372
- self . cstore . def_key ( id)
1372
+ self . untracked_resolutions . cstore . def_key ( id)
1373
1373
}
1374
1374
}
1375
1375
@@ -1383,7 +1383,7 @@ impl<'tcx> TyCtxt<'tcx> {
1383
1383
if let Some ( id) = id. as_local ( ) {
1384
1384
self . definitions_untracked ( ) . def_path ( id)
1385
1385
} else {
1386
- self . cstore . def_path ( id)
1386
+ self . untracked_resolutions . cstore . def_path ( id)
1387
1387
}
1388
1388
}
1389
1389
@@ -1393,7 +1393,7 @@ impl<'tcx> TyCtxt<'tcx> {
1393
1393
if let Some ( def_id) = def_id. as_local ( ) {
1394
1394
self . definitions_untracked ( ) . def_path_hash ( def_id)
1395
1395
} else {
1396
- self . cstore . def_path_hash ( def_id)
1396
+ self . untracked_resolutions . cstore . def_path_hash ( def_id)
1397
1397
}
1398
1398
}
1399
1399
@@ -1402,7 +1402,7 @@ impl<'tcx> TyCtxt<'tcx> {
1402
1402
if crate_num == LOCAL_CRATE {
1403
1403
self . sess . local_stable_crate_id ( )
1404
1404
} else {
1405
- self . cstore . stable_crate_id ( crate_num)
1405
+ self . untracked_resolutions . cstore . stable_crate_id ( crate_num)
1406
1406
}
1407
1407
}
1408
1408
@@ -1413,7 +1413,7 @@ impl<'tcx> TyCtxt<'tcx> {
1413
1413
if stable_crate_id == self . sess . local_stable_crate_id ( ) {
1414
1414
LOCAL_CRATE
1415
1415
} 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)
1417
1417
}
1418
1418
}
1419
1419
@@ -1432,8 +1432,9 @@ impl<'tcx> TyCtxt<'tcx> {
1432
1432
} else {
1433
1433
// If this is a DefPathHash from an upstream crate, let the CrateStore map
1434
1434
// 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)
1437
1438
}
1438
1439
}
1439
1440
@@ -1445,7 +1446,7 @@ impl<'tcx> TyCtxt<'tcx> {
1445
1446
let ( crate_name, stable_crate_id) = if def_id. is_local ( ) {
1446
1447
( self . crate_name , self . sess . local_stable_crate_id ( ) )
1447
1448
} else {
1448
- let cstore = & self . cstore ;
1449
+ let cstore = & * self . untracked_resolutions . cstore ;
1449
1450
( cstore. crate_name ( def_id. krate ) , cstore. stable_crate_id ( def_id. krate ) )
1450
1451
} ;
1451
1452
@@ -1520,7 +1521,7 @@ impl<'tcx> TyCtxt<'tcx> {
1520
1521
/// Note that this is *untracked* and should only be used within the query
1521
1522
/// system if the result is otherwise tracked through queries
1522
1523
pub fn cstore_untracked ( self ) -> & ' tcx CrateStoreDyn {
1523
- & * self . cstore
1524
+ & * self . untracked_resolutions . cstore
1524
1525
}
1525
1526
1526
1527
/// Note that this is *untracked* and should only be used within the query
@@ -1546,7 +1547,7 @@ impl<'tcx> TyCtxt<'tcx> {
1546
1547
let hcx = StableHashingContext :: new (
1547
1548
self . sess ,
1548
1549
& * definitions,
1549
- & * self . cstore ,
1550
+ & * self . untracked_resolutions . cstore ,
1550
1551
& self . untracked_resolutions . source_span ,
1551
1552
) ;
1552
1553
f ( hcx)
@@ -2364,7 +2365,7 @@ impl<'tcx> TyCtxt<'tcx> {
2364
2365
st,
2365
2366
self . sess ,
2366
2367
& self . definitions . read ( ) ,
2367
- & * self . cstore ,
2368
+ & * self . untracked_resolutions . cstore ,
2368
2369
// This is only used to create a stable hashing context.
2369
2370
& self . untracked_resolutions . source_span ,
2370
2371
)
0 commit comments