Skip to content

Commit 616b455

Browse files
incr.comp.: Make DefSpan an input dep-node so it is not affected by the existing Span/HIR hashing hack.
1 parent a1364cd commit 616b455

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

src/librustc/dep_graph/dep_node.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,13 @@ define_dep_nodes!( <'tcx>
568568

569569
[] ParamEnv(DefId),
570570
[] DescribeDef(DefId),
571-
[] DefSpan(DefId),
571+
572+
// FIXME(mw): DefSpans are not really inputs since they are derived from
573+
// HIR. But at the moment HIR hashing still contains some hacks that allow
574+
// to make type debuginfo to be source location independent. Declaring
575+
// DefSpan an input makes sure that changes to these are always detected
576+
// regardless of HIR hashing.
577+
[input] DefSpan(DefId),
572578
[] LookupStability(DefId),
573579
[] LookupDeprecationEntry(DefId),
574580
[] ItemBodyNestedBodies(DefId),

src/librustc/dep_graph/graph.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,9 @@ impl CurrentDepGraph {
789789
// node.
790790
if cfg!(debug_assertions) {
791791
if node.kind.is_input() && reads.len() > 0 &&
792+
// FIXME(mw): Special case for DefSpan until Spans are handled
793+
// better in general.
794+
node.kind != DepKind::DefSpan &&
792795
reads.iter().any(|&i| {
793796
!(self.nodes[i].kind == DepKind::CrateMetadata ||
794797
self.nodes[i].kind == DepKind::Krate)

src/test/incremental/remove_source_file/main.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,24 @@
1111
// This test case makes sure that the compiler doesn't crash due to a failing
1212
// table lookup when a source file is removed.
1313

14-
// revisions:rpass1 rpass2
14+
// revisions:cfail1 cfail2
1515

1616
// Note that we specify -g so that the FileMaps actually get referenced by the
1717
// incr. comp. cache:
1818
// compile-flags: -Z query-dep-graph -g
19+
// must-compile-successfully
1920

20-
#[cfg(rpass1)]
21+
#![crate_type= "rlib"]
22+
23+
#[cfg(cfail1)]
2124
mod auxiliary;
2225

23-
#[cfg(rpass1)]
24-
fn main() {
26+
#[cfg(cfail1)]
27+
pub fn foo() {
2528
auxiliary::print_hello();
2629
}
2730

28-
#[cfg(rpass2)]
29-
fn main() {
31+
#[cfg(cfail2)]
32+
pub fn foo() {
3033
println!("hello");
3134
}

src/test/incremental/spans_in_type_debuginfo.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
// revisions:rpass1 rpass2
1515
// compile-flags: -Z query-dep-graph -g
1616

17-
#![rustc_partition_reused(module="spans_in_type_debuginfo", cfg="rpass2")]
1817
#![rustc_partition_reused(module="spans_in_type_debuginfo-structs", cfg="rpass2")]
1918
#![rustc_partition_reused(module="spans_in_type_debuginfo-enums", cfg="rpass2")]
2019

0 commit comments

Comments
 (0)