@@ -81,7 +81,7 @@ use std::mem;
81
81
use std:: ops:: { Bound , Deref } ;
82
82
use std:: sync:: Arc ;
83
83
84
- use super :: { ImplPolarity , ResolverOutputs , RvalueScopes } ;
84
+ use super :: { ImplPolarity , RvalueScopes } ;
85
85
86
86
pub trait OnDiskCache < ' tcx > : rustc_data_structures:: sync:: Sync {
87
87
/// Creates a new `OnDiskCache` instance from the serialized data in `data`.
@@ -1034,16 +1034,29 @@ pub struct FreeRegionInfo {
1034
1034
1035
1035
/// This struct should only be created by `create_def`.
1036
1036
#[ derive( Copy , Clone ) ]
1037
- pub struct TyCtxtFeed < ' tcx > {
1037
+ pub struct TyCtxtFeed < ' tcx , KEY : Copy > {
1038
1038
pub tcx : TyCtxt < ' tcx > ,
1039
1039
// Do not allow direct access, as downstream code must not mutate this field.
1040
- def_id : LocalDefId ,
1040
+ key : KEY ,
1041
1041
}
1042
1042
1043
- impl < ' tcx > TyCtxtFeed < ' tcx > {
1043
+ impl < ' tcx > TyCtxt < ' tcx > {
1044
+ pub fn feed_unit_query ( self ) -> TyCtxtFeed < ' tcx , ( ) > {
1045
+ TyCtxtFeed { tcx : self , key : ( ) }
1046
+ }
1047
+ }
1048
+
1049
+ impl < ' tcx , KEY : Copy > TyCtxtFeed < ' tcx , KEY > {
1050
+ #[ inline( always) ]
1051
+ pub fn key ( & self ) -> KEY {
1052
+ self . key
1053
+ }
1054
+ }
1055
+
1056
+ impl < ' tcx > TyCtxtFeed < ' tcx , LocalDefId > {
1044
1057
#[ inline( always) ]
1045
1058
pub fn def_id ( & self ) -> LocalDefId {
1046
- self . def_id
1059
+ self . key
1047
1060
}
1048
1061
}
1049
1062
@@ -1099,7 +1112,6 @@ pub struct GlobalCtxt<'tcx> {
1099
1112
1100
1113
/// Output of the resolver.
1101
1114
pub ( crate ) untracked_resolutions : ty:: ResolverGlobalCtxt ,
1102
- untracked_resolver_for_lowering : Steal < ty:: ResolverAstLowering > ,
1103
1115
/// The entire crate as AST. This field serves as the input for the hir_crate query,
1104
1116
/// which lowers it from AST to HIR. It must not be read or used by anything else.
1105
1117
pub untracked_crate : Steal < Lrc < ast:: Crate > > ,
@@ -1262,7 +1274,8 @@ impl<'tcx> TyCtxt<'tcx> {
1262
1274
lint_store : Lrc < dyn Any + sync:: Send + sync:: Sync > ,
1263
1275
arena : & ' tcx WorkerLocal < Arena < ' tcx > > ,
1264
1276
hir_arena : & ' tcx WorkerLocal < hir:: Arena < ' tcx > > ,
1265
- resolver_outputs : ResolverOutputs ,
1277
+ definitions : Definitions ,
1278
+ untracked_resolutions : ty:: ResolverGlobalCtxt ,
1266
1279
krate : Lrc < ast:: Crate > ,
1267
1280
dep_graph : DepGraph ,
1268
1281
on_disk_cache : Option < & ' tcx dyn OnDiskCache < ' tcx > > ,
@@ -1271,11 +1284,6 @@ impl<'tcx> TyCtxt<'tcx> {
1271
1284
crate_name : & str ,
1272
1285
output_filenames : OutputFilenames ,
1273
1286
) -> GlobalCtxt < ' tcx > {
1274
- let ResolverOutputs {
1275
- definitions,
1276
- global_ctxt : untracked_resolutions,
1277
- ast_lowering : untracked_resolver_for_lowering,
1278
- } = resolver_outputs;
1279
1287
let data_layout = s. target . parse_data_layout ( ) . unwrap_or_else ( |err| {
1280
1288
s. emit_fatal ( err) ;
1281
1289
} ) ;
@@ -1304,7 +1312,6 @@ impl<'tcx> TyCtxt<'tcx> {
1304
1312
lifetimes : common_lifetimes,
1305
1313
consts : common_consts,
1306
1314
untracked_resolutions,
1307
- untracked_resolver_for_lowering : Steal :: new ( untracked_resolver_for_lowering) ,
1308
1315
untracked_crate : Steal :: new ( krate) ,
1309
1316
on_disk_cache,
1310
1317
queries,
@@ -1515,7 +1522,7 @@ impl<'tcx> TyCtxtAt<'tcx> {
1515
1522
self ,
1516
1523
parent : LocalDefId ,
1517
1524
data : hir:: definitions:: DefPathData ,
1518
- ) -> TyCtxtFeed < ' tcx > {
1525
+ ) -> TyCtxtFeed < ' tcx , LocalDefId > {
1519
1526
// This function modifies `self.definitions` using a side-effect.
1520
1527
// We need to ensure that these side effects are re-run by the incr. comp. engine.
1521
1528
// Depending on the forever-red node will tell the graph that the calling query
@@ -1536,9 +1543,9 @@ impl<'tcx> TyCtxtAt<'tcx> {
1536
1543
// This is fine because:
1537
1544
// - those queries are `eval_always` so we won't miss their result changing;
1538
1545
// - this write will have happened before these queries are called.
1539
- let def_id = self . definitions . write ( ) . create_def ( parent, data) ;
1546
+ let key = self . definitions . write ( ) . create_def ( parent, data) ;
1540
1547
1541
- let feed = TyCtxtFeed { tcx : self . tcx , def_id } ;
1548
+ let feed = TyCtxtFeed { tcx : self . tcx , key } ;
1542
1549
feed. def_span ( self . span ) ;
1543
1550
feed
1544
1551
}
@@ -3107,7 +3114,6 @@ fn ptr_eq<T, U>(t: *const T, u: *const U) -> bool {
3107
3114
3108
3115
pub fn provide ( providers : & mut ty:: query:: Providers ) {
3109
3116
providers. resolutions = |tcx, ( ) | & tcx. untracked_resolutions ;
3110
- providers. resolver_for_lowering = |tcx, ( ) | & tcx. untracked_resolver_for_lowering ;
3111
3117
providers. module_reexports =
3112
3118
|tcx, id| tcx. resolutions ( ( ) ) . reexport_map . get ( & id) . map ( |v| & v[ ..] ) ;
3113
3119
providers. crate_name = |tcx, id| {
0 commit comments