Skip to content

Commit

Permalink
Rollup merge of #75462 - Mark-Simulacrum:clean-queries, r=petrochenkov
Browse files Browse the repository at this point in the history
Remove unused tcx parameter

We shouldn't need access to a query context when storing already computed values.
  • Loading branch information
tmandry authored Aug 14, 2020
2 parents c76259a + bff104d commit 84f7991
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
9 changes: 3 additions & 6 deletions src/librustc_query_system/query/caches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ pub trait QueryCache: QueryStorage {
OnHit: FnOnce(&Self::Stored, DepNodeIndex) -> R,
OnMiss: FnOnce(Self::Key, QueryLookup<'_, CTX, Self::Key, Self::Sharded>) -> R;

fn complete<CTX: QueryContext>(
fn complete(
&self,
tcx: CTX,
lock_sharded_storage: &mut Self::Sharded,
key: Self::Key,
value: Self::Value,
Expand Down Expand Up @@ -112,9 +111,8 @@ impl<K: Eq + Hash, V: Clone> QueryCache for DefaultCache<K, V> {
}

#[inline]
fn complete<CTX: QueryContext>(
fn complete(
&self,
_: CTX,
lock_sharded_storage: &mut Self::Sharded,
key: K,
value: V,
Expand Down Expand Up @@ -195,9 +193,8 @@ impl<'tcx, K: Eq + Hash, V: 'tcx> QueryCache for ArenaCache<'tcx, K, V> {
}

#[inline]
fn complete<CTX: QueryContext>(
fn complete(
&self,
_: CTX,
lock_sharded_storage: &mut Self::Sharded,
key: K,
value: V,
Expand Down
10 changes: 5 additions & 5 deletions src/librustc_query_system/query/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ where
/// Completes the query by updating the query cache with the `result`,
/// signals the waiter and forgets the JobOwner, so it won't poison the query
#[inline(always)]
fn complete(self, tcx: CTX, result: C::Value, dep_node_index: DepNodeIndex) -> C::Stored {
fn complete(self, result: C::Value, dep_node_index: DepNodeIndex) -> C::Stored {
// We can move out of `self` here because we `mem::forget` it below
let key = unsafe { ptr::read(&self.key) };
let state = self.state;
Expand All @@ -278,7 +278,7 @@ where
QueryResult::Started(job) => job,
QueryResult::Poisoned => panic!(),
};
let result = state.cache.complete(tcx, &mut lock.cache, key, result, dep_node_index);
let result = state.cache.complete(&mut lock.cache, key, result, dep_node_index);
(job, result)
};

Expand Down Expand Up @@ -432,7 +432,7 @@ where
tcx.store_diagnostics_for_anon_node(dep_node_index, diagnostics);
}

return job.complete(tcx, result, dep_node_index);
return job.complete(result, dep_node_index);
}

let dep_node = query.to_dep_node(tcx, &key);
Expand All @@ -458,7 +458,7 @@ where
})
});
if let Some((result, dep_node_index)) = loaded {
return job.complete(tcx, result, dep_node_index);
return job.complete(result, dep_node_index);
}
}

Expand Down Expand Up @@ -609,7 +609,7 @@ where
}
}

let result = job.complete(tcx, result, dep_node_index);
let result = job.complete(result, dep_node_index);

(result, dep_node_index)
}
Expand Down

0 comments on commit 84f7991

Please sign in to comment.