Skip to content

Commit f678bf0

Browse files
committed
Address comments
1 parent 9a59789 commit f678bf0

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/librustc/ty/maps/config.rs

+3
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,13 @@ pub trait QueryConfig<'tcx> {
3535
type Value: Clone + for<'a> HashStable<StableHashingContext<'a>>;
3636

3737
fn query(key: Self::Key) -> Query<'tcx>;
38+
39+
// Don't use this method to access query results, instead use the methods on TyCtxt
3840
fn query_map<'a>(tcx: TyCtxt<'a, 'tcx, '_>) -> &'a Lock<QueryMap<'tcx, Self>>;
3941

4042
fn to_dep_node(tcx: TyCtxt<'_, 'tcx, '_>, key: &Self::Key) -> DepNode;
4143

44+
// Don't use this method to compute query results, instead use the methods on TyCtxt
4245
fn compute(tcx: TyCtxt<'_, 'tcx, '_>, key: Self::Key) -> Self::Value;
4346

4447
fn handle_cycle_error(tcx: TyCtxt<'_, 'tcx, '_>) -> Self::Value;

src/librustc/ty/maps/plumbing.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -186,18 +186,18 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> {
186186
// The TyCtxt stored in TLS has the same global interner lifetime
187187
// as `tcx`, so we use `with_related_context` to relate the 'gcx lifetimes
188188
// when accessing the ImplicitCtxt
189-
let r = tls::with_related_context(tcx, move |icx| {
189+
let r = tls::with_related_context(tcx, move |current_icx| {
190190
// Update the ImplicitCtxt to point to our new query job
191-
let icx = tls::ImplicitCtxt {
191+
let new_icx = tls::ImplicitCtxt {
192192
tcx,
193193
query: Some(self.job.clone()),
194-
layout_depth: icx.layout_depth,
195-
task: icx.task,
194+
layout_depth: current_icx.layout_depth,
195+
task: current_icx.task,
196196
};
197197

198198
// Use the ImplicitCtxt while we execute the query
199-
tls::enter_context(&icx, |icx| {
200-
compute(icx.tcx)
199+
tls::enter_context(&new_icx, |_| {
200+
compute(tcx)
201201
})
202202
});
203203

0 commit comments

Comments
 (0)