about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@posteo>2017-11-08 11:30:14 +0100
committerMichael Woerister <michaelwoerister@posteo>2017-11-08 11:30:14 +0100
commit616b45542bc42cf7a3f3639a4832d84babd6a505 (patch)
treedffbb67d995c19a91c6a6b309de84a51bf59e6a8
parenta1364cd0db6a533dfe9c693827ef20fe6118af11 (diff)
downloadrust-616b45542bc42cf7a3f3639a4832d84babd6a505.tar.gz
rust-616b45542bc42cf7a3f3639a4832d84babd6a505.zip
incr.comp.: Make DefSpan an input dep-node so it is not affected by the existing Span/HIR hashing hack.
-rw-r--r--src/librustc/dep_graph/dep_node.rs8
-rw-r--r--src/librustc/dep_graph/graph.rs3
-rw-r--r--src/test/incremental/remove_source_file/main.rs15
-rw-r--r--src/test/incremental/spans_in_type_debuginfo.rs1
4 files changed, 19 insertions, 8 deletions
diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs
index 3ecaa1d66a7..d05445e44dd 100644
--- a/src/librustc/dep_graph/dep_node.rs
+++ b/src/librustc/dep_graph/dep_node.rs
@@ -568,7 +568,13 @@ define_dep_nodes!( <'tcx>
 
     [] ParamEnv(DefId),
     [] DescribeDef(DefId),
-    [] DefSpan(DefId),
+
+    // FIXME(mw): DefSpans are not really inputs since they are derived from
+    // HIR. But at the moment HIR hashing still contains some hacks that allow
+    // to make type debuginfo to be source location independent. Declaring
+    // DefSpan an input makes sure that changes to these are always detected
+    // regardless of HIR hashing.
+    [input] DefSpan(DefId),
     [] LookupStability(DefId),
     [] LookupDeprecationEntry(DefId),
     [] ItemBodyNestedBodies(DefId),
diff --git a/src/librustc/dep_graph/graph.rs b/src/librustc/dep_graph/graph.rs
index 465984479f8..a586424d196 100644
--- a/src/librustc/dep_graph/graph.rs
+++ b/src/librustc/dep_graph/graph.rs
@@ -789,6 +789,9 @@ impl CurrentDepGraph {
             // node.
             if cfg!(debug_assertions) {
                 if node.kind.is_input() && reads.len() > 0 &&
+                   // FIXME(mw): Special case for DefSpan until Spans are handled
+                   //            better in general.
+                   node.kind != DepKind::DefSpan &&
                     reads.iter().any(|&i| {
                         !(self.nodes[i].kind == DepKind::CrateMetadata ||
                           self.nodes[i].kind == DepKind::Krate)
diff --git a/src/test/incremental/remove_source_file/main.rs b/src/test/incremental/remove_source_file/main.rs
index 4ba33f3bb3d..3ae26c6aa45 100644
--- a/src/test/incremental/remove_source_file/main.rs
+++ b/src/test/incremental/remove_source_file/main.rs
@@ -11,21 +11,24 @@
 // This test case makes sure that the compiler doesn't crash due to a failing
 // table lookup when a source file is removed.
 
-// revisions:rpass1 rpass2
+// revisions:cfail1 cfail2
 
 // Note that we specify -g so that the FileMaps actually get referenced by the
 // incr. comp. cache:
 // compile-flags: -Z query-dep-graph -g
+// must-compile-successfully
 
-#[cfg(rpass1)]
+#![crate_type= "rlib"]
+
+#[cfg(cfail1)]
 mod auxiliary;
 
-#[cfg(rpass1)]
-fn main() {
+#[cfg(cfail1)]
+pub fn foo() {
     auxiliary::print_hello();
 }
 
-#[cfg(rpass2)]
-fn main() {
+#[cfg(cfail2)]
+pub fn foo() {
     println!("hello");
 }
diff --git a/src/test/incremental/spans_in_type_debuginfo.rs b/src/test/incremental/spans_in_type_debuginfo.rs
index 7d8e6c9d9d7..e1369d92c5c 100644
--- a/src/test/incremental/spans_in_type_debuginfo.rs
+++ b/src/test/incremental/spans_in_type_debuginfo.rs
@@ -14,7 +14,6 @@
 // revisions:rpass1 rpass2
 // compile-flags: -Z query-dep-graph -g
 
-#![rustc_partition_reused(module="spans_in_type_debuginfo", cfg="rpass2")]
 #![rustc_partition_reused(module="spans_in_type_debuginfo-structs", cfg="rpass2")]
 #![rustc_partition_reused(module="spans_in_type_debuginfo-enums", cfg="rpass2")]