Skip to content

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
))

compiler/rustc_borrowck/src/nll.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ pub(crate) fn compute_regions<'cx, 'tcx>(
314314

315315
if !nll_errors.is_empty() {
316316
// Suppress unhelpful extra errors in `infer_opaque_types`.
317-
infcx.set_tainted_by_errors(infcx.tcx.sess.delay_span_bug(
317+
infcx.set_tainted_by_errors(infcx.tcx.sess.span_delayed_bug(
318318
body.span,
319319
"`compute_regions` tainted `infcx` with errors but did not emit any errors",
320320
));

compiler/rustc_borrowck/src/type_check/input_output.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
7777
if argument_index + 1 >= body.local_decls.len() {
7878
self.tcx()
7979
.sess
80-
.delay_span_bug(body.span, "found more normalized_input_ty than local_decls");
80+
.span_delayed_bug(body.span, "found more normalized_input_ty than local_decls");
8181
break;
8282
}
8383

@@ -101,10 +101,10 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
101101
);
102102

103103
// We will not have a universal_regions.yield_ty if we yield (by accident)
104-
// outside of a coroutine and return an `impl Trait`, so emit a delay_span_bug
104+
// outside of a coroutine and return an `impl Trait`, so emit a span_delayed_bug
105105
// because we don't want to panic in an assert here if we've already got errors.
106106
if body.yield_ty().is_some() != universal_regions.yield_ty.is_some() {
107-
self.tcx().sess.delay_span_bug(
107+
self.tcx().sess.span_delayed_bug(
108108
body.span,
109109
format!(
110110
"Expected body to have yield_ty ({:?}) iff we have a UR yield_ty ({:?})",

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ pub(crate) fn type_check<'mir, 'tcx>(
232232
let mut hidden_type = infcx.resolve_vars_if_possible(decl.hidden_type);
233233
trace!("finalized opaque type {:?} to {:#?}", opaque_type_key, hidden_type.ty.kind());
234234
if hidden_type.has_non_region_infer() {
235-
let reported = infcx.tcx.sess.delay_span_bug(
235+
let reported = infcx.tcx.sess.span_delayed_bug(
236236
decl.hidden_type.span,
237237
format!("could not resolve {:#?}", hidden_type.ty.kind()),
238238
);
@@ -274,9 +274,9 @@ fn translate_outlives_facts(typeck: &mut TypeChecker<'_, '_>) {
274274
#[track_caller]
275275
fn mirbug(tcx: TyCtxt<'_>, span: Span, msg: String) {
276276
// We sometimes see MIR failures (notably predicate failures) due to
277-
// the fact that we check rvalue sized predicates here. So use `delay_span_bug`
277+
// the fact that we check rvalue sized predicates here. So use `span_delayed_bug`
278278
// to avoid reporting bugs in those cases.
279-
tcx.sess.diagnostic().delay_span_bug(span, msg);
279+
tcx.sess.diagnostic().span_delayed_bug(span, msg);
280280
}
281281

282282
enum FieldAccessError {
@@ -1082,7 +1082,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
10821082
);
10831083

10841084
if result.is_err() {
1085-
self.infcx.tcx.sess.delay_span_bug(
1085+
self.infcx.tcx.sess.span_delayed_bug(
10861086
self.body.span,
10871087
"failed re-defining predefined opaques in mir typeck",
10881088
);

compiler/rustc_codegen_ssa/src/codegen_attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
9191
Some(tcx.fn_sig(did))
9292
} else {
9393
tcx.sess
94-
.delay_span_bug(attr.span, "this attribute can only be applied to functions");
94+
.span_delayed_bug(attr.span, "this attribute can only be applied to functions");
9595
None
9696
}
9797
};

compiler/rustc_const_eval/src/const_eval/machine.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
391391
if ecx.tcx.is_ctfe_mir_available(def) {
392392
Ok(ecx.tcx.mir_for_ctfe(def))
393393
} else if ecx.tcx.def_kind(def) == DefKind::AssocConst {
394-
let guar = ecx.tcx.sess.delay_span_bug(
394+
let guar = ecx.tcx.sess.span_delayed_bug(
395395
rustc_span::DUMMY_SP,
396396
"This is likely a const item that is missing from its impl",
397397
);
@@ -622,7 +622,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
622622
let guard = ecx
623623
.tcx
624624
.sess
625-
.delay_span_bug(span, "The deny lint should have already errored");
625+
.span_delayed_bug(span, "The deny lint should have already errored");
626626
throw_inval!(AlreadyReported(guard.into()));
627627
}
628628
} else if new_steps > start && new_steps.is_power_of_two() {

compiler/rustc_const_eval/src/interpret/intern.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ fn intern_shallow<'rt, 'mir, 'tcx, M: CompileTimeMachine<'mir, 'tcx, const_eval:
9494
// If the pointer is dangling (neither in local nor global memory), we leave it
9595
// to validation to error -- it has the much better error messages, pointing out where
9696
// in the value the dangling reference lies.
97-
// The `delay_span_bug` ensures that we don't forget such a check in validation.
97+
// The `span_delayed_bug` ensures that we don't forget such a check in validation.
9898
if tcx.try_get_global_alloc(alloc_id).is_none() {
99-
tcx.sess.delay_span_bug(ecx.tcx.span, "tried to intern dangling pointer");
99+
tcx.sess.span_delayed_bug(ecx.tcx.span, "tried to intern dangling pointer");
100100
}
101101
// treat dangling pointers like other statics
102102
// just to stop trying to recurse into them
@@ -186,7 +186,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: CompileTimeMachine<'mir, 'tcx, const_eval::Memory
186186
// Validation will error (with a better message) on an invalid vtable pointer.
187187
// Let validation show the error message, but make sure it *does* error.
188188
tcx.sess
189-
.delay_span_bug(tcx.span, "vtables pointers cannot be integer pointers");
189+
.span_delayed_bug(tcx.span, "vtables pointers cannot be integer pointers");
190190
}
191191
}
192192
// Check if we have encountered this pointer+layout combination before.
@@ -375,7 +375,7 @@ pub fn intern_const_alloc_recursive<
375375
match res {
376376
Ok(()) => {}
377377
Err(error) => {
378-
ecx.tcx.sess.delay_span_bug(
378+
ecx.tcx.sess.span_delayed_bug(
379379
ecx.tcx.span,
380380
format!(
381381
"error during interning should later cause validation failure: {}",

compiler/rustc_const_eval/src/transform/check_consts/check.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
248248
// `async` functions cannot be `const fn`. This is checked during AST lowering, so there's
249249
// no need to emit duplicate errors here.
250250
if self.ccx.is_async() || body.coroutine.is_some() {
251-
tcx.sess.delay_span_bug(body.span, "`async` functions cannot be `const fn`");
251+
tcx.sess.span_delayed_bug(body.span, "`async` functions cannot be `const fn`");
252252
return;
253253
}
254254

@@ -357,7 +357,9 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
357357

358358
fn check_static(&mut self, def_id: DefId, span: Span) {
359359
if self.tcx.is_thread_local_static(def_id) {
360-
self.tcx.sess.delay_span_bug(span, "tls access is checked in `Rvalue::ThreadLocalRef`");
360+
self.tcx
361+
.sess
362+
.span_delayed_bug(span, "tls access is checked in `Rvalue::ThreadLocalRef`");
361363
}
362364
self.check_op_spanned(ops::StaticAccess, span)
363365
}

compiler/rustc_const_eval/src/transform/check_consts/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pub fn is_const_stable_const_fn(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
112112
None if is_parent_const_stable_trait(tcx, def_id) => {
113113
// Remove this when `#![feature(const_trait_impl)]` is stabilized,
114114
// returning `true` unconditionally.
115-
tcx.sess.delay_span_bug(
115+
tcx.sess.span_delayed_bug(
116116
tcx.def_span(def_id),
117117
"trait implementations cannot be const stable yet",
118118
);

compiler/rustc_const_eval/src/transform/validate.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ impl<'a, 'tcx> CfgChecker<'a, 'tcx> {
128128
#[track_caller]
129129
fn fail(&self, location: Location, msg: impl AsRef<str>) {
130130
let span = self.body.source_info(location).span;
131-
// We use `delay_span_bug` as we might see broken MIR when other errors have already
131+
// We use `span_delayed_bug` as we might see broken MIR when other errors have already
132132
// occurred.
133-
self.tcx.sess.diagnostic().delay_span_bug(
133+
self.tcx.sess.diagnostic().span_delayed_bug(
134134
span,
135135
format!(
136136
"broken MIR in {:?} ({}) at {:?}:\n{}",
@@ -571,7 +571,7 @@ impl<'a, 'tcx> Visitor<'tcx> for CfgChecker<'a, 'tcx> {
571571

572572
fn visit_source_scope(&mut self, scope: SourceScope) {
573573
if self.body.source_scopes.get(scope).is_none() {
574-
self.tcx.sess.diagnostic().delay_span_bug(
574+
self.tcx.sess.diagnostic().span_delayed_bug(
575575
self.body.span,
576576
format!(
577577
"broken MIR in {:?} ({}):\ninvalid source scope {:?}",

0 commit comments

Comments
 (0)