Address comments
This commit is contained in:
parent
9a59789663
commit
f678bf0aba
@ -35,10 +35,13 @@ pub trait QueryConfig<'tcx> {
|
||||
type Value: Clone + for<'a> HashStable<StableHashingContext<'a>>;
|
||||
|
||||
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<QueryMap<'tcx, Self>>;
|
||||
|
||||
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;
|
||||
|
@ -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)
|
||||
})
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user