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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user