about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc/dep_graph/dep_node.rs1
-rw-r--r--src/librustc/dep_graph/edges.rs10
-rw-r--r--src/librustc/ty/maps.rs6
3 files changed, 16 insertions, 1 deletions
diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs
index 8e2c44a427b..800689f4638 100644
--- a/src/librustc/dep_graph/dep_node.rs
+++ b/src/librustc/dep_graph/dep_node.rs
@@ -394,6 +394,7 @@ define_dep_nodes!( <'tcx>
     // Represents different phases in the compiler.
     [] RegionMaps(DefId),
     [] Coherence,
+    [] CoherenceInherentImplOverlapCheck,
     [] Resolve,
     [] CoherenceCheckTrait(DefId),
     [] PrivacyAccessLevels(CrateNum),
diff --git a/src/librustc/dep_graph/edges.rs b/src/librustc/dep_graph/edges.rs
index 277b69262c9..9aa634770df 100644
--- a/src/librustc/dep_graph/edges.rs
+++ b/src/librustc/dep_graph/edges.rs
@@ -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(),
diff --git a/src/librustc/ty/maps.rs b/src/librustc/ty/maps.rs
index 7a45a706ea4..d62d8f986c2 100644
--- a/src/librustc/ty/maps.rs
+++ b/src/librustc/ty/maps.rs
@@ -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
 }