Skip to content

Commit 6f0e880

Browse files
committed
Rename Handler::delay_good_path_bug as Handler::good_path_delayed_bug.
In line with the previous commits.
1 parent 20107b6 commit 6f0e880

File tree

6 files changed

+28
-25
lines changed

6 files changed

+28
-25
lines changed

compiler/rustc_const_eval/src/interpret/eval_context.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,9 @@ impl<'tcx> fmt::Display for FrameInfo<'tcx> {
284284
{
285285
write!(f, "inside closure")
286286
} else {
287-
// Note: this triggers a `good_path_bug` state, which means that if we ever get here
288-
// we must emit a diagnostic. We should never display a `FrameInfo` unless we
289-
// actually want to emit a warning or error to the user.
287+
// Note: this triggers a `good_path_delayed_bug` state, which means that if we ever
288+
// get here we must emit a diagnostic. We should never display a `FrameInfo` unless
289+
// we actually want to emit a warning or error to the user.
290290
write!(f, "inside `{}`", self.instance)
291291
}
292292
})
@@ -300,8 +300,8 @@ impl<'tcx> FrameInfo<'tcx> {
300300
errors::FrameNote { where_: "closure", span, instance: String::new(), times: 0 }
301301
} else {
302302
let instance = format!("{}", self.instance);
303-
// Note: this triggers a `good_path_bug` state, which means that if we ever get here
304-
// we must emit a diagnostic. We should never display a `FrameInfo` unless we
303+
// Note: this triggers a `good_path_delayed_bug` state, which means that if we ever get
304+
// here we must emit a diagnostic. We should never display a `FrameInfo` unless we
305305
// actually want to emit a warning or error to the user.
306306
errors::FrameNote { where_: "instance", span, instance, times: 0 }
307307
}

