1
Fork 0

Remove assert_ignored and with_ignore_deps.

This commit is contained in:
Camille GILLOT 2020-03-21 00:27:09 +01:00
parent 2326ae39b2
commit 3a8bb20230
3 changed files with 4 additions and 28 deletions

View file

@ -62,24 +62,6 @@ impl rustc_query_system::dep_graph::DepKind for DepKind {
write!(f, ")")
}
fn assert_ignored() {
ty::tls::with_context_opt(|icx| {
let icx = if let Some(icx) = icx { icx } else { return };
assert!(icx.task_deps.is_none(), "expected no task dependency tracking");
})
}
fn with_ignore_deps<OP, R>(op: OP) -> R
where
OP: FnOnce() -> R,
{
ty::tls::with_context(|icx| {
let icx = ty::tls::ImplicitCtxt { task_deps: None, ..icx.clone() };
ty::tls::enter_context(&icx, |_| op())
})
}
fn with_deps<OP, R>(task_deps: Option<&Lock<TaskDeps>>, op: OP) -> R
where
OP: FnOnce() -> R,

View file

@ -151,7 +151,9 @@ impl<K: DepKind> DepGraph<K> {
pub fn assert_ignored(&self) {
if let Some(..) = self.data {
K::assert_ignored();
K::read_deps(|task_deps| {
assert!(task_deps.is_none(), "expected no task dependency tracking");
})
}
}
@ -159,7 +161,7 @@ impl<K: DepKind> DepGraph<K> {
where
OP: FnOnce() -> R,
{
K::with_ignore_deps(op)
K::with_deps(None, op)
}
/// Starts a new dep-graph task. Dep-graph tasks are specified

View file

@ -76,14 +76,6 @@ pub trait DepKind: Copy + fmt::Debug + Eq + Ord + Hash {
/// Implementation of `std::fmt::Debug` for `DepNode`.
fn debug_node(node: &DepNode<Self>, f: &mut fmt::Formatter<'_>) -> fmt::Result;
/// Assert the current implicit context does not track any dependency.
fn assert_ignored();
/// Execute the operation ignoring the dependencies.
fn with_ignore_deps<OP, R>(op: OP) -> R
where
OP: FnOnce() -> R;
/// Execute the operation with provided dependencies.
fn with_deps<OP, R>(deps: Option<&Lock<TaskDeps<Self>>>, op: OP) -> R
where