diff --git a/src/librustc/ty/maps/config.rs b/src/librustc/ty/maps/config.rs index 2f6e7ade89f61..57c8c4f34e70e 100644 --- a/src/librustc/ty/maps/config.rs +++ b/src/librustc/ty/maps/config.rs @@ -35,10 +35,13 @@ pub trait QueryConfig<'tcx> { type Value: Clone + for<'a> HashStable>; fn query(key: Self::Key) -> Query<'tcx>; + + // Don't use this method to access query results, instead use the methods on TyCtxt fn query_map<'a>(tcx: TyCtxt<'a, 'tcx, '_>) -> &'a Lock>; fn to_dep_node(tcx: TyCtxt<'_, 'tcx, '_>, key: &Self::Key) -> DepNode; + // Don't use this method to compute query results, instead use the methods on TyCtxt fn compute(tcx: TyCtxt<'_, 'tcx, '_>, key: Self::Key) -> Self::Value; fn handle_cycle_error(tcx: TyCtxt<'_, 'tcx, '_>) -> Self::Value; diff --git a/src/librustc/ty/maps/plumbing.rs b/src/librustc/ty/maps/plumbing.rs index 83305db57dad7..37950463f7444 100644 --- a/src/librustc/ty/maps/plumbing.rs +++ b/src/librustc/ty/maps/plumbing.rs @@ -186,18 +186,18 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> { // The TyCtxt stored in TLS has the same global interner lifetime // as `tcx`, so we use `with_related_context` to relate the 'gcx lifetimes // when accessing the ImplicitCtxt - let r = tls::with_related_context(tcx, move |icx| { + let r = tls::with_related_context(tcx, move |current_icx| { // Update the ImplicitCtxt to point to our new query job - let icx = tls::ImplicitCtxt { + let new_icx = tls::ImplicitCtxt { tcx, query: Some(self.job.clone()), - layout_depth: icx.layout_depth, - task: icx.task, + layout_depth: current_icx.layout_depth, + task: current_icx.task, }; // Use the ImplicitCtxt while we execute the query - tls::enter_context(&icx, |icx| { - compute(icx.tcx) + tls::enter_context(&new_icx, |_| { + compute(tcx) }) });