Auto merge of #45915 - michaelwoerister:removed-nodes-in-try-mark-green, r=alexcrichton

incr.comp.: Don't crash in DepGraph::try_mark_green() when encountering a removed input node.

Fixes a small regression that was introduced in #45867.

r? @nikomatsakis
This commit is contained in:
bors 2017-11-14 05:30:34 +00:00
commit b5a3ab2e81
4 changed files with 60 additions and 5 deletions

View file

@ -524,14 +524,22 @@ impl DepGraph {
current_deps.push(node_index);
continue;
}
} else if cfg!(debug_assertions) {
} else {
match dep_dep_node.kind {
DepKind::Hir |
DepKind::HirBody |
DepKind::CrateMetadata => {
assert!(dep_dep_node.extract_def_id(tcx).is_none(),
"Input {:?} should have been pre-allocated but wasn't.",
dep_dep_node);
if dep_node.extract_def_id(tcx).is_none() {
// If the node does not exist anymore, we
// just fail to mark green.
return None
} else {
// If the node does exist, it should have
// been pre-allocated.
bug!("DepNode {:?} should have been \
pre-allocated but wasn't.",
dep_dep_node)
}
}
_ => {
// For other kinds of inputs it's OK to be

View file

@ -723,7 +723,7 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>,
// This one should never occur in this context
DepKind::Null => {
bug!("force_from_dep_node() - Encountered {:?}", dep_node.kind)
bug!("force_from_dep_node() - Encountered {:?}", dep_node)
}
// These are not queries