Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 5d1d384

Browse files
committed
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.
1 parent 57d6f84 commit 5d1d384

File tree

131 files changed

+309
-278
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+309
-278
lines changed

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
327327
),
328328
ExprKind::Yield(opt_expr) => self.lower_expr_yield(e.span, opt_expr.as_deref()),
329329
ExprKind::Err => hir::ExprKind::Err(
330-
self.tcx.sess.delay_span_bug(e.span, "lowered ExprKind::Err"),
330+
self.tcx.sess.span_delayed_bug(e.span, "lowered ExprKind::Err"),
331331
),
332332
ExprKind::Try(sub_expr) => self.lower_expr_try(e.span, sub_expr),
333333

@@ -799,7 +799,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
799799
self.expr_ident_mut(span, task_context_ident, task_context_hid)
800800
} else {
801801
// Use of `await` outside of an async context, we cannot use `task_context` here.
802-
self.expr_err(span, self.tcx.sess.delay_span_bug(span, "no task_context hir id"))
802+
self.expr_err(span, self.tcx.sess.span_delayed_bug(span, "no task_context hir id"))
803803
};
804804
let new_unchecked = self.expr_call_lang_item_fn_mut(
805805
span,

compiler/rustc_ast_lowering/src/format.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ fn make_count<'hir>(
267267
ctx.expr(
268268
sp,
269269
hir::ExprKind::Err(
270-
ctx.tcx.sess.delay_span_bug(sp, "lowered bad format_args count"),
270+
ctx.tcx.sess.span_delayed_bug(sp, "lowered bad format_args count"),
271271
),
272272
)
273273
}
@@ -306,7 +306,7 @@ fn make_format_spec<'hir>(
306306
}
307307
Err(_) => ctx.expr(
308308
sp,
309-
hir::ExprKind::Err(ctx.tcx.sess.delay_span_bug(sp, "lowered bad format_args count")),
309+
hir::ExprKind::Err(ctx.tcx.sess.span_delayed_bug(sp, "lowered bad format_args count")),
310310
),
311311
};
312312
let &FormatOptions {

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
256256
&ImplTraitContext::Disallowed(ImplTraitPosition::Generic),
257257
|this| match ty {
258258
None => {
259-
let guar = this.tcx.sess.delay_span_bug(
259+
let guar = this.tcx.sess.span_delayed_bug(
260260
span,
261261
"expected to lower type alias type, but it was missing",
262262
);
@@ -863,7 +863,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
863863
&ImplTraitContext::Disallowed(ImplTraitPosition::Generic),
864864
|this| match ty {
865865
None => {
866-
let guar = this.tcx.sess.delay_span_bug(
866+
let guar = this.tcx.sess.span_delayed_bug(
867867
i.span,
868868
"expected to lower associated type, but it was missing",
869869
);
@@ -996,7 +996,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
996996
fn lower_block_expr_opt(&mut self, span: Span, block: Option<&Block>) -> hir::Expr<'hir> {
997997
match block {
998998
Some(block) => self.lower_block_expr(block),
999-
None => self.expr_err(span, self.tcx.sess.delay_span_bug(span, "no block")),
999+
None => self.expr_err(span, self.tcx.sess.span_delayed_bug(span, "no block")),
10001000
}
10011001
}
10021002

@@ -1006,7 +1006,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
10061006
&[],
10071007
match expr {
10081008
Some(expr) => this.lower_expr_mut(expr),
1009-
None => this.expr_err(span, this.tcx.sess.delay_span_bug(span, "no block")),
1009+
None => this.expr_err(span, this.tcx.sess.span_delayed_bug(span, "no block")),
10101010
},
10111011
)
10121012
})

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,7 +1326,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
13261326
let kind = match &t.kind {
13271327
TyKind::Infer => hir::TyKind::Infer,
13281328
TyKind::Err => {
1329-
hir::TyKind::Err(self.tcx.sess.delay_span_bug(t.span, "TyKind::Err lowered"))
1329+
hir::TyKind::Err(self.tcx.sess.span_delayed_bug(t.span, "TyKind::Err lowered"))
13301330
}
13311331
// FIXME(unnamed_fields): IMPLEMENTATION IN PROGRESS
13321332
#[allow(rustc::untranslatable_diagnostic)]
@@ -1510,7 +1510,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
15101510
}
15111511
TyKind::MacCall(_) => panic!("`TyKind::MacCall` should have been expanded by now"),
15121512
TyKind::CVarArgs => {
1513-
let guar = self.tcx.sess.delay_span_bug(
1513+
let guar = self.tcx.sess.span_delayed_bug(
15141514
t.span,
15151515
"`TyKind::CVarArgs` should have been handled elsewhere",
15161516
);
@@ -1653,7 +1653,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
16531653
} else {
16541654
self.tcx
16551655
.sess
1656-
.delay_span_bug(lifetime.ident.span, "no def-id for fresh lifetime");
1656+
.span_delayed_bug(lifetime.ident.span, "no def-id for fresh lifetime");
16571657
continue;
16581658
}
16591659
}
@@ -2515,9 +2515,10 @@ impl<'hir> GenericArgsCtor<'hir> {
25152515
let hir_id = lcx.next_id();
25162516

25172517
let Some(host_param_id) = lcx.host_param_id else {
2518-
lcx.tcx
2519-
.sess
2520-
.delay_span_bug(span, "no host param id for call in const yet no errors reported");
2518+
lcx.tcx.sess.span_delayed_bug(
2519+
span,
2520+
"no host param id for call in const yet no errors reported",
2521+
);
25212522
return;
25222523
};
25232524

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl<'a> PostExpansionVisitor<'a> {
102102
}
103103
Err(abi::AbiDisabled::Unrecognized) => {
104104
if self.sess.opts.pretty.map_or(true, |ppm| ppm.needs_hir()) {
105-
self.sess.parse_sess.span_diagnostic.delay_span_bug(
105+
self.sess.parse_sess.span_diagnostic.span_delayed_bug(
106106
span,
107107
format!(
108108
"unrecognized ABI not caught in lowering: {}",

compiler/rustc_attr/src/builtin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,9 +1060,9 @@ pub fn parse_repr_attr(sess: &Session, attr: &Attribute) -> Vec<ReprAttr> {
10601060
// Not a word we recognize. This will be caught and reported by
10611061
// the `check_mod_attrs` pass, but this pass doesn't always run
10621062
// (e.g. if we only pretty-print the source), so we have to gate
1063-
// the `delay_span_bug` call as follows:
1063+
// the `span_delayed_bug` call as follows:
10641064
if sess.opts.pretty.map_or(true, |pp| pp.needs_analysis()) {
1065-
diagnostic.delay_span_bug(item.span(), "unrecognized representation hint");
1065+
diagnostic.span_delayed_bug(item.span(), "unrecognized representation hint");
10661066
}
10671067
}
10681068
}

compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ fn try_extract_error_from_fulfill_cx<'tcx>(
385385
error_region: Option<ty::Region<'tcx>>,
386386
) -> Option<DiagnosticBuilder<'tcx, ErrorGuaranteed>> {
387387
// We generally shouldn't have errors here because the query was
388-
// already run, but there's no point using `delay_span_bug`
388+
// already run, but there's no point using `span_delayed_bug`
389389
// when we're going to emit an error here anyway.
390390
let _errors = ocx.select_all_or_error();
391391
let region_constraints = ocx.infcx.with_region_constraints(|r| r.clone());

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl<'tcx> RegionErrors<'tcx> {
8484
#[track_caller]
8585
pub fn push(&mut self, val: impl Into<RegionErrorKind<'tcx>>) {
8686
let val = val.into();
87-
self.1.sess.delay_span_bug(DUMMY_SP, format!("{val:?}"));
87+
self.1.sess.span_delayed_bug(DUMMY_SP, format!("{val:?}"));
8888
self.0.push(val);
8989
}
9090
pub fn is_empty(&self) -> bool {

compiler/rustc_borrowck/src/diagnostics/region_name.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,8 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
619619
_,
620620
) => {
621621
// HIR lowering sometimes doesn't catch this in erroneous
622-
// programs, so we need to use delay_span_bug here. See #82126.
623-
self.infcx.tcx.sess.delay_span_bug(
622+
// programs, so we need to use span_delayed_bug here. See #82126.
623+
self.infcx.tcx.sess.span_delayed_bug(
624624
hir_arg.span(),
625625
format!("unmatched arg and hir arg: found {kind:?} vs {hir_arg:?}"),
626626
);

compiler/rustc_borrowck/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,11 +2134,11 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
21342134
&& !self.has_buffered_errors()
21352135
{
21362136
// rust-lang/rust#46908: In pure NLL mode this code path should be
2137-
// unreachable, but we use `delay_span_bug` because we can hit this when
2137+
// unreachable, but we use `span_delayed_bug` because we can hit this when
21382138
// dereferencing a non-Copy raw pointer *and* have `-Ztreat-err-as-bug`
21392139
// enabled. We don't want to ICE for that case, as other errors will have
21402140
// been emitted (#52262).
2141-
self.infcx.tcx.sess.delay_span_bug(
2141+
self.infcx.tcx.sess.span_delayed_bug(
21422142
span,
21432143
format!(
21442144
"Accessing `{place:?}` with the kind `{kind:?}` shouldn't be possible",
@@ -2432,7 +2432,7 @@ mod error {
24322432

24332433
pub fn buffer_error(&mut self, t: DiagnosticBuilder<'_, ErrorGuaranteed>) {
24342434
if let None = self.tainted_by_errors {
2435-
self.tainted_by_errors = Some(self.tcx.sess.delay_span_bug(
2435+
self.tainted_by_errors = Some(self.tcx.sess.span_delayed_bug(
24362436
t.span.clone_ignoring_labels(),
24372437
"diagnostic buffered but not emitted",
24382438
))

0 commit comments

Comments
 (0)