@@ -97,6 +97,8 @@ pub(super) struct JobOwner<'a, 'tcx: 'a, Q: QueryDescription<'tcx> + 'a> {
97
97
cache : & ' a Lock < QueryCache < ' tcx , Q > > ,
98
98
key : Q :: Key ,
99
99
job : Lrc < QueryJob < ' tcx > > ,
100
+ // FIXME: Remove ImplicitCtxt.layout_depth to get rid of this field
101
+ layout_depth : usize ,
100
102
}
101
103
102
104
impl < ' a , ' tcx , Q : QueryDescription < ' tcx > > JobOwner < ' a , ' tcx , Q > {
@@ -145,6 +147,7 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> {
145
147
cache,
146
148
job : job. clone ( ) ,
147
149
key : ( * key) . clone ( ) ,
150
+ layout_depth : icx. layout_depth ,
148
151
} ;
149
152
entry. insert ( QueryResult :: Started ( job) ) ;
150
153
TryGetJob :: NotYetStarted ( owner)
@@ -200,23 +203,17 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> {
200
203
where
201
204
F : for < ' b > FnOnce ( TyCtxt < ' b , ' tcx , ' lcx > ) -> R
202
205
{
203
- // The TyCtxt stored in TLS has the same global interner lifetime
204
- // as `tcx`, so we use `with_related_context` to relate the 'gcx lifetimes
205
- // when accessing the ImplicitCtxt
206
- tls:: with_related_context ( tcx, move |current_icx| {
207
- // Update the ImplicitCtxt to point to our new query job
208
- let new_icx = tls:: ImplicitCtxt {
209
- tcx,
210
- query : Some ( self . job . clone ( ) ) ,
211
- // FIXME: Remove `layout_depth` to avoid accessing ImplicitCtxt here
212
- layout_depth : current_icx. layout_depth ,
213
- task,
214
- } ;
206
+ // Update the ImplicitCtxt to point to our new query job
207
+ let new_icx = tls:: ImplicitCtxt {
208
+ tcx,
209
+ query : Some ( self . job . clone ( ) ) ,
210
+ layout_depth : self . layout_depth ,
211
+ task,
212
+ } ;
215
213
216
- // Use the ImplicitCtxt while we execute the query
217
- tls:: enter_context ( & new_icx, |_| {
218
- compute ( tcx)
219
- } )
214
+ // Use the ImplicitCtxt while we execute the query
215
+ tls:: enter_context ( & new_icx, |_| {
216
+ compute ( tcx)
220
217
} )
221
218
}
222
219
}
0 commit comments