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:
parent
57d6f840b9
commit
5d1d384443
131 changed files with 309 additions and 278 deletions
|
@ -720,9 +720,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
// 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 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
// 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 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
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)
|
||||
}
|
||||
|
|
|
@ -325,7 +325,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
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`",
|
||||
);
|
||||
|
|
|
@ -130,7 +130,7 @@ fn check_union_fields(tcx: TyCtxt<'_>, span: Span, item_def_id: LocalDefId) -> b
|
|||
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 check_union_fields(tcx: TyCtxt<'_>, span: Span, item_def_id: LocalDefId) -> b
|
|||
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 {
|
||||
|
|
|
@ -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 @@ impl<'tcx> ty::FallibleTypeFolder<TyCtxt<'tcx>> for RemapHiddenTyRegions<'tcx> {
|
|||
.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",
|
||||
));
|
||||
|
|
|
@ -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)",
|
||||
);
|
||||
|
|
|
@ -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}"),
|
||||
);
|
||||
|
|
|
@ -281,7 +281,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
|
|||
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() {
|
||||
|
|
|
@ -118,10 +118,10 @@ where
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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",
|
||||
);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -335,7 +335,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
|
|||
// 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 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
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 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
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 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
|
|||
} 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 is_late_bound_map(
|
|||
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:?}"
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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:?}",
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue