Rename HandlerInner::delayed_span_bugs as HandlerInner::span_delayed_bugs.

For reasons similar to the previous commit.
This commit is contained in:
Nicholas Nethercote 2023-11-30 15:57:21 +11:00
parent 5d1d384443
commit 2c337a072c
6 changed files with 21 additions and 21 deletions

View File

@ -431,7 +431,7 @@ struct HandlerInner {
warn_count: usize,
deduplicated_err_count: usize,
emitter: Box<DynEmitter>,
delayed_span_bugs: Vec<DelayedDiagnostic>,
span_delayed_bugs: Vec<DelayedDiagnostic>,
delayed_good_path_bugs: Vec<DelayedDiagnostic>,
/// This flag indicates that an expected diagnostic was emitted and suppressed.
/// This is used for the `delayed_good_path_bugs` check.
@ -545,12 +545,12 @@ fn drop(&mut self) {
self.emit_stashed_diagnostics();
if !self.has_errors() {
let bugs = std::mem::replace(&mut self.delayed_span_bugs, Vec::new());
let bugs = std::mem::replace(&mut self.span_delayed_bugs, Vec::new());
self.flush_delayed(bugs, "no errors encountered even though `span_delayed_bug` issued");
}
// FIXME(eddyb) this explains what `delayed_good_path_bugs` are!
// They're `delayed_span_bugs` but for "require some diagnostic happened"
// They're `span_delayed_bugs` but for "require some diagnostic happened"
// instead of "require some error happened". Sadly that isn't ideal, as
// lints can be `#[allow]`'d, potentially leading to this triggering.
// Also, "good path" should be replaced with a better naming.
@ -609,7 +609,7 @@ pub fn with_emitter(emitter: Box<DynEmitter>) -> Self {
deduplicated_err_count: 0,
deduplicated_warn_count: 0,
emitter,
delayed_span_bugs: Vec::new(),
span_delayed_bugs: Vec::new(),
delayed_good_path_bugs: Vec::new(),
suppressed_expected_diag: false,
taught_diagnostics: Default::default(),
@ -664,7 +664,7 @@ pub fn reset_err_count(&self) {
inner.deduplicated_warn_count = 0;
// actually free the underlying memory (which `clear` would not do)
inner.delayed_span_bugs = Default::default();
inner.span_delayed_bugs = Default::default();
inner.delayed_good_path_bugs = Default::default();
inner.taught_diagnostics = Default::default();
inner.emitted_diagnostic_codes = Default::default();
@ -1078,8 +1078,8 @@ pub fn has_errors_or_lint_errors(&self) -> Option<ErrorGuaranteed> {
ErrorGuaranteed::unchecked_claim_error_was_emitted()
})
}
pub fn has_errors_or_delayed_span_bugs(&self) -> Option<ErrorGuaranteed> {
self.inner.borrow().has_errors_or_delayed_span_bugs().then(|| {
pub fn has_errors_or_span_delayed_bugs(&self) -> Option<ErrorGuaranteed> {
self.inner.borrow().has_errors_or_span_delayed_bugs().then(|| {
#[allow(deprecated)]
ErrorGuaranteed::unchecked_claim_error_was_emitted()
})
@ -1267,7 +1267,7 @@ pub fn steal_fulfilled_expectation_ids(&self) -> FxHashSet<LintExpectationId> {
pub fn flush_delayed(&self) {
let mut inner = self.inner.lock();
let bugs = std::mem::replace(&mut inner.delayed_span_bugs, Vec::new());
let bugs = std::mem::replace(&mut inner.span_delayed_bugs, Vec::new());
inner.flush_delayed(bugs, "no errors encountered even though `span_delayed_bug` issued");
}
}
@ -1325,11 +1325,11 @@ fn emit_diagnostic(&mut self, diagnostic: &mut Diagnostic) -> Option<ErrorGuaran
if diagnostic.level == Level::DelayedBug {
// FIXME(eddyb) this should check for `has_errors` and stop pushing
// once *any* errors were emitted (and truncate `delayed_span_bugs`
// once *any* errors were emitted (and truncate `span_delayed_bugs`
// when an error is first emitted, also), but maybe there's a case
// in which that's not sound? otherwise this is really inefficient.
let backtrace = std::backtrace::Backtrace::capture();
self.delayed_span_bugs
self.span_delayed_bugs
.push(DelayedDiagnostic::with_backtrace(diagnostic.clone(), backtrace));
if !self.flags.report_delayed_bugs {
@ -1444,7 +1444,7 @@ fn treat_err_as_bug(&self) -> bool {
}
fn delayed_bug_count(&self) -> usize {
self.delayed_span_bugs.len() + self.delayed_good_path_bugs.len()
self.span_delayed_bugs.len() + self.delayed_good_path_bugs.len()
}
fn print_error_count(&mut self, registry: &Registry) {
@ -1565,15 +1565,15 @@ fn has_errors(&self) -> bool {
fn has_errors_or_lint_errors(&self) -> bool {
self.has_errors() || self.lint_err_count > 0
}
fn has_errors_or_delayed_span_bugs(&self) -> bool {
self.has_errors() || !self.delayed_span_bugs.is_empty()
fn has_errors_or_span_delayed_bugs(&self) -> bool {
self.has_errors() || !self.span_delayed_bugs.is_empty()
}
fn has_any_message(&self) -> bool {
self.err_count() > 0 || self.lint_err_count > 0 || self.warn_count > 0
}
fn is_compilation_going_to_fail(&self) -> bool {
self.has_errors() || self.lint_err_count > 0 || !self.delayed_span_bugs.is_empty()
self.has_errors() || self.lint_err_count > 0 || !self.span_delayed_bugs.is_empty()
}
fn abort_if_errors(&mut self) {

View File

@ -312,7 +312,7 @@ pub fn finalize_session_directory(sess: &Session, svh: Option<Svh>) {
let incr_comp_session_dir: PathBuf = sess.incr_comp_session_dir().clone();
if let Some(_) = sess.has_errors_or_delayed_span_bugs() {
if let Some(_) = sess.has_errors_or_span_delayed_bugs() {
// If there have been any errors during compilation, we don't want to
// publish this session directory. Rather, we'll just delete it.

View File

@ -32,7 +32,7 @@ pub fn save_dep_graph(tcx: TyCtxt<'_>) {
return;
}
// This is going to be deleted in finalize_session_directory, so let's not create it
if let Some(_) = sess.has_errors_or_delayed_span_bugs() {
if let Some(_) = sess.has_errors_or_span_delayed_bugs() {
return;
}
@ -87,7 +87,7 @@ pub fn save_work_product_index(
return;
}
// This is going to be deleted in finalize_session_directory, so let's not create it
if let Some(_) = sess.has_errors_or_delayed_span_bugs() {
if let Some(_) = sess.has_errors_or_span_delayed_bugs() {
return;
}

View File

@ -131,7 +131,7 @@ pub struct TypeErrCtxt<'a, 'tcx> {
impl Drop for TypeErrCtxt<'_, '_> {
fn drop(&mut self) {
if let Some(_) = self.infcx.tcx.sess.has_errors_or_delayed_span_bugs() {
if let Some(_) = self.infcx.tcx.sess.has_errors_or_span_delayed_bugs() {
// ok, emitted an error.
} else {
self.infcx

View File

@ -818,7 +818,7 @@ fn try_mark_parent_green<Qcx: QueryContext<Deps = D>>(
None => {}
}
if let None = qcx.dep_context().sess().has_errors_or_delayed_span_bugs() {
if let None = qcx.dep_context().sess().has_errors_or_span_delayed_bugs() {
panic!("try_mark_previous_green() - Forcing the DepNode should have set its color")
}

View File

@ -551,8 +551,8 @@ pub fn err_count(&self) -> usize {
pub fn has_errors(&self) -> Option<ErrorGuaranteed> {
self.diagnostic().has_errors()
}
pub fn has_errors_or_delayed_span_bugs(&self) -> Option<ErrorGuaranteed> {
self.diagnostic().has_errors_or_delayed_span_bugs()
pub fn has_errors_or_span_delayed_bugs(&self) -> Option<ErrorGuaranteed> {
self.diagnostic().has_errors_or_span_delayed_bugs()
}
pub fn is_compilation_going_to_fail(&self) -> Option<ErrorGuaranteed> {
self.diagnostic().is_compilation_going_to_fail()