diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2019-12-07 00:09:52 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-07 00:09:52 +0900 |
| commit | 2a4f638d245569580d95d4bc25bea1d41c4d1c2f (patch) | |
| tree | 74845018d9b360a864894399636cdee0e98cd632 | |
| parent | d0126e8ed3cc0d6fcb9dd44c36a46f9ce65010a0 (diff) | |
| parent | de255a9163963e62a06c981b71041f071058ec5b (diff) | |
| download | rust-2a4f638d245569580d95d4bc25bea1d41c4d1c2f.tar.gz rust-2a4f638d245569580d95d4bc25bea1d41c4d1c2f.zip | |
Rollup merge of #66846 - gizmondo:master, r=michaelwoerister
Make try_mark_previous_green aware of cycles. Fixes #61323 r? @michaelwoerister
| -rw-r--r-- | src/librustc/dep_graph/graph.rs | 21 | ||||
| -rw-r--r-- | src/test/incremental/issue-61323.rs | 15 |
2 files changed, 31 insertions, 5 deletions
diff --git a/src/librustc/dep_graph/graph.rs b/src/librustc/dep_graph/graph.rs index 0104507f702..d952bf7ab9e 100644 --- a/src/librustc/dep_graph/graph.rs +++ b/src/librustc/dep_graph/graph.rs @@ -710,14 +710,25 @@ impl DepGraph { return None } None => { - if !tcx.sess.has_errors() { + if !tcx.sess.has_errors_or_delayed_span_bugs() { bug!("try_mark_previous_green() - Forcing the DepNode \ should have set its color") } else { - // If the query we just forced has resulted - // in some kind of compilation error, we - // don't expect that the corresponding - // dep-node color has been updated. + // If the query we just forced has resulted in + // some kind of compilation error, we cannot rely on + // the dep-node color having been properly updated. + // This means that the query system has reached an + // invalid state. We let the compiler continue (by + // returning `None`) so it can emit error messages + // and wind down, but rely on the fact that this + // invalid state will not be persisted to the + // incremental compilation cache because of + // compilation errors being present. + debug!("try_mark_previous_green({:?}) - END - \ + dependency {:?} resulted in compilation error", + dep_node, + dep_dep_node); + return None } } } diff --git a/src/test/incremental/issue-61323.rs b/src/test/incremental/issue-61323.rs new file mode 100644 index 00000000000..448ce367b8c --- /dev/null +++ b/src/test/incremental/issue-61323.rs @@ -0,0 +1,15 @@ +// revisions: rpass cfail + +enum A { + //[cfail]~^ ERROR 3:1: 3:7: recursive type `A` has infinite size [E0072] + B(C), +} + +#[cfg(rpass)] +struct C(Box<A>); + +#[cfg(cfail)] +struct C(A); +//[cfail]~^ ERROR 12:1: 12:13: recursive type `C` has infinite size [E0072] + +fn main() {} |
