Skip to content

Commit c9008c6

Browse files
committed
Rename Handler::delay_good_path_bug as Handler::good_path_delayed_bug.
In line with the previous commits.
1 parent 2c337a0 commit c9008c6

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) {
@@ -1620,13 +1620,13 @@ impl HandlerInner {
16201620

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

16321632
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
@@ -551,12 +551,15 @@ impl Default for ErrorOutputType {
551551
/// Parameter to control path trimming.
552552
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
553553
pub enum TrimmedDefPaths {
554-
/// `try_print_trimmed_def_path` never prints a trimmed path and never calls the expensive query
554+
/// `try_print_trimmed_def_path` never prints a trimmed path and never calls the expensive
555+
/// query.
555556
#[default]
556557
Never,
557-
/// `try_print_trimmed_def_path` calls the expensive query, the query doesn't call `delay_good_path_bug`
558+
/// `try_print_trimmed_def_path` calls the expensive query, the query doesn't call
559+
/// `good_path_delayed_bug`.
558560
Always,
559-
/// `try_print_trimmed_def_path` calls the expensive query, the query calls `delay_good_path_bug`
561+
/// `try_print_trimmed_def_path` calls the expensive query, the query calls
562+
/// `good_path_delayed_bug`.
560563
GoodPath,
561564
}
562565

compiler/rustc_session/src/session.rs

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

654-
self.diagnostic().delay_good_path_bug(msg)
654+
self.diagnostic().good_path_delayed_bug(msg)
655655
}
656656

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

0 commit comments

Comments
 (0)