1
Fork 0

Check if there are any delayed_span_bugs and abort incremental compilation in this case

This commit is contained in:
Quentin Boyer 2019-10-16 13:13:13 +02:00
parent e369d87b01
commit 5930551f6a
4 changed files with 18 additions and 1 deletions

View file

@ -310,6 +310,9 @@ impl Session {
pub fn has_errors(&self) -> bool { pub fn has_errors(&self) -> bool {
self.diagnostic().has_errors() 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) { pub fn abort_if_errors(&self) {
self.diagnostic().abort_if_errors(); self.diagnostic().abort_if_errors();
} }

View file

@ -704,6 +704,9 @@ impl Handler {
pub fn has_errors(&self) -> bool { pub fn has_errors(&self) -> bool {
self.inner.borrow().has_errors() 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) { pub fn print_error_count(&self, registry: &Registry) {
self.inner.borrow_mut().print_error_count(registry) self.inner.borrow_mut().print_error_count(registry)
@ -862,6 +865,9 @@ impl HandlerInner {
fn has_errors(&self) -> bool { fn has_errors(&self) -> bool {
self.err_count() > 0 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) { fn abort_if_errors_and_should_abort(&mut self) {
self.emit_stashed_diagnostics(); self.emit_stashed_diagnostics();

View file

@ -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(); 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 // If there have been any errors during compilation, we don't want to
// publish this session directory. Rather, we'll just delete it. // publish this session directory. Rather, we'll just delete it.

View file

@ -22,6 +22,10 @@ pub fn save_dep_graph(tcx: TyCtxt<'_>) {
if sess.opts.incremental.is_none() { if sess.opts.incremental.is_none() {
return; 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 query_cache_path = query_cache_path(sess);
let dep_graph_path = dep_graph_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() { if sess.opts.incremental.is_none() {
return; 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()"); debug!("save_work_product_index()");
dep_graph.assert_ignored(); dep_graph.assert_ignored();