Skip to content

Commit 5930551

Browse files
committed
Check if there are any delayed_span_bugs and abort incremental compilation in this case
1 parent e369d87 commit 5930551

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

src/librustc/session/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@ impl Session {
310310
pub fn has_errors(&self) -> bool {
311311
self.diagnostic().has_errors()
312312
}
313+
pub fn has_errors_or_delayed_span_bugs(&self) -> bool {
314+
self.diagnostic().has_errors_or_delayed_span_bugs()
315+
}
313316
pub fn abort_if_errors(&self) {
314317
self.diagnostic().abort_if_errors();
315318
}

src/librustc_errors/lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,9 @@ impl Handler {
704704
pub fn has_errors(&self) -> bool {
705705
self.inner.borrow().has_errors()
706706
}
707+
pub fn has_errors_or_delayed_span_bugs(&self) -> bool {
708+
self.inner.borrow().has_errors_or_delayed_span_bugs()
709+
}
707710

708711
pub fn print_error_count(&self, registry: &Registry) {
709712
self.inner.borrow_mut().print_error_count(registry)
@@ -862,6 +865,9 @@ impl HandlerInner {
862865
fn has_errors(&self) -> bool {
863866
self.err_count() > 0
864867
}
868+
fn has_errors_or_delayed_span_bugs(&self) -> bool {
869+
self.has_errors() || !self.delayed_span_bugs.is_empty()
870+
}
865871

866872
fn abort_if_errors_and_should_abort(&mut self) {
867873
self.emit_stashed_diagnostics();

src/librustc_incremental/persist/fs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ pub fn finalize_session_directory(sess: &Session, svh: Svh) {
307307

308308
let incr_comp_session_dir: PathBuf = sess.incr_comp_session_dir().clone();
309309

310-
if sess.has_errors() {
310+
if sess.has_errors_or_delayed_span_bugs() {
311311
// If there have been any errors during compilation, we don't want to
312312
// publish this session directory. Rather, we'll just delete it.
313313

src/librustc_incremental/persist/save.rs

+8
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ pub fn save_dep_graph(tcx: TyCtxt<'_>) {
2222
if sess.opts.incremental.is_none() {
2323
return;
2424
}
25+
// This is going to be deleted in finalize_session_directory, so let's not create it
26+
if sess.has_errors_or_delayed_span_bugs() {
27+
return;
28+
}
2529

2630
let query_cache_path = query_cache_path(sess);
2731
let dep_graph_path = dep_graph_path(sess);
@@ -60,6 +64,10 @@ pub fn save_work_product_index(sess: &Session,
6064
if sess.opts.incremental.is_none() {
6165
return;
6266
}
67+
// This is going to be deleted in finalize_session_directory, so let's not create it
68+
if sess.has_errors_or_delayed_span_bugs() {
69+
return;
70+
}
6371

6472
debug!("save_work_product_index()");
6573
dep_graph.assert_ignored();

0 commit comments

Comments
 (0)