Skip to content

Commit 2a4f638

Browse files
authored
Rollup merge of rust-lang#66846 - gizmondo:master, r=michaelwoerister
Make try_mark_previous_green aware of cycles. Fixes rust-lang#61323 r? @michaelwoerister
2 parents d0126e8 + de255a9 commit 2a4f638

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

src/librustc/dep_graph/graph.rs

+16-5
Original file line numberDiff line numberDiff line change
@@ -710,14 +710,25 @@ impl DepGraph {
710710
return None
711711
}
712712
None => {
713-
if !tcx.sess.has_errors() {
713+
if !tcx.sess.has_errors_or_delayed_span_bugs() {
714714
bug!("try_mark_previous_green() - Forcing the DepNode \
715715
should have set its color")
716716
} else {
717-
// If the query we just forced has resulted
718-
// in some kind of compilation error, we
719-
// don't expect that the corresponding
720-
// dep-node color has been updated.
717+
// If the query we just forced has resulted in
718+
// some kind of compilation error, we cannot rely on
719+
// the dep-node color having been properly updated.
720+
// This means that the query system has reached an
721+
// invalid state. We let the compiler continue (by
722+
// returning `None`) so it can emit error messages
723+
// and wind down, but rely on the fact that this
724+
// invalid state will not be persisted to the
725+
// incremental compilation cache because of
726+
// compilation errors being present.
727+
debug!("try_mark_previous_green({:?}) - END - \
728+
dependency {:?} resulted in compilation error",
729+
dep_node,
730+
dep_dep_node);
731+
return None
721732
}
722733
}
723734
}

src/test/incremental/issue-61323.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// revisions: rpass cfail
2+
3+
enum A {
4+
//[cfail]~^ ERROR 3:1: 3:7: recursive type `A` has infinite size [E0072]
5+
B(C),
6+
}
7+
8+
#[cfg(rpass)]
9+
struct C(Box<A>);
10+
11+
#[cfg(cfail)]
12+
struct C(A);
13+
//[cfail]~^ ERROR 12:1: 12:13: recursive type `C` has infinite size [E0072]
14+
15+
fn main() {}

0 commit comments

Comments
 (0)