Skip to content

Commit

Permalink
Rollup merge of #65470 - traxys:fix_65401, r=michaelwoerister
Browse files Browse the repository at this point in the history
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](#63154 (comment)).
I am not very sure of the fix as I don't understand much of the structure of the compiler.
  • Loading branch information
tmandry authored Nov 1, 2019
2 parents 9175247 + 5930551 commit 7297cd8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/librustc/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
6 changes: 6 additions & 0 deletions src/librustc_errors/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_incremental/persist/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
8 changes: 8 additions & 0 deletions src/librustc_incremental/persist/save.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 7297cd8

Please sign in to comment.