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

@ -327,7 +327,7 @@ pub(super) fn lower_expr_mut(&mut self, e: &Expr) -> hir::Expr<'hir> {
),
ExprKind::Yield(opt_expr) => self.lower_expr_yield(e.span, opt_expr.as_deref()),
ExprKind::Err => hir::ExprKind::Err(
self.tcx.sess.delay_span_bug(e.span, "lowered ExprKind::Err"),
self.tcx.sess.span_delayed_bug(e.span, "lowered ExprKind::Err"),
),
ExprKind::Try(sub_expr) => self.lower_expr_try(e.span, sub_expr),
@ -799,7 +799,7 @@ fn lower_expr_await(&mut self, await_kw_span: Span, expr: &Expr) -> hir::ExprKin
self.expr_ident_mut(span, task_context_ident, task_context_hid)
} else {
// Use of `await` outside of an async context, we cannot use `task_context` here.
self.expr_err(span, self.tcx.sess.delay_span_bug(span, "no task_context hir id"))
self.expr_err(span, self.tcx.sess.span_delayed_bug(span, "no task_context hir id"))
};
let new_unchecked = self.expr_call_lang_item_fn_mut(
span,

View File

@ -267,7 +267,7 @@ fn make_count<'hir>(
ctx.expr(
sp,
hir::ExprKind::Err(
ctx.tcx.sess.delay_span_bug(sp, "lowered bad format_args count"),
ctx.tcx.sess.span_delayed_bug(sp, "lowered bad format_args count"),
),
)
}
@ -306,7 +306,7 @@ fn make_format_spec<'hir>(
}
Err(_) => ctx.expr(
sp,
hir::ExprKind::Err(ctx.tcx.sess.delay_span_bug(sp, "lowered bad format_args count")),
hir::ExprKind::Err(ctx.tcx.sess.span_delayed_bug(sp, "lowered bad format_args count")),
),
};
let &FormatOptions {

View File

@ -256,7 +256,7 @@ fn lower_item_kind(
&ImplTraitContext::Disallowed(ImplTraitPosition::Generic),
|this| match ty {
None => {
let guar = this.tcx.sess.delay_span_bug(
let guar = this.tcx.sess.span_delayed_bug(
span,
"expected to lower type alias type, but it was missing",
);
@ -863,7 +863,7 @@ fn lower_impl_item(&mut self, i: &AssocItem) -> &'hir hir::ImplItem<'hir> {
&ImplTraitContext::Disallowed(ImplTraitPosition::Generic),
|this| match ty {
None => {
let guar = this.tcx.sess.delay_span_bug(
let guar = this.tcx.sess.span_delayed_bug(
i.span,
"expected to lower associated type, but it was missing",
);
@ -996,7 +996,7 @@ fn lower_fn_body_block(
fn lower_block_expr_opt(&mut self, span: Span, block: Option<&Block>) -> hir::Expr<'hir> {
match block {
Some(block) => self.lower_block_expr(block),
None => self.expr_err(span, self.tcx.sess.delay_span_bug(span, "no block")),
None => self.expr_err(span, self.tcx.sess.span_delayed_bug(span, "no block")),
}
}
@ -1006,7 +1006,7 @@ pub(super) fn lower_const_body(&mut self, span: Span, expr: Option<&Expr>) -> hi
&[],
match expr {
Some(expr) => this.lower_expr_mut(expr),
None => this.expr_err(span, this.tcx.sess.delay_span_bug(span, "no block")),
None => this.expr_err(span, this.tcx.sess.span_delayed_bug(span, "no block")),
},
)
})

View File

@ -1326,7 +1326,7 @@ fn lower_ty_direct(&mut self, t: &Ty, itctx: &ImplTraitContext) -> hir::Ty<'hir>
let kind = match &t.kind {
TyKind::Infer => hir::TyKind::Infer,
TyKind::Err => {
hir::TyKind::Err(self.tcx.sess.delay_span_bug(t.span, "TyKind::Err lowered"))
hir::TyKind::Err(self.tcx.sess.span_delayed_bug(t.span, "TyKind::Err lowered"))
}
// FIXME(unnamed_fields): IMPLEMENTATION IN PROGRESS
#[allow(rustc::untranslatable_diagnostic)]
@ -1510,7 +1510,7 @@ fn lower_ty_direct(&mut self, t: &Ty, itctx: &ImplTraitContext) -> hir::Ty<'hir>
}
TyKind::MacCall(_) => panic!("`TyKind::MacCall` should have been expanded by now"),
TyKind::CVarArgs => {
let guar = self.tcx.sess.delay_span_bug(
let guar = self.tcx.sess.span_delayed_bug(
t.span,
"`TyKind::CVarArgs` should have been handled elsewhere",
);
@ -1653,7 +1653,7 @@ fn lower_opaque_inner(
} else {
self.tcx
.sess
.delay_span_bug(lifetime.ident.span, "no def-id for fresh lifetime");
.span_delayed_bug(lifetime.ident.span, "no def-id for fresh lifetime");
continue;
}
}
@ -2515,9 +2515,10 @@ fn push_constness(&mut self, lcx: &mut LoweringContext<'_, 'hir>, constness: ast
let hir_id = lcx.next_id();
let Some(host_param_id) = lcx.host_param_id else {
lcx.tcx
.sess
.delay_span_bug(span, "no host param id for call in const yet no errors reported");
lcx.tcx.sess.span_delayed_bug(
span,
"no host param id for call in const yet no errors reported",
);
return;
};

View File

@ -102,7 +102,7 @@ fn check_abi(&self, abi: ast::StrLit, constness: ast::Const) {
}
Err(abi::AbiDisabled::Unrecognized) => {
if self.sess.opts.pretty.map_or(true, |ppm| ppm.needs_hir()) {
self.sess.parse_sess.span_diagnostic.delay_span_bug(
self.sess.parse_sess.span_diagnostic.span_delayed_bug(
span,
format!(
"unrecognized ABI not caught in lowering: {}",

View File

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

View File

@ -385,7 +385,7 @@ fn try_extract_error_from_fulfill_cx<'tcx>(
error_region: Option<ty::Region<'tcx>>,
) -> Option<DiagnosticBuilder<'tcx, ErrorGuaranteed>> {
// We generally shouldn't have errors here because the query was
// already run, but there's no point using `delay_span_bug`
// already run, but there's no point using `span_delayed_bug`
// when we're going to emit an error here anyway.
let _errors = ocx.select_all_or_error();
let region_constraints = ocx.infcx.with_region_constraints(|r| r.clone());

View File

@ -84,7 +84,7 @@ pub fn new(tcx: TyCtxt<'tcx>) -> Self {
#[track_caller]
pub fn push(&mut self, val: impl Into<RegionErrorKind<'tcx>>) {
let val = val.into();
self.1.sess.delay_span_bug(DUMMY_SP, format!("{val:?}"));
self.1.sess.span_delayed_bug(DUMMY_SP, format!("{val:?}"));
self.0.push(val);
}
pub fn is_empty(&self) -> bool {

View File

@ -619,8 +619,8 @@ fn try_match_adt_and_generic_args<'hir>(
_,
) => {
// HIR lowering sometimes doesn't catch this in erroneous
// programs, so we need to use delay_span_bug here. See #82126.
self.infcx.tcx.sess.delay_span_bug(
// programs, so we need to use span_delayed_bug here. See #82126.
self.infcx.tcx.sess.span_delayed_bug(
hir_arg.span(),
format!("unmatched arg and hir arg: found {kind:?} vs {hir_arg:?}"),
);

View File

@ -2134,11 +2134,11 @@ fn check_access_permissions(
&& !self.has_buffered_errors()
{
// rust-lang/rust#46908: In pure NLL mode this code path should be
// unreachable, but we use `delay_span_bug` because we can hit this when
// unreachable, but we use `span_delayed_bug` because we can hit this when
// dereferencing a non-Copy raw pointer *and* have `-Ztreat-err-as-bug`
// enabled. We don't want to ICE for that case, as other errors will have
// been emitted (#52262).
self.infcx.tcx.sess.delay_span_bug(
self.infcx.tcx.sess.span_delayed_bug(
span,
format!(
"Accessing `{place:?}` with the kind `{kind:?}` shouldn't be possible",
@ -2432,7 +2432,7 @@ pub fn new(tcx: TyCtxt<'tcx>) -> Self {
pub fn buffer_error(&mut self, t: DiagnosticBuilder<'_, ErrorGuaranteed>) {
if let None = self.tainted_by_errors {
self.tainted_by_errors = Some(self.tcx.sess.delay_span_bug(
self.tainted_by_errors = Some(self.tcx.sess.span_delayed_bug(
t.span.clone_ignoring_labels(),
"diagnostic buffered but not emitted",
))

View File

@ -314,7 +314,7 @@ pub(crate) fn compute_regions<'cx, 'tcx>(
if !nll_errors.is_empty() {
// Suppress unhelpful extra errors in `infer_opaque_types`.
infcx.set_tainted_by_errors(infcx.tcx.sess.delay_span_bug(
infcx.set_tainted_by_errors(infcx.tcx.sess.span_delayed_bug(
body.span,
"`compute_regions` tainted `infcx` with errors but did not emit any errors",
));

View File

@ -77,7 +77,7 @@ pub(super) fn equate_inputs_and_outputs(
if argument_index + 1 >= body.local_decls.len() {
self.tcx()
.sess
.delay_span_bug(body.span, "found more normalized_input_ty than local_decls");
.span_delayed_bug(body.span, "found more normalized_input_ty than local_decls");
break;
}
@ -101,10 +101,10 @@ pub(super) fn equate_inputs_and_outputs(
);
// We will not have a universal_regions.yield_ty if we yield (by accident)
// outside of a coroutine and return an `impl Trait`, so emit a delay_span_bug
// outside of a coroutine and return an `impl Trait`, so emit a span_delayed_bug
// because we don't want to panic in an assert here if we've already got errors.
if body.yield_ty().is_some() != universal_regions.yield_ty.is_some() {
self.tcx().sess.delay_span_bug(
self.tcx().sess.span_delayed_bug(
body.span,
format!(
"Expected body to have yield_ty ({:?}) iff we have a UR yield_ty ({:?})",

View File

@ -232,7 +232,7 @@ pub(crate) fn type_check<'mir, 'tcx>(
let mut hidden_type = infcx.resolve_vars_if_possible(decl.hidden_type);
trace!("finalized opaque type {:?} to {:#?}", opaque_type_key, hidden_type.ty.kind());
if hidden_type.has_non_region_infer() {
let reported = infcx.tcx.sess.delay_span_bug(
let reported = infcx.tcx.sess.span_delayed_bug(
decl.hidden_type.span,
format!("could not resolve {:#?}", hidden_type.ty.kind()),
);
@ -274,9 +274,9 @@ fn translate_outlives_facts(typeck: &mut TypeChecker<'_, '_>) {
#[track_caller]
fn mirbug(tcx: TyCtxt<'_>, span: Span, msg: String) {
// We sometimes see MIR failures (notably predicate failures) due to
// the fact that we check rvalue sized predicates here. So use `delay_span_bug`
// the fact that we check rvalue sized predicates here. So use `span_delayed_bug`
// to avoid reporting bugs in those cases.
tcx.sess.diagnostic().delay_span_bug(span, msg);
tcx.sess.diagnostic().span_delayed_bug(span, msg);
}
enum FieldAccessError {
@ -1082,7 +1082,7 @@ pub(super) fn register_predefined_opaques_in_new_solver(&mut self) {
);
if result.is_err() {
self.infcx.tcx.sess.delay_span_bug(
self.infcx.tcx.sess.span_delayed_bug(
self.body.span,
"failed re-defining predefined opaques in mir typeck",
);

View File

@ -91,7 +91,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
Some(tcx.fn_sig(did))
} else {
tcx.sess
.delay_span_bug(attr.span, "this attribute can only be applied to functions");
.span_delayed_bug(attr.span, "this attribute can only be applied to functions");
None
}
};

View File

@ -391,7 +391,7 @@ fn load_mir(
if ecx.tcx.is_ctfe_mir_available(def) {
Ok(ecx.tcx.mir_for_ctfe(def))
} else if ecx.tcx.def_kind(def) == DefKind::AssocConst {
let guar = ecx.tcx.sess.delay_span_bug(
let guar = ecx.tcx.sess.span_delayed_bug(
rustc_span::DUMMY_SP,
"This is likely a const item that is missing from its impl",
);
@ -622,7 +622,7 @@ fn increment_const_eval_counter(ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpR
let guard = ecx
.tcx
.sess
.delay_span_bug(span, "The deny lint should have already errored");
.span_delayed_bug(span, "The deny lint should have already errored");
throw_inval!(AlreadyReported(guard.into()));
}
} else if new_steps > start && new_steps.is_power_of_two() {

View File

@ -94,9 +94,9 @@ fn intern_shallow<'rt, 'mir, 'tcx, M: CompileTimeMachine<'mir, 'tcx, const_eval:
// If the pointer is dangling (neither in local nor global memory), we leave it
// to validation to error -- it has the much better error messages, pointing out where
// in the value the dangling reference lies.
// The `delay_span_bug` ensures that we don't forget such a check in validation.
// The `span_delayed_bug` ensures that we don't forget such a check in validation.
if tcx.try_get_global_alloc(alloc_id).is_none() {
tcx.sess.delay_span_bug(ecx.tcx.span, "tried to intern dangling pointer");
tcx.sess.span_delayed_bug(ecx.tcx.span, "tried to intern dangling pointer");
}
// treat dangling pointers like other statics
// just to stop trying to recurse into them
@ -186,7 +186,7 @@ fn visit_value(&mut self, mplace: &MPlaceTy<'tcx>) -> InterpResult<'tcx> {
// Validation will error (with a better message) on an invalid vtable pointer.
// Let validation show the error message, but make sure it *does* error.
tcx.sess
.delay_span_bug(tcx.span, "vtables pointers cannot be integer pointers");
.span_delayed_bug(tcx.span, "vtables pointers cannot be integer pointers");
}
}
// Check if we have encountered this pointer+layout combination before.
@ -375,7 +375,7 @@ pub fn intern_const_alloc_recursive<
match res {
Ok(()) => {}
Err(error) => {
ecx.tcx.sess.delay_span_bug(
ecx.tcx.sess.span_delayed_bug(
ecx.tcx.span,
format!(
"error during interning should later cause validation failure: {}",

View File

@ -248,7 +248,7 @@ pub fn check_body(&mut self) {
// `async` functions cannot be `const fn`. This is checked during AST lowering, so there's
// no need to emit duplicate errors here.
if self.ccx.is_async() || body.coroutine.is_some() {
tcx.sess.delay_span_bug(body.span, "`async` functions cannot be `const fn`");
tcx.sess.span_delayed_bug(body.span, "`async` functions cannot be `const fn`");
return;
}
@ -357,7 +357,9 @@ pub fn check_op_spanned<O: NonConstOp<'tcx>>(&mut self, op: O, span: Span) {
fn check_static(&mut self, def_id: DefId, span: Span) {
if self.tcx.is_thread_local_static(def_id) {
self.tcx.sess.delay_span_bug(span, "tls access is checked in `Rvalue::ThreadLocalRef`");
self.tcx
.sess
.span_delayed_bug(span, "tls access is checked in `Rvalue::ThreadLocalRef`");
}
self.check_op_spanned(ops::StaticAccess, span)
}

View File

@ -112,7 +112,7 @@ pub fn is_const_stable_const_fn(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
None if is_parent_const_stable_trait(tcx, def_id) => {
// Remove this when `#![feature(const_trait_impl)]` is stabilized,
// returning `true` unconditionally.
tcx.sess.delay_span_bug(
tcx.sess.span_delayed_bug(
tcx.def_span(def_id),
"trait implementations cannot be const stable yet",
);

View File

@ -128,9 +128,9 @@ impl<'a, 'tcx> CfgChecker<'a, 'tcx> {
#[track_caller]
fn fail(&self, location: Location, msg: impl AsRef<str>) {
let span = self.body.source_info(location).span;
// We use `delay_span_bug` as we might see broken MIR when other errors have already
// We use `span_delayed_bug` as we might see broken MIR when other errors have already
// occurred.
self.tcx.sess.diagnostic().delay_span_bug(
self.tcx.sess.diagnostic().span_delayed_bug(
span,
format!(
"broken MIR in {:?} ({}) at {:?}:\n{}",
@ -571,7 +571,7 @@ fn visit_terminator(&mut self, terminator: &Terminator<'tcx>, location: Location
fn visit_source_scope(&mut self, scope: SourceScope) {
if self.body.source_scopes.get(scope).is_none() {
self.tcx.sess.diagnostic().delay_span_bug(
self.tcx.sess.diagnostic().span_delayed_bug(
self.body.span,
format!(
"broken MIR in {:?} ({}):\ninvalid source scope {:?}",

View File

@ -528,7 +528,7 @@ pub struct HandlerFlags {
/// If true, immediately emit diagnostics that would otherwise be buffered.
/// (rustc: see `-Z dont-buffer-diagnostics` and `-Z treat-err-as-bug`)
pub dont_buffer_diagnostics: bool,
/// If true, immediately print bugs registered with `delay_span_bug`.
/// If true, immediately print bugs registered with `span_delayed_bug`.
/// (rustc: see `-Z report-delayed-bugs`)
pub report_delayed_bugs: bool,
/// Show macro backtraces.
@ -546,7 +546,7 @@ fn drop(&mut self) {
if !self.has_errors() {
let bugs = std::mem::replace(&mut self.delayed_span_bugs, Vec::new());
self.flush_delayed(bugs, "no errors encountered even though `delay_span_bug` issued");
self.flush_delayed(bugs, "no errors encountered even though `span_delayed_bug` issued");
}
// FIXME(eddyb) this explains what `delayed_good_path_bugs` are!
@ -996,14 +996,14 @@ pub fn span_bug(&self, span: impl Into<MultiSpan>, msg: impl Into<String>) -> !
self.inner.borrow_mut().span_bug(span, msg)
}
/// For documentation on this, see `Session::delay_span_bug`.
/// For documentation on this, see `Session::span_delayed_bug`.
#[track_caller]
pub fn delay_span_bug(
pub fn span_delayed_bug(
&self,
span: impl Into<MultiSpan>,
msg: impl Into<String>,
) -> ErrorGuaranteed {
self.inner.borrow_mut().delay_span_bug(span, msg)
self.inner.borrow_mut().span_delayed_bug(span, msg)
}
// FIXME(eddyb) note the comment inside `impl Drop for HandlerInner`, that's
@ -1268,7 +1268,7 @@ pub fn steal_fulfilled_expectation_ids(&self) -> FxHashSet<LintExpectationId> {
pub fn flush_delayed(&self) {
let mut inner = self.inner.lock();
let bugs = std::mem::replace(&mut inner.delayed_span_bugs, Vec::new());
inner.flush_delayed(bugs, "no errors encountered even though `delay_span_bug` issued");
inner.flush_delayed(bugs, "no errors encountered even though `span_delayed_bug` issued");
}
}
@ -1594,14 +1594,17 @@ fn emit_diag_at_span(&mut self, mut diag: Diagnostic, sp: impl Into<MultiSpan>)
self.emit_diagnostic(diag.set_span(sp));
}
/// For documentation on this, see `Session::delay_span_bug`.
/// For documentation on this, see `Session::span_delayed_bug`.
///
/// Note: this function used to be called `delay_span_bug`. It was renamed
/// to match similar functions like `span_bug`, `span_err`, etc.
#[track_caller]
fn delay_span_bug(
fn span_delayed_bug(
&mut self,
sp: impl Into<MultiSpan>,
msg: impl Into<String>,
) -> ErrorGuaranteed {
// This is technically `self.treat_err_as_bug()` but `delay_span_bug` is called before
// This is technically `self.treat_err_as_bug()` but `span_delayed_bug` is called before
// incrementing `err_count` by one, so we need to +1 the comparing.
// FIXME: Would be nice to increment err_count in a more coherent way.
if self.flags.treat_err_as_bug.is_some_and(|c| {

View File

@ -435,7 +435,7 @@ pub fn fully_expand_fragment(&mut self, input_fragment: AstFragment) -> AstFragm
invocations = mem::take(&mut undetermined_invocations);
force = !mem::replace(&mut progress, false);
if force && self.monotonic {
self.cx.sess.delay_span_bug(
self.cx.sess.span_delayed_bug(
invocations.last().unwrap().0.span(),
"expansion entered force mode without producing any errors",
);

View File

@ -34,7 +34,7 @@ pub(super) fn failed_to_match_macro<'cx>(
if try_success_result.is_ok() {
// Nonterminal parser recovery might turn failed matches into successful ones,
// but for that it must have emitted an error already
tracker.cx.sess.delay_span_bug(sp, "Macro matching returned a success on the second try");
tracker.cx.sess.span_delayed_bug(sp, "Macro matching returned a success on the second try");
}
if let Some(result) = tracker.result {
@ -151,7 +151,7 @@ fn after_arm(&mut self, result: &NamedParseResult<Self::Failure>) {
Success(_) => {
// Nonterminal parser recovery might turn failed matches into successful ones,
// but for that it must have emitted an error already
self.cx.sess.delay_span_bug(
self.cx.sess.span_delayed_bug(
self.root_span,
"should not collect detailed info for successful macro match",
);

View File

@ -813,7 +813,7 @@ pub struct BuiltinAttribute {
rustc_attr!(TEST, rustc_regions, Normal, template!(Word), WarnFollowing),
rustc_attr!(
TEST, rustc_error, Normal,
template!(Word, List: "delay_span_bug_from_inside_query"), WarnFollowingWordOnly
template!(Word, List: "span_delayed_bug_from_inside_query"), WarnFollowingWordOnly
),
rustc_attr!(TEST, rustc_dump_user_args, Normal, template!(Word), WarnFollowing),
rustc_attr!(TEST, rustc_evaluate_where_clauses, Normal, template!(Word), WarnFollowing),

View File

@ -720,9 +720,10 @@ fn instantiate_poly_trait_ref_inner(
// since we should have emitten an error for them earlier, and they will
// not be well-formed!
if polarity == ty::ImplPolarity::Negative {
self.tcx()
.sess
.delay_span_bug(binding.span, "negative trait bounds should not have bindings");
self.tcx().sess.span_delayed_bug(
binding.span,
"negative trait bounds should not have bindings",
);
continue;
}
@ -1419,7 +1420,7 @@ pub fn associated_path_to_ty(
// trait reference.
let Some(trait_ref) = tcx.impl_trait_ref(impl_def_id) else {
// A cycle error occurred, most likely.
let guar = tcx.sess.delay_span_bug(span, "expected cycle error");
let guar = tcx.sess.span_delayed_bug(span, "expected cycle error");
return Err(guar);
};
@ -2376,7 +2377,7 @@ pub fn res_to_ty(
let e = self
.tcx()
.sess
.delay_span_bug(path.span, "path with `Res::Err` but no error emitted");
.span_delayed_bug(path.span, "path with `Res::Err` but no error emitted");
self.set_tainted_by_errors(e);
Ty::new_error(self.tcx(), e)
}

View File

@ -325,7 +325,7 @@ trait here instead: `trait NewTrait: {} {{}}`",
false
});
if references_self {
let guar = tcx.sess.delay_span_bug(
let guar = tcx.sess.span_delayed_bug(
span,
"trait object projection bounds reference `Self`",
);

View File

@ -130,7 +130,7 @@ fn allowed_union_field<'tcx>(
for field in &def.non_enum_variant().fields {
let Ok(field_ty) = tcx.try_normalize_erasing_regions(param_env, field.ty(tcx, args))
else {
tcx.sess.delay_span_bug(span, "could not normalize field type");
tcx.sess.span_delayed_bug(span, "could not normalize field type");
continue;
};
@ -151,7 +151,8 @@ fn allowed_union_field<'tcx>(
return false;
} else if field_ty.needs_drop(tcx, param_env) {
// This should never happen. But we can get here e.g. in case of name resolution errors.
tcx.sess.delay_span_bug(span, "we should never accept maybe-dropping union fields");
tcx.sess
.span_delayed_bug(span, "we should never accept maybe-dropping union fields");
}
}
} else {
@ -181,7 +182,7 @@ fn check_static_inhabited(tcx: TyCtxt<'_>, def_id: LocalDefId) {
}
// Generic statics are rejected, but we still reach this case.
Err(e) => {
tcx.sess.delay_span_bug(span, format!("{e:?}"));
tcx.sess.span_delayed_bug(span, format!("{e:?}"));
return;
}
};
@ -204,7 +205,7 @@ fn check_static_inhabited(tcx: TyCtxt<'_>, def_id: LocalDefId) {
fn check_opaque(tcx: TyCtxt<'_>, id: hir::ItemId) {
let item = tcx.hir().item(id);
let hir::ItemKind::OpaqueTy(hir::OpaqueTy { origin, .. }) = item.kind else {
tcx.sess.delay_span_bug(item.span, "expected opaque item");
tcx.sess.span_delayed_bug(item.span, "expected opaque item");
return;
};
@ -313,7 +314,7 @@ fn check_opaque_meets_bounds<'tcx>(
Ok(()) => {}
Err(ty_err) => {
let ty_err = ty_err.to_string(tcx);
return Err(tcx.sess.delay_span_bug(
return Err(tcx.sess.span_delayed_bug(
span,
format!("could not unify `{hidden_ty}` with revealed type:\n{ty_err}"),
));
@ -655,7 +656,7 @@ pub(super) fn check_specialization_validity<'tcx>(
if !tcx.is_impl_trait_in_trait(impl_item) {
report_forbidden_specialization(tcx, impl_item, parent_impl);
} else {
tcx.sess.delay_span_bug(
tcx.sess.span_delayed_bug(
DUMMY_SP,
format!("parent item: {parent_impl:?} not marked as default"),
);
@ -703,7 +704,7 @@ fn check_impl_items_against_trait<'tcx>(
tcx.associated_item(trait_item_id)
} else {
// Checked in `associated_item`.
tcx.sess.delay_span_bug(tcx.def_span(impl_item), "missing associated item in trait");
tcx.sess.span_delayed_bug(tcx.def_span(impl_item), "missing associated item in trait");
continue;
};
match ty_impl_item.kind {

View File

@ -439,7 +439,7 @@ fn compare_method_predicate_entailment<'tcx>(
}
return Err(tcx
.sess
.delay_span_bug(rustc_span::DUMMY_SP, "error should have been emitted"));
.span_delayed_bug(rustc_span::DUMMY_SP, "error should have been emitted"));
}
}
}
@ -937,7 +937,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
remapped_types.insert(def_id, ty::EarlyBinder::bind(ty));
}
Err(err) => {
let reported = tcx.sess.delay_span_bug(
let reported = tcx.sess.span_delayed_bug(
return_span,
format!("could not fully resolve: {ty} => {err:?}"),
);
@ -1114,7 +1114,9 @@ fn try_fold_region(
.note(format!("hidden type inferred to be `{}`", self.ty))
.emit()
}
_ => self.tcx.sess.delay_span_bug(DUMMY_SP, "should've been able to remap region"),
_ => {
self.tcx.sess.span_delayed_bug(DUMMY_SP, "should've been able to remap region")
}
};
return Err(guar);
};
@ -1473,7 +1475,7 @@ fn compare_number_of_generics<'tcx>(
// inheriting the generics from will also have mismatched arguments, and
// we'll report an error for that instead. Delay a bug for safety, though.
if trait_.is_impl_trait_in_trait() {
return Err(tcx.sess.delay_span_bug(
return Err(tcx.sess.span_delayed_bug(
rustc_span::DUMMY_SP,
"errors comparing numbers of generics of trait/impl functions were not emitted",
));

View File

@ -153,7 +153,7 @@ pub(super) fn check_refining_return_position_impl_trait_in_trait<'tcx>(
trait_m_sig.inputs_and_output,
));
if !ocx.select_all_or_error().is_empty() {
tcx.sess.delay_span_bug(
tcx.sess.span_delayed_bug(
DUMMY_SP,
"encountered errors when checking RPITIT refinement (selection)",
);
@ -165,7 +165,7 @@ pub(super) fn check_refining_return_position_impl_trait_in_trait<'tcx>(
);
let errors = infcx.resolve_regions(&outlives_env);
if !errors.is_empty() {
tcx.sess.delay_span_bug(
tcx.sess.span_delayed_bug(
DUMMY_SP,
"encountered errors when checking RPITIT refinement (regions)",
);
@ -173,7 +173,7 @@ pub(super) fn check_refining_return_position_impl_trait_in_trait<'tcx>(
}
// Resolve any lifetime variables that may have been introduced during normalization.
let Ok((trait_bounds, impl_bounds)) = infcx.fully_resolve((trait_bounds, impl_bounds)) else {
tcx.sess.delay_span_bug(
tcx.sess.span_delayed_bug(
DUMMY_SP,
"encountered errors when checking RPITIT refinement (resolution)",
);

View File

@ -66,7 +66,7 @@ pub fn check_drop_impl(tcx: TyCtxt<'_>, drop_impl_did: DefId) -> Result<(), Erro
// already checked by coherence, but compilation may
// not have been terminated.
let span = tcx.def_span(drop_impl_did);
let reported = tcx.sess.delay_span_bug(
let reported = tcx.sess.span_delayed_bug(
span,
format!("should have been rejected by coherence check: {dtor_self_type}"),
);

View File

@ -281,7 +281,7 @@ fn check_asm_operand_type(
pub fn check_asm(&self, asm: &hir::InlineAsm<'tcx>, enclosing_id: LocalDefId) {
let target_features = self.tcx.asm_target_features(enclosing_id.to_def_id());
let Some(asm_arch) = self.tcx.sess.asm_arch else {
self.tcx.sess.delay_span_bug(DUMMY_SP, "target architecture does not support asm");
self.tcx.sess.span_delayed_bug(DUMMY_SP, "target architecture does not support asm");
return;
};
for (idx, (op, op_sp)) in asm.operands.iter().enumerate() {

View File

@ -118,10 +118,10 @@ pub(super) fn enter_wf_checking_ctxt<'tcx, F>(
if tcx.sess.err_count() > 0 {
return Err(err);
} else {
// HACK(oli-obk): tests/ui/specialization/min_specialization/specialize_on_type_error.rs causes an
// error (delay_span_bug) during normalization, without reporting an error, so we need to act as if
// no error happened, in order to let our callers continue and report an error later in
// check_impl_items_against_trait.
// HACK(oli-obk): tests/ui/specialization/min_specialization/specialize_on_type_error.rs
// causes an error (span_delayed_bug) during normalization, without reporting an error,
// so we need to act as if no error happened, in order to let our callers continue and
// report an error later in check_impl_items_against_trait.
return Ok(());
}
}
@ -1040,7 +1040,7 @@ fn check_type_defn<'tcx>(
let ty = tcx.erase_regions(ty);
if ty.has_infer() {
tcx.sess
.delay_span_bug(item.span, format!("inference variables in {ty:?}"));
.span_delayed_bug(item.span, format!("inference variables in {ty:?}"));
// Just treat unresolved type expression as if it needs drop.
true
} else {
@ -1812,8 +1812,10 @@ fn check_variances_for_type_defn<'tcx>(
//
// if they aren't in the same order, then the user has written invalid code, and already
// got an error about it (or I'm wrong about this)
tcx.sess
.delay_span_bug(hir_param.span, "hir generics and ty generics in different order");
tcx.sess.span_delayed_bug(
hir_param.span,
"hir generics and ty generics in different order",
);
continue;
}

View File

@ -453,7 +453,7 @@ fn lint_auto_trait_impl<'tcx>(
impl_def_id: LocalDefId,
) {
if trait_ref.args.len() != 1 {
tcx.sess.diagnostic().delay_span_bug(
tcx.sess.diagnostic().span_delayed_bug(
tcx.def_span(impl_def_id),
"auto traits cannot have generic parameters",
);

View File

@ -82,7 +82,7 @@ pub(super) fn check_item(tcx: TyCtxt<'_>, def_id: LocalDefId) {
(_, _, Unsafety::Unsafe, hir::ImplPolarity::Negative(_)) => {
// Reported in AST validation
tcx.sess.delay_span_bug(item.span, "unsafe negative impl");
tcx.sess.span_delayed_bug(item.span, "unsafe negative impl");
}
(_, _, Unsafety::Normal, hir::ImplPolarity::Negative(_))
| (Unsafety::Unsafe, _, Unsafety::Unsafe, hir::ImplPolarity::Positive)

View File

@ -335,7 +335,7 @@ fn poly_trait_ref_binder_info(&mut self) -> (Vec<ty::BoundVariableKind>, BinderS
// though this may happen when we call `poly_trait_ref_binder_info` with
// an (erroneous, #113423) associated return type bound in an impl header.
if !supertrait_bound_vars.is_empty() {
self.tcx.sess.delay_span_bug(
self.tcx.sess.span_delayed_bug(
DUMMY_SP,
format!(
"found supertrait lifetimes without a binder to append \
@ -1363,7 +1363,7 @@ fn resolve_lifetime_ref(
}
}
self.tcx.sess.delay_span_bug(
self.tcx.sess.span_delayed_bug(
lifetime_ref.ident.span,
format!("Could not resolve {:?} in scope {:#?}", lifetime_ref, self.scope,),
);
@ -1493,7 +1493,7 @@ fn resolve_type_ref(&mut self, param_def_id: LocalDefId, hir_id: hir::HirId) {
}
}
self.tcx.sess.delay_span_bug(
self.tcx.sess.span_delayed_bug(
self.tcx.hir().span(hir_id),
format!("could not resolve {param_def_id:?}"),
);
@ -1724,7 +1724,7 @@ fn visit_segment_args(
} else {
self.tcx
.sess
.delay_span_bug(binding.ident.span, "bad return type notation here");
.span_delayed_bug(binding.ident.span, "bad return type notation here");
vec![]
};
self.with(scope, |this| {
@ -2057,7 +2057,7 @@ fn visit_ty(&mut self, ty: &'v hir::Ty<'v>) {
Some(true) => Some(arg),
Some(false) => None,
None => {
tcx.sess.delay_span_bug(
tcx.sess.span_delayed_bug(
*span,
format!(
"Incorrect generic arg count for alias {alias_def:?}"

View File

@ -29,7 +29,7 @@ fn diagnostic_hir_wf_check<'tcx>(
// HIR wfcheck should only ever happen as part of improving an existing error
tcx.sess
.delay_span_bug(tcx.def_span(def_id), "Performed HIR wfcheck without an existing error!");
.span_delayed_bug(tcx.def_span(def_id), "Performed HIR wfcheck without an existing error!");
let icx = ItemCtxt::new(tcx, def_id);

View File

@ -74,7 +74,7 @@ fn enforce_impl_params_are_constrained(tcx: TyCtxt<'_>, impl_def_id: LocalDefId)
if impl_self_ty.references_error() {
// Don't complain about unconstrained type params when self ty isn't known due to errors.
// (#36836)
tcx.sess.delay_span_bug(
tcx.sess.span_delayed_bug(
tcx.def_span(impl_def_id),
format!(
"potentially unconstrained type parameters weren't evaluated: {impl_self_ty:?}",

View File

@ -209,8 +209,8 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> {
tcx.hir().for_each_module(|module| tcx.ensure().check_mod_item_types(module))
});
// HACK: `check_mod_type_wf` may spuriously emit errors due to `delay_span_bug`, even if those errors
// only actually get emitted in `check_mod_item_types`.
// HACK: `check_mod_type_wf` may spuriously emit errors due to `span_delayed_bug`, even if
// those errors only actually get emitted in `check_mod_item_types`.
errs?;
if tcx.features().rustc_attrs {

View File

@ -244,7 +244,7 @@ fn try_overloaded_call_traits(
) {
// Check for `self` receiver on the method, otherwise we can't use this as a `Fn*` trait.
if !self.tcx.associated_item(ok.value.def_id).fn_has_self_parameter {
self.tcx.sess.delay_span_bug(
self.tcx.sess.span_delayed_bug(
call_expr.span,
"input to overloaded call fn is not a self receiver",
);
@ -259,9 +259,10 @@ fn try_overloaded_call_traits(
let ty::Ref(region, _, mutbl) = method.sig.inputs()[0].kind() else {
// The `fn`/`fn_mut` lang item is ill-formed, which should have
// caused an error elsewhere.
self.tcx
.sess
.delay_span_bug(call_expr.span, "input to call/call_mut is not a ref");
self.tcx.sess.span_delayed_bug(
call_expr.span,
"input to call/call_mut is not a ref",
);
return None;
};

View File

@ -142,7 +142,7 @@ fn pointer_kind(
let reported = self
.tcx
.sess
.delay_span_bug(span, format!("`{t:?}` should be sized but is not?"));
.span_delayed_bug(span, format!("`{t:?}` should be sized but is not?"));
return Err(reported);
}
})

View File

@ -1549,7 +1549,9 @@ pub(crate) fn coerce_inner<'a>(
// any superfluous errors we might encounter while trying to
// emit or provide suggestions on how to fix the initial error.
fcx.set_tainted_by_errors(
fcx.tcx.sess.delay_span_bug(cause.span, "coercion error but no error emitted"),
fcx.tcx
.sess
.span_delayed_bug(cause.span, "coercion error but no error emitted"),
);
let (expected, found) = if label_expression_as_expected {
// In the case where this is a "forced unit", like

View File

@ -256,7 +256,7 @@ pub fn demand_coerce_diag(
self.adjust_expr_for_assert_eq_macro(&mut expr, &mut expected_ty_expr);
self.set_tainted_by_errors(self.tcx.sess.delay_span_bug(
self.set_tainted_by_errors(self.tcx.sess.span_delayed_bug(
expr.span,
"`TypeError` when attempting coercion but no error emitted",
));

View File

@ -75,7 +75,7 @@ pub fn check_expr_has_type_or_error(
// coercions from ! to `expected`.
if ty.is_never() {
if let Some(adjustments) = self.typeck_results.borrow().adjustments().get(expr.hir_id) {
let reported = self.tcx().sess.delay_span_bug(
let reported = self.tcx().sess.span_delayed_bug(
expr.span,
"expression with never type wound up being adjusted",
);
@ -514,7 +514,7 @@ pub(crate) fn check_expr_path(
Res::Err => {
self.suggest_assoc_method_call(segs);
let e =
self.tcx.sess.delay_span_bug(qpath.span(), "`Res::Err` but no error emitted");
self.tcx.sess.span_delayed_bug(qpath.span(), "`Res::Err` but no error emitted");
self.set_tainted_by_errors(e);
Ty::new_error(tcx, e)
}
@ -623,7 +623,7 @@ fn check_expr_break(
// Set expectation to error in that case and set tainted
// by error (#114529)
let coerce_to = opt_coerce_to.unwrap_or_else(|| {
let guar = tcx.sess.delay_span_bug(
let guar = tcx.sess.span_delayed_bug(
expr.span,
"illegal break with value found but no error reported",
);
@ -1292,7 +1292,7 @@ fn check_expr_loop(
// permit break with a value [1].
if ctxt.coerce.is_none() && !ctxt.may_break {
// [1]
self.tcx.sess.delay_span_bug(body.span, "no coercion, but loop may not break");
self.tcx.sess.span_delayed_bug(body.span, "no coercion, but loop may not break");
}
ctxt.coerce.map(|c| c.complete(self)).unwrap_or_else(|| Ty::new_unit(self.tcx))
}
@ -2187,7 +2187,7 @@ fn report_unknown_field(
let guar = self
.tcx
.sess
.delay_span_bug(expr.span, "parser recovered but no error was emitted");
.span_delayed_bug(expr.span, "parser recovered but no error was emitted");
self.set_tainted_by_errors(guar);
return guar;
}
@ -2403,7 +2403,7 @@ fn check_field(
}
let guar = if field.name == kw::Empty {
self.tcx.sess.delay_span_bug(field.span, "field name with no name")
self.tcx.sess.span_delayed_bug(field.span, "field name with no name")
} else if self.method_exists(field, base_ty, expr.hir_id, expected.only_has_type(self)) {
self.ban_take_value_of_method(expr, base_ty, field)
} else if !base_ty.is_primitive_ty() {

View File

@ -538,7 +538,7 @@ fn walk_struct_expr<'hir>(
// The struct path probably didn't resolve
if self.mc.typeck_results.opt_field_index(field.hir_id).is_none() {
self.tcx().sess.delay_span_bug(field.span, "couldn't resolve index for field");
self.tcx().sess.span_delayed_bug(field.span, "couldn't resolve index for field");
}
}

View File

@ -277,7 +277,7 @@ pub fn apply_adjustments(&self, expr: &hir::Expr<'_>, adj: Vec<Adjustment<'tcx>>
// FIXME: currently we never try to compose autoderefs
// and ReifyFnPointer/UnsafeFnPointer, but we could.
_ => {
self.tcx.sess.delay_span_bug(
self.tcx.sess.span_delayed_bug(
expr.span,
format!(
"while adjusting {:?}, can't compose {:?} and {:?}",
@ -866,7 +866,7 @@ pub fn resolve_ty_and_res_fully_qualified_call(
let guar = self
.tcx
.sess
.delay_span_bug(span, "method resolution should've emitted an error");
.span_delayed_bug(span, "method resolution should've emitted an error");
let result = match error {
method::MethodError::PrivateMatch(kind, def_id, _) => Ok((kind, def_id)),
_ => Err(guar),
@ -1440,7 +1440,7 @@ fn inferred_kind(
) {
Ok(ok) => self.register_infer_ok_obligations(ok),
Err(_) => {
self.tcx.sess.delay_span_bug(
self.tcx.sess.span_delayed_bug(
span,
format!(
"instantiate_value_path: (UFCS) {self_ty:?} was a subtype of {impl_ty:?} but now is not?",

View File

@ -517,7 +517,7 @@ fn has_error_or_infer<'tcx>(tys: impl IntoIterator<Item = Ty<'tcx>>) -> bool {
let tcx = self.tcx;
// FIXME: taint after emitting errors and pass through an `ErrorGuaranteed`
self.set_tainted_by_errors(
tcx.sess.delay_span_bug(call_span, "no errors reported for args"),
tcx.sess.span_delayed_bug(call_span, "no errors reported for args"),
);
// Get the argument span in the context of the call span so that
@ -1361,7 +1361,7 @@ pub fn check_struct_path(
let variant = match def {
Res::Err => {
let guar =
self.tcx.sess.delay_span_bug(path_span, "`Res::Err` but no error emitted");
self.tcx.sess.span_delayed_bug(path_span, "`Res::Err` but no error emitted");
self.set_tainted_by_errors(guar);
return Err(guar);
}

View File

@ -48,7 +48,7 @@ pub fn check_transmute(&self, from: Ty<'tcx>, to: Ty<'tcx>, hir_id: HirId) {
let to = normalize(to);
trace!(?from, ?to);
if from.has_non_region_infer() || to.has_non_region_infer() {
tcx.sess.delay_span_bug(span, "argument to transmute has inference variables");
tcx.sess.span_delayed_bug(span, "argument to transmute has inference variables");
return;
}
// Transmutes that are only changing lifetimes are always ok.

View File

@ -540,7 +540,7 @@ fn variant_index_for_adt(
let ty::Adt(adt_def, _) = ty.kind() else {
self.tcx()
.sess
.delay_span_bug(span, "struct or tuple struct pattern not applied to an ADT");
.span_delayed_bug(span, "struct or tuple struct pattern not applied to an ADT");
return Err(());
};
@ -575,7 +575,7 @@ fn total_fields_in_adt_variant(
_ => {
self.tcx()
.sess
.delay_span_bug(span, "struct or tuple struct pattern not applied to an ADT");
.span_delayed_bug(span, "struct or tuple struct pattern not applied to an ADT");
Err(())
}
}
@ -588,7 +588,7 @@ fn total_fields_in_tuple(&self, pat_hir_id: hir::HirId, span: Span) -> McResult<
match ty.kind() {
ty::Tuple(args) => Ok(args.len()),
_ => {
self.tcx().sess.delay_span_bug(span, "tuple pattern not applied to a tuple");
self.tcx().sess.span_delayed_bug(span, "tuple pattern not applied to a tuple");
Err(())
}
}

View File

@ -385,7 +385,7 @@ fn construct_obligation_for_trait(
// type parameters or early-bound regions.
let tcx = self.tcx;
let Some(method_item) = self.associated_value(trait_def_id, m_name) else {
tcx.sess.delay_span_bug(
tcx.sess.span_delayed_bug(
obligation.cause.span,
"operator trait does not have corresponding operator method",
);
@ -393,7 +393,7 @@ fn construct_obligation_for_trait(
};
if method_item.kind != ty::AssocKind::Fn {
self.tcx.sess.delay_span_bug(tcx.def_span(method_item.def_id), "not a method");
self.tcx.sess.span_delayed_bug(tcx.def_span(method_item.def_id), "not a method");
return None;
}

View File

@ -802,7 +802,7 @@ fn assemble_inherent_candidates_from_object(&mut self, self_ty: Ty<'tcx>) {
let trait_ref = principal.with_self_ty(self.tcx, self_ty);
self.elaborate_bounds(iter::once(trait_ref), |this, new_trait_ref, item| {
if new_trait_ref.has_non_region_bound_vars() {
this.tcx.sess.delay_span_bug(
this.tcx.sess.span_delayed_bug(
this.span,
"tried to select method from HRTB with non-lifetime bound vars",
);

View File

@ -813,7 +813,7 @@ pub fn report_no_match_method_error(
span: item_span,
..
})) => {
tcx.sess.delay_span_bug(
tcx.sess.span_delayed_bug(
*item_span,
"auto trait is invoked with no method error, but no error reported?",
);

View File

@ -900,7 +900,7 @@ fn lookup_op_method(
) {
self.tcx
.sess
.delay_span_bug(span, "operator didn't have the right number of generic args");
.span_delayed_bug(span, "operator didn't have the right number of generic args");
return Err(vec![]);
}
@ -933,7 +933,7 @@ fn lookup_op_method(
// This path may do some inference, so make sure we've really
// doomed compilation so as to not accidentally stabilize new
// inference or something here...
self.tcx.sess.delay_span_bug(span, "this path really should be doomed...");
self.tcx.sess.span_delayed_bug(span, "this path really should be doomed...");
// Guide inference for the RHS expression if it's provided --
// this will allow us to better error reporting, at the expense
// of making some error messages a bit more specific.

View File

@ -899,7 +899,7 @@ fn check_pat_path(
let (res, opt_ty, segments) = path_resolution;
match res {
Res::Err => {
let e = tcx.sess.delay_span_bug(qpath.span(), "`Res::Err` but no error emitted");
let e = tcx.sess.span_delayed_bug(qpath.span(), "`Res::Err` but no error emitted");
self.set_tainted_by_errors(e);
return Ty::new_error(tcx, e);
}
@ -1068,7 +1068,7 @@ fn check_pat_tuple_struct(
let (res, opt_ty, segments) =
self.resolve_ty_and_res_fully_qualified_call(qpath, pat.hir_id, pat.span, None);
if res == Res::Err {
let e = tcx.sess.delay_span_bug(pat.span, "`Res::Err` but no error emitted");
let e = tcx.sess.span_delayed_bug(pat.span, "`Res::Err` but no error emitted");
self.set_tainted_by_errors(e);
on_error(e);
return Ty::new_error(tcx, e);
@ -1084,7 +1084,7 @@ fn check_pat_tuple_struct(
let variant = match res {
Res::Err => {
let e = tcx.sess.delay_span_bug(pat.span, "`Res::Err` but no error emitted");
let e = tcx.sess.span_delayed_bug(pat.span, "`Res::Err` but no error emitted");
self.set_tainted_by_errors(e);
on_error(e);
return Ty::new_error(tcx, e);

View File

@ -725,7 +725,7 @@ fn compute_min_captures(
}
}
self.tcx.sess.delay_span_bug(
self.tcx.sess.span_delayed_bug(
closure_span,
format!(
"two identical projections: ({:?}, {:?})",

View File

@ -218,7 +218,7 @@ fn fix_index_builtin_expr(&mut self, e: &hir::Expr<'_>) {
// When encountering `return [0][0]` outside of a `fn` body we can encounter a base
// that isn't in the type table. We assume more relevant errors have already been
// emitted, so we delay an ICE if none have. (#64638)
self.tcx().sess.delay_span_bug(e.span, format!("bad base: `{base:?}`"));
self.tcx().sess.span_delayed_bug(e.span, format!("bad base: `{base:?}`"));
}
if let Some(base_ty) = base_ty
&& let ty::Ref(_, base_ty_inner, _) = *base_ty.kind()
@ -311,7 +311,9 @@ fn visit_generic_param(&mut self, p: &'tcx hir::GenericParam<'tcx>) {
// Nothing to write back here
}
hir::GenericParamKind::Type { .. } | hir::GenericParamKind::Const { .. } => {
self.tcx().sess.delay_span_bug(p.span, format!("unexpected generic param: {p:?}"));
self.tcx()
.sess
.span_delayed_bug(p.span, format!("unexpected generic param: {p:?}"));
}
}
}

View File

@ -194,8 +194,8 @@ fn canonicalize_free_region<'tcx>(
//
// rust-lang/rust#57464: `impl Trait` can leak local
// scopes (in manner violating typeck). Therefore, use
// `delay_span_bug` to allow type error over an ICE.
canonicalizer.tcx.sess.delay_span_bug(
// `span_delayed_bug` to allow type error over an ICE.
canonicalizer.tcx.sess.span_delayed_bug(
rustc_span::DUMMY_SP,
format!("unexpected region in query response: `{r:?}`"),
);

View File

@ -175,7 +175,7 @@ pub fn super_combine_consts<R>(
&mut OriginalQueryValues::default(),
);
self.tcx.check_tys_might_be_eq(canonical).map_err(|_| {
self.tcx.sess.delay_span_bug(
self.tcx.sess.span_delayed_bug(
DUMMY_SP,
format!("cannot relate consts of different types (a={a:?}, b={b:?})",),
)

View File

@ -517,7 +517,7 @@ pub fn report_region_errors(
self.tcx
.sess
.delay_span_bug(self.tcx.def_span(generic_param_scope), "expected region errors")
.span_delayed_bug(self.tcx.def_span(generic_param_scope), "expected region errors")
}
// This method goes through all the errors and try to group certain types

View File

@ -798,7 +798,7 @@ fn region_order_key(x: &RegionAndOrigin<'_>) -> u8 {
// Errors in earlier passes can yield error variables without
// resolution errors here; delay ICE in favor of those errors.
self.tcx().sess.delay_span_bug(
self.tcx().sess.span_delayed_bug(
self.var_infos[node_idx].origin.span(),
format!(
"collect_error_for_expanding_node() could not find \

View File

@ -1433,7 +1433,7 @@ pub fn fully_resolve<T: TypeFoldable<TyCtxt<'tcx>>>(&self, value: T) -> FixupRes
let guar = self
.tcx
.sess
.delay_span_bug(DUMMY_SP, format!("`{value:?}` is not fully resolved"));
.span_delayed_bug(DUMMY_SP, format!("`{value:?}` is not fully resolved"));
Ok(self.tcx.fold_regions(value, |re, _| {
if re.is_var() { ty::Region::new_error(self.tcx, guar) } else { re }
}))

View File

@ -494,7 +494,7 @@ fn tys(&mut self, a: Ty<'tcx>, mut b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>>
// shouldn't ever fail. Instead, it unconditionally emits an
// alias-relate goal.
assert!(!self.infcx.next_trait_solver());
self.tcx().sess.delay_span_bug(
self.tcx().sess.span_delayed_bug(
self.delegate.span(),
"failure to relate an opaque to itself should result in an error later on",
);
@ -552,7 +552,7 @@ fn consts(
match b.kind() {
ty::ConstKind::Infer(InferConst::Var(_)) if D::forbid_inference_vars() => {
// Forbid inference variables in the RHS.
self.infcx.tcx.sess.delay_span_bug(
self.infcx.tcx.sess.span_delayed_bug(
self.delegate.span(),
format!("unexpected inference var {b:?}",),
);

View File

@ -41,7 +41,7 @@ impl<'tcx> Drop for OpaqueTypeStorage<'tcx> {
fn drop(&mut self) {
if !self.opaque_types.is_empty() {
ty::tls::with(|tcx| {
tcx.sess.delay_span_bug(DUMMY_SP, format!("{:?}", self.opaque_types))
tcx.sess.span_delayed_bug(DUMMY_SP, format!("{:?}", self.opaque_types))
});
}
}

View File

@ -254,7 +254,7 @@ fn components_must_outlive(
// ignore this, we presume it will yield an error
// later, since if a type variable is not resolved by
// this point it never will be
self.tcx.sess.delay_span_bug(
self.tcx.sess.span_delayed_bug(
origin.span(),
format!("unresolved inference variable in outlives: {v:?}"),
);

View File

@ -180,7 +180,7 @@ fn bound_from_single_component(
// ignore this, we presume it will yield an error
// later, since if a type variable is not resolved by
// this point it never will be
self.tcx.sess.delay_span_bug(
self.tcx.sess.span_delayed_bug(
rustc_span::DUMMY_SP,
format!("unresolved inference variable in outlives: {v:?}"),
);

View File

@ -194,16 +194,16 @@ fn check_for_rustc_errors_attr(tcx: TyCtxt<'_>) {
let Some((def_id, _)) = tcx.entry_fn(()) else { return };
for attr in tcx.get_attrs(def_id, sym::rustc_error) {
match attr.meta_item_list() {
// Check if there is a `#[rustc_error(delay_span_bug_from_inside_query)]`.
// Check if there is a `#[rustc_error(span_delayed_bug_from_inside_query)]`.
Some(list)
if list.iter().any(|list_item| {
matches!(
list_item.ident().map(|i| i.name),
Some(sym::delay_span_bug_from_inside_query)
Some(sym::span_delayed_bug_from_inside_query)
)
}) =>
{
tcx.ensure().trigger_delay_span_bug(def_id);
tcx.ensure().trigger_span_delayed_bug(def_id);
}
// Bare `#[rustc_error]`.

View File

@ -430,7 +430,7 @@ pub fn check_ast_node_inner<'a, T: EarlyLintPass>(
// that was not lint-checked (perhaps it doesn't exist?). This is a bug.
for (id, lints) in cx.context.buffered.map {
for early_lint in lints {
sess.delay_span_bug(
sess.span_delayed_bug(
early_lint.span,
format!(
"failed to process buffered lint here (dummy = {})",

View File

@ -4,9 +4,10 @@
///
/// If you have a span available, you should use [`span_bug`] instead.
///
/// If the bug should only be emitted when compilation didn't fail, [`Session::delay_span_bug`] may be useful.
/// If the bug should only be emitted when compilation didn't fail, [`Session::span_delayed_bug`]
/// may be useful.
///
/// [`Session::delay_span_bug`]: rustc_session::Session::delay_span_bug
/// [`Session::span_delayed_bug`]: rustc_session::Session::span_delayed_bug
/// [`span_bug`]: crate::span_bug
#[macro_export]
macro_rules! bug {
@ -23,9 +24,10 @@ macro_rules! bug {
/// at the code the compiler was compiling when it ICEd. This is the preferred way to trigger
/// ICEs.
///
/// If the bug should only be emitted when compilation didn't fail, [`Session::delay_span_bug`] may be useful.
/// If the bug should only be emitted when compilation didn't fail, [`Session::span_delayed_bug`]
/// may be useful.
///
/// [`Session::delay_span_bug`]: rustc_session::Session::delay_span_bug
/// [`Session::span_delayed_bug`]: rustc_session::Session::span_delayed_bug
#[macro_export]
macro_rules! span_bug {
($span:expr, $msg:expr) => ({ $crate::util::bug::span_bug_fmt($span, ::std::format_args!($msg)) });

View File

@ -566,7 +566,7 @@ pub fn check_stability_allow_unstable(
|span, def_id| {
// The API could be uncallable for other reasons, for example when a private module
// was referenced.
self.sess.delay_span_bug(span, format!("encountered unmarked API: {def_id:?}"));
self.sess.span_delayed_bug(span, format!("encountered unmarked API: {def_id:?}"));
},
)
}

View File

@ -315,7 +315,7 @@ fn uninit_inner<R>(size: Size, align: Align, fail: impl FnOnce() -> R) -> Result
pub fn try_uninit<'tcx>(size: Size, align: Align) -> InterpResult<'tcx, Self> {
Self::uninit_inner(size, align, || {
ty::tls::with(|tcx| {
tcx.sess.delay_span_bug(DUMMY_SP, "exhausted memory during interpretation")
tcx.sess.span_delayed_bug(DUMMY_SP, "exhausted memory during interpretation")
});
InterpError::ResourceExhaustion(ResourceExhaustionInfo::MemoryExhausted).into()
})

View File

@ -199,7 +199,7 @@ pub struct LitToConstInput<'tcx> {
#[derive(Copy, Clone, Debug, Eq, PartialEq, HashStable)]
pub enum LitToConstError {
/// The literal's inferred type did not match the expected `ty` in the input.
/// This is used for graceful error handling (`delay_span_bug`) in
/// This is used for graceful error handling (`span_delayed_bug`) in
/// type checking (`Const::from_anon_const`).
TypeError,
Reported(ErrorGuaranteed),

View File

@ -108,9 +108,9 @@
// Queries marked with `fatal_cycle` do not need the latter implementation,
// as they will raise an fatal error on query cycles instead.
rustc_queries! {
/// This exists purely for testing the interactions between delay_span_bug and incremental.
query trigger_delay_span_bug(key: DefId) -> () {
desc { "triggering a delay span bug for testing incremental" }
/// This exists purely for testing the interactions between span_delayed_bug and incremental.
query trigger_span_delayed_bug(key: DefId) -> () {
desc { "triggering a span delayed bug for testing incremental" }
}
/// Collects the list of all tools registered using `#![register_tool]`.

View File

@ -551,7 +551,7 @@ pub fn $name(self, value: queries::$name::ProvidedValue<'tcx>) {
// We have an inconsistency. This can happen if one of the two
// results is tainted by errors. In this case, delay a bug to
// ensure compilation is doomed, and keep the `old` value.
tcx.sess.delay_span_bug(DUMMY_SP, format!(
tcx.sess.span_delayed_bug(DUMMY_SP, format!(
"Trying to feed an already recorded value for query {} key={key:?}:\n\
old value: {old:?}\nnew value: {value:?}",
stringify!($name),

View File

@ -481,7 +481,7 @@ pub fn eval_explicit_discr(self, tcx: TyCtxt<'tcx>, expr_did: DefId) -> Option<D
ErrorHandled::Reported(..) => "enum discriminant evaluation failed",
ErrorHandled::TooGeneric(..) => "enum discriminant depends on generics",
};
tcx.sess.delay_span_bug(tcx.def_span(expr_did), msg);
tcx.sess.span_delayed_bug(tcx.def_span(expr_did), msg);
None
}
}

View File

@ -144,7 +144,7 @@ pub fn new_error_with_message<S: Into<MultiSpan>>(
span: S,
msg: &'static str,
) -> Const<'tcx> {
let reported = tcx.sess.delay_span_bug(span, msg);
let reported = tcx.sess.span_delayed_bug(span, msg);
Const::new_error(tcx, reported, ty)
}
@ -208,7 +208,7 @@ fn try_from_lit_or_param(
match tcx.at(expr.span).lit_to_const(lit_input) {
Ok(c) => return Some(c),
Err(e) => {
tcx.sess.delay_span_bug(
tcx.sess.span_delayed_bug(
expr.span,
format!("Const::from_anon_const: couldn't lit_to_const {e:?}"),
);

View File

@ -714,8 +714,10 @@ pub fn layout_scalar_valid_range(self, def_id: DefId) -> (Bound<u128>, Bound<u12
{
Bound::Included(a)
} else {
self.sess
.delay_span_bug(attr.span, "invalid rustc_layout_scalar_valid_range attribute");
self.sess.span_delayed_bug(
attr.span,
"invalid rustc_layout_scalar_valid_range attribute",
);
Bound::Unbounded
}
};

View File

@ -283,7 +283,7 @@ impl<'tcx> LayoutCalculator for LayoutCx<'tcx, TyCtxt<'tcx>> {
type TargetDataLayoutRef = &'tcx TargetDataLayout;
fn delay_bug(&self, txt: String) {
self.tcx.sess.delay_span_bug(DUMMY_SP, txt);
self.tcx.sess.span_delayed_bug(DUMMY_SP, txt);
}
fn current_data_layout(&self) -> Self::TargetDataLayoutRef {

View File

@ -1545,7 +1545,7 @@ pub fn new_error(tcx: TyCtxt<'tcx>, reported: ErrorGuaranteed) -> Region<'tcx> {
tcx.intern_region(ty::ReError(reported))
}
/// Constructs a `RegionKind::ReError` region and registers a `delay_span_bug` to ensure it
/// Constructs a `RegionKind::ReError` region and registers a `span_delayed_bug` to ensure it
/// gets used.
#[track_caller]
pub fn new_error_misc(tcx: TyCtxt<'tcx>) -> Region<'tcx> {
@ -1556,7 +1556,7 @@ pub fn new_error_misc(tcx: TyCtxt<'tcx>) -> Region<'tcx> {
)
}
/// Constructs a `RegionKind::ReError` region and registers a `delay_span_bug` with the given
/// Constructs a `RegionKind::ReError` region and registers a `span_delayed_bug` with the given
/// `msg` to ensure it gets used.
#[track_caller]
pub fn new_error_with_message<S: Into<MultiSpan>>(
@ -1564,7 +1564,7 @@ pub fn new_error_with_message<S: Into<MultiSpan>>(
span: S,
msg: &'static str,
) -> Region<'tcx> {
let reported = tcx.sess.delay_span_bug(span, msg);
let reported = tcx.sess.span_delayed_bug(span, msg);
Region::new_error(tcx, reported)
}
@ -1997,13 +1997,13 @@ pub fn new_error(tcx: TyCtxt<'tcx>, reported: ErrorGuaranteed) -> Ty<'tcx> {
Ty::new(tcx, Error(reported))
}
/// Constructs a `TyKind::Error` type and registers a `delay_span_bug` to ensure it gets used.
/// Constructs a `TyKind::Error` type and registers a `span_delayed_bug` to ensure it gets used.
#[track_caller]
pub fn new_misc_error(tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
Ty::new_error_with_message(tcx, DUMMY_SP, "TyKind::Error constructed but no error reported")
}
/// Constructs a `TyKind::Error` type and registers a `delay_span_bug` with the given `msg` to
/// Constructs a `TyKind::Error` type and registers a `span_delayed_bug` with the given `msg` to
/// ensure it gets used.
#[track_caller]
pub fn new_error_with_message<S: Into<MultiSpan>>(
@ -2011,7 +2011,7 @@ pub fn new_error_with_message<S: Into<MultiSpan>>(
span: S,
msg: impl Into<String>,
) -> Ty<'tcx> {
let reported = tcx.sess.delay_span_bug(span, msg);
let reported = tcx.sess.span_delayed_bug(span, msg);
Ty::new(tcx, Error(reported))
}

View File

@ -391,7 +391,7 @@ pub fn is_method_call(&self, expr: &hir::Expr<'_>) -> bool {
pub fn extract_binding_mode(&self, s: &Session, id: HirId, sp: Span) -> Option<BindingMode> {
self.pat_binding_modes().get(id).copied().or_else(|| {
s.delay_span_bug(sp, "missing binding mode");
s.span_delayed_bug(sp, "missing binding mode");
None
})
}

View File

@ -361,7 +361,7 @@ pub fn calculate_dtor(
let Some(item_id) = self.associated_item_def_ids(impl_did).first() else {
self.sess
.delay_span_bug(self.def_span(impl_did), "Drop impl without drop function");
.span_delayed_bug(self.def_span(impl_did), "Drop impl without drop function");
return;
};

View File

@ -38,16 +38,16 @@ fn opt_span_bug_fmt<S: Into<MultiSpan>>(
})
}
/// A query to trigger a `delay_span_bug`. Clearly, if one has a `tcx` one can already trigger a
/// `delay_span_bug`, so what is the point of this? It exists to help us test `delay_span_bug`'s
/// A query to trigger a `span_delayed_bug`. Clearly, if one has a `tcx` one can already trigger a
/// `span_delayed_bug`, so what is the point of this? It exists to help us test `span_delayed_bug`'s
/// interactions with the query system and incremental.
pub fn trigger_delay_span_bug(tcx: TyCtxt<'_>, key: rustc_hir::def_id::DefId) {
tcx.sess.delay_span_bug(
pub fn trigger_span_delayed_bug(tcx: TyCtxt<'_>, key: rustc_hir::def_id::DefId) {
tcx.sess.span_delayed_bug(
tcx.def_span(key),
"delayed span bug triggered by #[rustc_error(delay_span_bug_from_inside_query)]",
"delayed span bug triggered by #[rustc_error(span_delayed_bug_from_inside_query)]",
);
}
pub fn provide(providers: &mut crate::query::Providers) {
*providers = crate::query::Providers { trigger_delay_span_bug, ..*providers };
*providers = crate::query::Providers { trigger_span_delayed_bug, ..*providers };
}

View File

@ -114,7 +114,7 @@ fn lit_to_mir_constant<'tcx>(
let width = tcx
.layout_of(param_ty)
.map_err(|_| {
LitToConstError::Reported(tcx.sess.delay_span_bug(
LitToConstError::Reported(tcx.sess.span_delayed_bug(
DUMMY_SP,
format!("couldn't compute width of literal: {:?}", lit_input.lit),
))
@ -158,7 +158,7 @@ fn lit_to_mir_constant<'tcx>(
}
(ast::LitKind::Float(n, _), ty::Float(fty)) => parse_float_into_constval(*n, *fty, neg)
.ok_or_else(|| {
LitToConstError::Reported(tcx.sess.delay_span_bug(
LitToConstError::Reported(tcx.sess.span_delayed_bug(
DUMMY_SP,
format!("couldn't parse float literal: {:?}", lit_input.lit),
))
@ -167,7 +167,7 @@ fn lit_to_mir_constant<'tcx>(
(ast::LitKind::Char(c), ty::Char) => ConstValue::Scalar(Scalar::from_char(*c)),
(ast::LitKind::Err, _) => {
return Err(LitToConstError::Reported(
tcx.sess.delay_span_bug(DUMMY_SP, "encountered LitKind::Err during mir build"),
tcx.sess.span_delayed_bug(DUMMY_SP, "encountered LitKind::Err during mir build"),
));
}
_ => return Err(LitToConstError::TypeError),

View File

@ -470,7 +470,7 @@ fn visit_expr(&mut self, expr: &Expr<'tcx>) {
if let Some((assigned_ty, assignment_span)) = self.assignment_info {
if assigned_ty.needs_drop(self.tcx, self.param_env) {
// This would be unsafe, but should be outright impossible since we reject such unions.
self.tcx.sess.delay_span_bug(assignment_span, format!("union fields that need dropping should be impossible: {assigned_ty}"));
self.tcx.sess.span_delayed_bug(assignment_span, format!("union fields that need dropping should be impossible: {assigned_ty}"));
}
} else {
self.requires_unsafe(expr.span, AccessToUnionField);

View File

@ -16,7 +16,7 @@ pub(crate) fn lit_to_const<'tcx>(
let width = tcx
.layout_of(param_ty)
.map_err(|_| {
LitToConstError::Reported(tcx.sess.delay_span_bug(
LitToConstError::Reported(tcx.sess.span_delayed_bug(
DUMMY_SP,
format!("couldn't compute width of literal: {:?}", lit_input.lit),
))
@ -62,7 +62,7 @@ pub(crate) fn lit_to_const<'tcx>(
(ast::LitKind::Float(n, _), ty::Float(fty)) => {
let bits = parse_float_into_scalar(*n, *fty, neg)
.ok_or_else(|| {
LitToConstError::Reported(tcx.sess.delay_span_bug(
LitToConstError::Reported(tcx.sess.span_delayed_bug(
DUMMY_SP,
format!("couldn't parse float literal: {:?}", lit_input.lit),
))
@ -73,7 +73,7 @@ pub(crate) fn lit_to_const<'tcx>(
(ast::LitKind::Char(c), ty::Char) => ty::ValTree::from_scalar_int((*c).into()),
(ast::LitKind::Err, _) => {
return Err(LitToConstError::Reported(
tcx.sess.delay_span_bug(DUMMY_SP, "encountered LitKind::Err during mir build"),
tcx.sess.span_delayed_bug(DUMMY_SP, "encountered LitKind::Err during mir build"),
));
}
_ => return Err(LitToConstError::TypeError),

View File

@ -108,7 +108,7 @@ fn lower_pattern_range_endpoint(
let msg = format!(
"found bad range pattern endpoint `{expr:?}` outside of error recovery"
);
return Err(self.tcx.sess.delay_span_bug(expr.span, msg));
return Err(self.tcx.sess.span_delayed_bug(expr.span, msg));
};
Ok((Some(PatRangeBoundary::Finite(value)), ascr, inline_const))
}
@ -178,7 +178,7 @@ fn lower_pattern_range(
) -> Result<PatKind<'tcx>, ErrorGuaranteed> {
if lo_expr.is_none() && hi_expr.is_none() {
let msg = format!("found twice-open range pattern (`..`) outside of error recovery");
return Err(self.tcx.sess.delay_span_bug(span, msg));
return Err(self.tcx.sess.span_delayed_bug(span, msg));
}
let (lo, lo_ascr, lo_inline) = self.lower_pattern_range_endpoint(lo_expr)?;

View File

@ -242,7 +242,7 @@ fn visit_place(&mut self, place: &Place<'tcx>, context: PlaceContext, _location:
let assigned_ty = place.ty(&self.body.local_decls, self.tcx).ty;
if assigned_ty.needs_drop(self.tcx, self.param_env) {
// This would be unsafe, but should be outright impossible since we reject such unions.
self.tcx.sess.delay_span_bug(
self.tcx.sess.span_delayed_bug(
self.source_info.span,
format!("union fields that need dropping should be impossible: {assigned_ty}")
);

View File

@ -1510,8 +1510,10 @@ fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
(args.discr_ty(tcx), movability == hir::Movability::Movable)
}
_ => {
tcx.sess
.delay_span_bug(body.span, format!("unexpected coroutine type {coroutine_ty}"));
tcx.sess.span_delayed_bug(
body.span,
format!("unexpected coroutine type {coroutine_ty}"),
);
return;
}
};

View File

@ -316,7 +316,7 @@ fn collect_drop_flags(&mut self) {
self.init_data.seek_before(self.body.terminator_loc(bb));
let (_maybe_live, maybe_dead) = self.init_data.maybe_live_dead(parent);
if maybe_dead {
self.tcx.sess.delay_span_bug(
self.tcx.sess.span_delayed_bug(
terminator.source_info.span,
format!(
"drop of untracked, uninitialized value {bb:?}, place {place:?} ({path:?})"
@ -381,7 +381,7 @@ fn elaborate_drops(&mut self) {
LookupResult::Parent(None) => {}
LookupResult::Parent(Some(_)) => {
if !replace {
self.tcx.sess.delay_span_bug(
self.tcx.sess.span_delayed_bug(
terminator.source_info.span,
format!("drop of untracked value {bb:?}"),
);

View File

@ -266,7 +266,7 @@ fn mir_const_qualif(tcx: TyCtxt<'_>, def: LocalDefId) -> ConstQualifs {
let body = &tcx.mir_const(def).borrow();
if body.return_ty().references_error() {
tcx.sess.delay_span_bug(body.span, "mir_const_qualif: MIR had errors");
tcx.sess.span_delayed_bug(body.span, "mir_const_qualif: MIR had errors");
return Default::default();
}

View File

@ -41,7 +41,7 @@ pub fn empty() -> AttrWrapper {
}
pub(crate) fn take_for_recovery(self, sess: &ParseSess) -> AttrVec {
sess.span_diagnostic.delay_span_bug(
sess.span_diagnostic.span_delayed_bug(
self.attrs.get(0).map(|attr| attr.span).unwrap_or(DUMMY_SP),
"AttrVec is taken for recovery but no error is produced",
);
@ -268,7 +268,7 @@ pub fn collect_tokens_trailing_token<R: HasAttrs + HasTokens>(
} else {
self.sess
.span_diagnostic
.delay_span_bug(inner_attr.span, "Missing token range for attribute");
.span_delayed_bug(inner_attr.span, "Missing token range for attribute");
}
}

View File

@ -31,7 +31,7 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
if !errors.is_empty() {
let message = errors.iter().fold(String::new(), |s1, s2| s1 + "\n" + s2);
tcx.sess.delay_span_bug(rustc_span::DUMMY_SP, message);
tcx.sess.span_delayed_bug(rustc_span::DUMMY_SP, message);
}
}
}

View File

@ -592,7 +592,7 @@ fn assigned_on_exit(&self, ln: LiveNode, var: Variable) -> bool {
match self.successors[ln] {
Some(successor) => self.assigned_on_entry(successor, var),
None => {
self.ir.tcx.sess.delay_span_bug(DUMMY_SP, "no successor");
self.ir.tcx.sess.span_delayed_bug(DUMMY_SP, "no successor");
true
}
}

View File

@ -1268,7 +1268,7 @@ fn visit_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) {
} else {
self.tcx
.sess
.delay_span_bug(expr.span, "no type-dependent def for method call");
.span_delayed_bug(expr.span, "no type-dependent def for method call");
}
}
_ => {}
@ -1843,7 +1843,7 @@ fn local_visibility(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Visibility {
..
}) => tr.path.res.opt_def_id().map_or_else(
|| {
tcx.sess.delay_span_bug(tr.path.span, "trait without a def-id");
tcx.sess.span_delayed_bug(tr.path.span, "trait without a def-id");
ty::Visibility::Public
},
|def_id| tcx.visibility(def_id).expect_local(),

View File

@ -138,7 +138,7 @@ fn handle_cycle_error<Q, Qcx>(
&& let Some(span) = root.query.span
{
error.stash(span, StashKey::Cycle);
qcx.dep_context().sess().delay_span_bug(span, "delayed cycle error")
qcx.dep_context().sess().span_delayed_bug(span, "delayed cycle error")
} else {
error.emit()
};
@ -421,7 +421,7 @@ fn execute_job<Q, Qcx, const INCR: bool>(
// We have an inconsistency. This can happen if one of the two
// results is tainted by errors. In this case, delay a bug to
// ensure compilation is doomed.
qcx.dep_context().sess().delay_span_bug(
qcx.dep_context().sess().span_delayed_bug(
DUMMY_SP,
format!(
"Computed query value for {:?}({:?}) is inconsistent with fed value,\n\

View File

@ -1201,7 +1201,7 @@ fn validate_res_from_ribs(
}
};
self.report_error(span, error);
self.tcx.sess.delay_span_bug(span, CG_BUG_STR);
self.tcx.sess.span_delayed_bug(span, CG_BUG_STR);
}
return Res::Err;

View File

@ -1059,7 +1059,7 @@ fn finalize_import(&mut self, import: Import<'a>) -> Option<UnresolvedImportErro
if res == Res::Err || has_ambiguity_error {
this.tcx
.sess
.delay_span_bug(import.span, "some error happened for an import");
.span_delayed_bug(import.span, "some error happened for an import");
return;
}
if let Ok(initial_res) = initial_res {

View File

@ -3544,7 +3544,7 @@ fn try_resolve_as_non_binding(
Res::SelfCtor(_) => {
// We resolve `Self` in pattern position as an ident sometimes during recovery,
// so delay a bug instead of ICEing.
self.r.tcx.sess.delay_span_bug(
self.r.tcx.sess.span_delayed_bug(
ident.span,
"unexpected `SelfCtor` in pattern, expected identifier"
);

View File

@ -710,7 +710,7 @@ pub(crate) fn finalize_macro_resolutions(&mut self, krate: &Crate) {
// Make sure compilation does not succeed if preferred macro resolution
// has changed after the macro had been expanded. In theory all such
// situations should be reported as errors, so this is a bug.
this.tcx.sess.delay_span_bug(span, "inconsistent resolution for a macro");
this.tcx.sess.span_delayed_bug(span, "inconsistent resolution for a macro");
}
} else {
// It's possible that the macro was unresolved (indeterminate) and silently

View File

@ -1813,7 +1813,7 @@ pub(crate) fn parse_function_return(slot: &mut FunctionReturn, v: Option<&str>)
"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 @@ pub fn track_errors<F, T>(&self, f: F) -> Result<T, ErrorGuaranteed>
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 @@ pub fn warn(&self, msg: impl Into<DiagnosticMessage>) {
///
/// 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

View File

@ -2247,7 +2247,7 @@ fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
impl ErrorGuaranteed {
/// To be used only if you really know what you are doing... ideally, we would find a way to
/// eliminate all calls to this method.
#[deprecated = "`Session::delay_span_bug` should be preferred over this function"]
#[deprecated = "`Session::span_delayed_bug` should be preferred over this function"]
pub fn unchecked_claim_error_was_emitted() -> Self {
ErrorGuaranteed(())
}

View File

@ -641,7 +641,6 @@
default_method_body_is_const,
default_type_parameter_fallback,
default_type_params,
delay_span_bug_from_inside_query,
deny,
deprecated,
deprecated_safe,
@ -1557,6 +1556,7 @@
slice_patterns,
slicing_syntax,
soft,
span_delayed_bug_from_inside_query,
specialization,
speed,
spotlight,

Some files were not shown because too many files have changed in this diff Show More