diff options
| author | Tyler Mandry <tmandry@gmail.com> | 2019-11-01 11:20:09 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-01 11:20:09 -0700 |
| commit | 7297cd8d92f375f1765f74c5f2e60584df15d6d2 (patch) | |
| tree | 46db96f54c0589a7ea43e949785c99905a4223e6 | |
| parent | 9175247e72a3d7cba4bdb61bc490da9be0460d51 (diff) | |
| parent | 5930551f6a471164d61d0b67cd412b32461924e3 (diff) | |
| download | rust-7297cd8d92f375f1765f74c5f2e60584df15d6d2.tar.gz rust-7297cd8d92f375f1765f74c5f2e60584df15d6d2.zip | |
Rollup merge of #65470 - traxys:fix_65401, r=michaelwoerister
Don't hide ICEs from previous incremental compiles I think this fixes #65401, the compiler does not fail to ICE after the first compilation, tested on the last snippet of [this comment](https://github.com/rust-lang/rust/issues/63154#issuecomment-541592381). I am not very sure of the fix as I don't understand much of the structure of the compiler.
| -rw-r--r-- | src/librustc/session/mod.rs | 3 | ||||
| -rw-r--r-- | src/librustc_errors/lib.rs | 6 | ||||
| -rw-r--r-- | src/librustc_incremental/persist/fs.rs | 2 | ||||
| -rw-r--r-- | src/librustc_incremental/persist/save.rs | 8 |
4 files changed, 18 insertions, 1 deletions
diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index 8bf4765111d..81f0853201c 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -312,6 +312,9 @@ impl Session { pub fn has_errors(&self) -> bool { self.diagnostic().has_errors() } + pub fn has_errors_or_delayed_span_bugs(&self) -> bool { + self.diagnostic().has_errors_or_delayed_span_bugs() + } pub fn abort_if_errors(&self) { self.diagnostic().abort_if_errors(); } diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 63df052a225..9743cf0d805 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -704,6 +704,9 @@ impl Handler { pub fn has_errors(&self) -> bool { self.inner.borrow().has_errors() } + pub fn has_errors_or_delayed_span_bugs(&self) -> bool { + self.inner.borrow().has_errors_or_delayed_span_bugs() + } pub fn print_error_count(&self, registry: &Registry) { self.inner.borrow_mut().print_error_count(registry) @@ -862,6 +865,9 @@ impl HandlerInner { fn has_errors(&self) -> bool { self.err_count() > 0 } + fn has_errors_or_delayed_span_bugs(&self) -> bool { + self.has_errors() || !self.delayed_span_bugs.is_empty() + } fn abort_if_errors_and_should_abort(&mut self) { self.emit_stashed_diagnostics(); diff --git a/src/librustc_incremental/persist/fs.rs b/src/librustc_incremental/persist/fs.rs index 511175de5d8..cbebdeb602c 100644 --- a/src/librustc_incremental/persist/fs.rs +++ b/src/librustc_incremental/persist/fs.rs @@ -307,7 +307,7 @@ pub fn finalize_session_directory(sess: &Session, svh: Svh) { let incr_comp_session_dir: PathBuf = sess.incr_comp_session_dir().clone(); - if sess.has_errors() { + if sess.has_errors_or_delayed_span_bugs() { // If there have been any errors during compilation, we don't want to // publish this session directory. Rather, we'll just delete it. diff --git a/src/librustc_incremental/persist/save.rs b/src/librustc_incremental/persist/save.rs index f5935c9969b..ecc66e60175 100644 --- a/src/librustc_incremental/persist/save.rs +++ b/src/librustc_incremental/persist/save.rs @@ -22,6 +22,10 @@ pub fn save_dep_graph(tcx: TyCtxt<'_>) { if sess.opts.incremental.is_none() { return; } + // This is going to be deleted in finalize_session_directory, so let's not create it + if sess.has_errors_or_delayed_span_bugs() { + return; + } let query_cache_path = query_cache_path(sess); let dep_graph_path = dep_graph_path(sess); @@ -60,6 +64,10 @@ pub fn save_work_product_index(sess: &Session, if sess.opts.incremental.is_none() { return; } + // This is going to be deleted in finalize_session_directory, so let's not create it + if sess.has_errors_or_delayed_span_bugs() { + return; + } debug!("save_work_product_index()"); dep_graph.assert_ignored(); |