compiler/rustc_errors/src/lib.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,9 @@ struct HandlerInner {
432432
deduplicated_err_count: usize,
433433
emitter: Box<DynEmitter>,
434434
span_delayed_bugs: Vec<DelayedDiagnostic>,
435-
delayed_good_path_bugs: Vec<DelayedDiagnostic>,
435+
good_path_delayed_bugs: Vec<DelayedDiagnostic>,
436436
/// This flag indicates that an expected diagnostic was emitted and suppressed.
437-
/// This is used for the `delayed_good_path_bugs` check.
437+
/// This is used for the `good_path_delayed_bugs` check.
438438
suppressed_expected_diag: bool,
439439

440440
/// This set contains the `DiagnosticId` of all emitted diagnostics to avoid
@@ -549,16 +549,16 @@ impl Drop for HandlerInner {
549549
self.flush_delayed(bugs, "no errors encountered even though `span_delayed_bug` issued");
550550
}
551551

552-
// FIXME(eddyb) this explains what `delayed_good_path_bugs` are!
552+
// FIXME(eddyb) this explains what `good_path_delayed_bugs` are!
553553
// They're `span_delayed_bugs` but for "require some diagnostic happened"
554554
// instead of "require some error happened". Sadly that isn't ideal, as
555555
// lints can be `#[allow]`'d, potentially leading to this triggering.
556556
// Also, "good path" should be replaced with a better naming.
557557
if !self.has_any_message() && !self.suppressed_expected_diag && !std::thread::panicking() {
558-
let bugs = std::mem::replace(&mut self.delayed_good_path_bugs, Vec::new());
558+
let bugs = std::mem::replace(&mut self.good_path_delayed_bugs, Vec::new());
559559
self.flush_delayed(
560560
bugs,
561-
"no warnings or errors encountered even though `delayed_good_path_bugs` issued",
561+
"no warnings or errors encountered even though `good_path_delayed_bugs` issued",
562562
);
563563
}
564564

@@ -610,7 +610,7 @@ impl Handler {
610610
deduplicated_warn_count: 0,
611611
emitter,
612612
span_delayed_bugs: Vec::new(),
613-
delayed_good_path_bugs: Vec::new(),
613+
good_path_delayed_bugs: Vec::new(),
614614
suppressed_expected_diag: false,
615615
taught_diagnostics: Default::default(),
616616
emitted_diagnostic_codes: Default::default(),
@@ -665,7 +665,7 @@ impl Handler {
665665

666666
// actually free the underlying memory (which `clear` would not do)
667667
inner.span_delayed_bugs = Default::default();
668-
inner.delayed_good_path_bugs = Default::default();
668+
inner.good_path_delayed_bugs = Default::default();
669669
inner.taught_diagnostics = Default::default();
670670
inner.emitted_diagnostic_codes = Default::default();
671671
inner.emitted_diagnostics = Default::default();
@@ -1008,8 +1008,8 @@ impl Handler {
10081008

10091009
// FIXME(eddyb) note the comment inside `impl Drop for HandlerInner`, that's
10101010
// where the explanation of what "good path" is (also, it should be renamed).
1011-
pub fn delay_good_path_bug(&self, msg: impl Into<DiagnosticMessage>) {
1012-
self.inner.borrow_mut().delay_good_path_bug(msg)
1011+
pub fn good_path_delayed_bug(&self, msg: impl Into<DiagnosticMessage>) {
1012+
self.inner.borrow_mut().good_path_delayed_bug(msg)
10131013
}
10141014

10151015
#[track_caller]
@@ -1444,7 +1444,7 @@ impl HandlerInner {
14441444
}
14451445

14461446
fn delayed_bug_count(&self) -> usize {
1447-
self.span_delayed_bugs.len() + self.delayed_good_path_bugs.len()
1447+
self.span_delayed_bugs.len() + self.good_path_delayed_bugs.len()
14481448
}
14491449

14501450
fn print_error_count(&mut self, registry: &Registry) {
@@ -1617,13 +1617,13 @@ impl HandlerInner {
16171617

16181618
// FIXME(eddyb) note the comment inside `impl Drop for HandlerInner`, that's
16191619
// where the explanation of what "good path" is (also, it should be renamed).
1620-
fn delay_good_path_bug(&mut self, msg: impl Into<DiagnosticMessage>) {
1620+
fn good_path_delayed_bug(&mut self, msg: impl Into<DiagnosticMessage>) {
16211621
let mut diagnostic = Diagnostic::new(Level::DelayedBug, msg);
16221622
if self.flags.report_delayed_bugs {
16231623
self.emit_diagnostic(&mut diagnostic);
16241624
}
16251625
let backtrace = std::backtrace::Backtrace::capture();
1626-
self.delayed_good_path_bugs.push(DelayedDiagnostic::with_backtrace(diagnostic, backtrace));
1626+
self.good_path_delayed_bugs.push(DelayedDiagnostic::with_backtrace(diagnostic, backtrace));
16271627
}
16281628

16291629
fn failure_note(&mut self, msg: impl Into<DiagnosticMessage>) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl Drop for TypeErrCtxt<'_, '_> {
137137
self.infcx
138138
.tcx
139139
.sess
140-
.delay_good_path_bug("used a `TypeErrCtxt` without raising an error or lint");
140+
.good_path_delayed_bug("used a `TypeErrCtxt` without raising an error or lint");
141141
}
142142
}
143143
}

compiler/rustc_middle/src/ty/print/pretty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3025,7 +3025,7 @@ pub fn trimmed_def_paths(tcx: TyCtxt<'_>, (): ()) -> FxHashMap<DefId, Symbol> {
30253025
//
30263026
// For good paths causing this bug, the `rustc_middle::ty::print::with_no_trimmed_paths`
30273027
// wrapper can be used to suppress this query, in exchange for full paths being formatted.
3028-
tcx.sess.delay_good_path_bug(
3028+
tcx.sess.good_path_delayed_bug(
30293029
"trimmed_def_paths constructed but no error emitted; use `DelayDm` for lints or `with_no_trimmed_paths` for debugging",
30303030
);
30313031
}

compiler/rustc_session/src/config.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -555,12 +555,15 @@ impl Default for ErrorOutputType {
555555
/// Parameter to control path trimming.
556556
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
557557
pub enum TrimmedDefPaths {
558-
/// `try_print_trimmed_def_path` never prints a trimmed path and never calls the expensive query
558+
/// `try_print_trimmed_def_path` never prints a trimmed path and never calls the expensive
559+
/// query.
559560
#[default]
560561
Never,
561-
/// `try_print_trimmed_def_path` calls the expensive query, the query doesn't call `delay_good_path_bug`
562+
/// `try_print_trimmed_def_path` calls the expensive query, the query doesn't call
563+
/// `good_path_delayed_bug`.
562564
Always,
563-
/// `try_print_trimmed_def_path` calls the expensive query, the query calls `delay_good_path_bug`
565+
/// `try_print_trimmed_def_path` calls the expensive query, the query calls
566+
/// `good_path_delayed_bug`.
564567
GoodPath,
565568
}
566569

compiler/rustc_session/src/session.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ impl Session {
639639
/// Used for code paths of expensive computations that should only take place when
640640
/// warnings or errors are emitted. If no messages are emitted ("good path"), then
641641
/// it's likely a bug.
642-
pub fn delay_good_path_bug(&self, msg: impl Into<DiagnosticMessage>) {
642+
pub fn good_path_delayed_bug(&self, msg: impl Into<DiagnosticMessage>) {
643643
if self.opts.unstable_opts.print_type_sizes
644644
|| self.opts.unstable_opts.query_dep_graph
645645
|| self.opts.unstable_opts.dump_mir.is_some()
@@ -650,7 +650,7 @@ impl Session {
650650
return;
651651
}
652652

653-
self.diagnostic().delay_good_path_bug(msg)
653+
self.diagnostic().good_path_delayed_bug(msg)
654654
}
655655

656656
#[rustc_lint_diagnostics]
@@ -887,7 +887,7 @@ impl Session {
887887
if fuel.remaining == 0 && !fuel.out_of_fuel {
888888
if self.diagnostic().can_emit_warnings() {
889889
// We only call `msg` in case we can actually emit warnings.
890-
// Otherwise, this could cause a `delay_good_path_bug` to
890+
// Otherwise, this could cause a `good_path_delayed_bug` to
891891
// trigger (issue #79546).
892892
self.emit_warning(errors::OptimisationFuelExhausted { msg: msg() });
893893
}

0 commit comments

Comments
 (0)