1
Fork 0

incr.comp.: Assert that no DepNode is re-opened (see issue #42298).

This commit is contained in:
Michael Woerister 2017-08-01 16:34:20 +02:00
parent 6e8452ee4f
commit 6bb0693fde
3 changed files with 16 additions and 1 deletions

View file

@ -394,6 +394,7 @@ define_dep_nodes!( <'tcx>
// Represents different phases in the compiler.
[] RegionMaps(DefId),
[] Coherence,
[] CoherenceInherentImplOverlapCheck,
[] Resolve,
[] CoherenceCheckTrait(DefId),
[] PrivacyAccessLevels(CrateNum),

View file

@ -23,6 +23,11 @@ pub struct DepGraphEdges {
edges: FxHashSet<(DepNodeIndex, DepNodeIndex)>,
task_stack: Vec<OpenTask>,
forbidden_edge: Option<EdgeFilter>,
// A set to help assert that no two tasks use the same DepNode. This is a
// temporary measure. Once we load the previous dep-graph as readonly, this
// check will fall out of the graph implementation naturally.
opened_once: FxHashSet<DepNode>,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
@ -80,6 +85,7 @@ impl DepGraphEdges {
edges: FxHashSet(),
task_stack: Vec::new(),
forbidden_edge,
opened_once: FxHashSet(),
}
}
@ -97,6 +103,10 @@ impl DepGraphEdges {
}
pub fn push_task(&mut self, key: DepNode) {
if !self.opened_once.insert(key) {
bug!("Re-opened node {:?}", key)
}
self.task_stack.push(OpenTask::Regular {
node: key,
reads: Vec::new(),

View file

@ -931,7 +931,7 @@ define_maps! { <'tcx>
/// Checks all types in the krate for overlap in their inherent impls. Reports errors.
/// Not meant to be used directly outside of coherence.
/// (Defined only for LOCAL_CRATE)
[] crate_inherent_impls_overlap_check: crate_inherent_impls_dep_node(CrateNum) -> (),
[] crate_inherent_impls_overlap_check: inherent_impls_overlap_check_dep_node(CrateNum) -> (),
/// Results of evaluating const items or constants embedded in
/// other items (such as enum variant explicit discriminants).
@ -1014,6 +1014,10 @@ fn crate_inherent_impls_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
DepConstructor::Coherence
}
fn inherent_impls_overlap_check_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
DepConstructor::CoherenceInherentImplOverlapCheck
}
fn reachability_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
DepConstructor::Reachability
}