1
Fork 0

Rename HandlerInner::delay_span_bug as HandlerInner::span_delayed_bug.

Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug`
follows the pattern used everywhere else: `span_err`, `span_warning`,
etc.
This commit is contained in:
Nicholas Nethercote 2023-11-30 15:01:11 +11:00
parent 57d6f840b9
commit 5d1d384443
131 changed files with 309 additions and 278 deletions

View file

@ -1813,7 +1813,7 @@ options! {
"directory into which to write optimization remarks (if not specified, they will be \
written to standard error output)"),
report_delayed_bugs: bool = (false, parse_bool, [TRACKED],
"immediately print bugs registered with `delay_span_bug` (default: no)"),
"immediately print bugs registered with `span_delayed_bug` (default: no)"),
sanitizer: SanitizerSet = (SanitizerSet::empty(), parse_sanitizers, [TRACKED],
"use a sanitizer"),
sanitizer_cfi_canonical_jump_tables: Option<bool> = (Some(true), parse_opt_bool, [TRACKED],

View file

@ -578,7 +578,7 @@ impl Session {
if self.err_count() == old_count {
Ok(result)
} else {
Err(self.delay_span_bug(
Err(self.span_delayed_bug(
rustc_span::DUMMY_SP,
"`self.err_count()` changed but an error was not emitted",
))
@ -619,18 +619,22 @@ impl Session {
///
/// This can be used in code paths that should never run on successful compilations.
/// For example, it can be used to create an [`ErrorGuaranteed`]
/// (but you should prefer threading through the [`ErrorGuaranteed`] from an error emission directly).
/// (but you should prefer threading through the [`ErrorGuaranteed`] from an error emission
/// directly).
///
/// If no span is available, use [`DUMMY_SP`].
///
/// [`DUMMY_SP`]: rustc_span::DUMMY_SP
///
/// Note: this function used to be called `delay_span_bug`. It was renamed
/// to match similar functions like `span_err`, `span_warn`, etc.
#[track_caller]
pub fn delay_span_bug<S: Into<MultiSpan>>(
pub fn span_delayed_bug<S: Into<MultiSpan>>(
&self,
sp: S,
msg: impl Into<String>,
) -> ErrorGuaranteed {
self.diagnostic().delay_span_bug(sp, msg)
self.diagnostic().span_delayed_bug(sp, msg)
}
/// Used for code paths of expensive computations that should only take place when