Skip to content

Commit 9886236

Browse files
committed
Remove has_errors_or_span_delayed_bugs.
There are four closely related methods tracking the existence of certain kinds of methods: - `has_errors`: errors - `has_errors_or_lint_errors`: errors + lint errors - `has_errors_or_span_delayed_bugs`: errors + span_delayed_bugs - `is_compilation_going_to_fail`: errors + lint errors + span_delayed_bugs The third one is pretty weird. There's no obvious reason why you'd want that particular combination, and all the code relating to error count is very messy in general. So this commit just removes it. Most uses are replaced with `is_compilation_going_to_fail`, but one is replaced with `has_errors_or_lint_errors`. These seemed most appropriate to me, though it's hard to say for sure due to the aforementioned messiness.
1 parent 0f9cd03 commit 9886236

File tree

5 files changed

+5
-15
lines changed

5 files changed

+5
-15
lines changed

compiler/rustc_errors/src/lib.rs

-10
Original file line numberDiff line numberDiff line change
@@ -955,16 +955,6 @@ impl DiagCtxt {
955955
})
956956
}
957957

958-
pub fn has_errors_or_span_delayed_bugs(&self) -> Option<ErrorGuaranteed> {
959-
let inner = self.inner.borrow();
960-
let has_errors_or_span_delayed_bugs =
961-
inner.has_errors() || !inner.span_delayed_bugs.is_empty();
962-
has_errors_or_span_delayed_bugs.then(|| {
963-
#[allow(deprecated)]
964-
ErrorGuaranteed::unchecked_claim_error_was_emitted()
965-
})
966-
}
967-
968958
pub fn is_compilation_going_to_fail(&self) -> Option<ErrorGuaranteed> {
969959
let inner = self.inner.borrow();
970960
let will_fail =

compiler/rustc_incremental/src/persist/fs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ pub fn finalize_session_directory(sess: &Session, svh: Option<Svh>) {
312312

313313
let incr_comp_session_dir: PathBuf = sess.incr_comp_session_dir().clone();
314314

315-
if let Some(_) = sess.dcx().has_errors_or_span_delayed_bugs() {
315+
if let Some(_) = sess.dcx().is_compilation_going_to_fail() {
316316
// If there have been any errors during compilation, we don't want to
317317
// publish this session directory. Rather, we'll just delete it.
318318

compiler/rustc_incremental/src/persist/save.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub fn save_dep_graph(tcx: TyCtxt<'_>) {
3232
return;
3333
}
3434
// This is going to be deleted in finalize_session_directory, so let's not create it
35-
if let Some(_) = sess.dcx().has_errors_or_span_delayed_bugs() {
35+
if let Some(_) = sess.dcx().is_compilation_going_to_fail() {
3636
return;
3737
}
3838

@@ -87,7 +87,7 @@ pub fn save_work_product_index(
8787
return;
8888
}
8989
// This is going to be deleted in finalize_session_directory, so let's not create it
90-
if let Some(_) = sess.dcx().has_errors_or_span_delayed_bugs() {
90+
if let Some(_) = sess.dcx().is_compilation_going_to_fail() {
9191
return;
9292
}
9393

compiler/rustc_infer/src/infer/error_reporting/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ pub struct TypeErrCtxt<'a, 'tcx> {
133133

134134
impl Drop for TypeErrCtxt<'_, '_> {
135135
fn drop(&mut self) {
136-
if let Some(_) = self.dcx().has_errors_or_span_delayed_bugs() {
136+
if let Some(_) = self.dcx().has_errors_or_lint_errors() {
137137
// ok, emitted an error.
138138
} else {
139139
self.infcx

compiler/rustc_query_system/src/dep_graph/graph.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ impl<D: Deps> DepGraphData<D> {
818818
None => {}
819819
}
820820

821-
if let None = qcx.dep_context().sess().dcx().has_errors_or_span_delayed_bugs() {
821+
if let None = qcx.dep_context().sess().dcx().is_compilation_going_to_fail() {
822822
panic!("try_mark_previous_green() - Forcing the DepNode should have set its color")
823823
}
824824

0 commit comments

Comments
 (0)