1
Fork 0

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

@ -196,7 +196,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
};
let error_response = |ecx: &mut EvalCtxt<'_, 'tcx>, reason| {
let guar = tcx.sess.delay_span_bug(tcx.def_span(assoc_def.item.def_id), reason);
let guar = tcx.sess.span_delayed_bug(tcx.def_span(assoc_def.item.def_id), reason);
let error_term = match assoc_def.item.kind {
ty::AssocKind::Const => ty::Const::new_error(
tcx,
@ -286,7 +286,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
ecx: &mut EvalCtxt<'_, 'tcx>,
goal: Goal<'tcx, Self>,
) -> QueryResult<'tcx> {
ecx.tcx().sess.delay_span_bug(
ecx.tcx().sess.span_delayed_bug(
ecx.tcx().def_span(goal.predicate.def_id()),
"associated types not allowed on auto traits",
);

View file

@ -65,7 +65,7 @@ pub fn is_const_evaluatable<'tcx>(
// FIXME(generic_const_exprs): we have a `ConstKind::Expr` which is fully concrete, but
// currently it is not possible to evaluate `ConstKind::Expr` so we are unable to tell if it
// is evaluatable or not. For now we just ICE until this is implemented.
Err(NotConstEvaluatable::Error(tcx.sess.delay_span_bug(
Err(NotConstEvaluatable::Error(tcx.sess.span_delayed_bug(
span,
"evaluating `ConstKind::Expr` is not currently supported",
)))
@ -74,7 +74,7 @@ pub fn is_const_evaluatable<'tcx>(
let concrete = infcx.const_eval_resolve(param_env, uv, Some(span));
match concrete {
Err(ErrorHandled::TooGeneric(_)) => {
Err(NotConstEvaluatable::Error(infcx.tcx.sess.delay_span_bug(
Err(NotConstEvaluatable::Error(infcx.tcx.sess.span_delayed_bug(
span,
"Missing value for constant, but no error reported?",
)))
@ -138,10 +138,10 @@ pub fn is_const_evaluatable<'tcx>(
} else if uv.has_non_region_param() {
NotConstEvaluatable::MentionsParam
} else {
let guar = infcx
.tcx
.sess
.delay_span_bug(span, "Missing value for constant, but no error reported?");
let guar = infcx.tcx.sess.span_delayed_bug(
span,
"Missing value for constant, but no error reported?",
);
NotConstEvaluatable::Error(guar)
};

View file

@ -677,8 +677,9 @@ impl<'tcx> OnUnimplementedDirective {
Ok(None)
} else {
let reported =
tcx.sess.delay_span_bug(DUMMY_SP, "of_item: neither meta_item_list nor value_str");
let reported = tcx
.sess
.span_delayed_bug(DUMMY_SP, "of_item: neither meta_item_list nor value_str");
return Err(reported);
};
debug!("of_item({:?}) = {:?}", item_def_id, result);

View file

@ -218,7 +218,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
}
}
self.tcx.sess.delay_span_bug(DUMMY_SP, "expected fulfillment errors")
self.tcx.sess.span_delayed_bug(DUMMY_SP, "expected fulfillment errors")
}
/// Reports that an overflow has occurred and halts compilation. We
@ -369,7 +369,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
let mut span = obligation.cause.span;
// FIXME: statically guarantee this by tainting after the diagnostic is emitted
self.set_tainted_by_errors(
tcx.sess.delay_span_bug(span, "`report_selection_error` did not emit an error"),
tcx.sess.span_delayed_bug(span, "`report_selection_error` did not emit an error"),
);
let mut err = match *error {

View file

@ -173,7 +173,7 @@ pub fn all_fields_implement_trait<'tcx>(
// between expected and found const-generic types. Don't report an
// additional copy error here, since it's not typically useful.
if !normalization_errors.is_empty() || ty.references_error() {
tcx.sess.delay_span_bug(field_span, format!("couldn't normalize struct field `{unnormalized_ty}` when checking {tr} implementation", tr = tcx.def_path_str(trait_def_id)));
tcx.sess.span_delayed_bug(field_span, format!("couldn't normalize struct field `{unnormalized_ty}` when checking {tr} implementation", tr = tcx.def_path_str(trait_def_id)));
continue;
}

View file

@ -215,7 +215,7 @@ fn do_normalize_predicates<'tcx>(
// the normalized predicates.
let errors = infcx.resolve_regions(&outlives_env);
if !errors.is_empty() {
tcx.sess.delay_span_bug(
tcx.sess.span_delayed_bug(
span,
format!("failed region resolution while normalizing {elaborated_env:?}: {errors:?}"),
);

View file

@ -509,7 +509,7 @@ fn virtual_call_violations_for_method<'tcx>(
Ok(layout) => Some(layout.abi),
Err(err) => {
// #78372
tcx.sess.delay_span_bug(
tcx.sess.span_delayed_bug(
tcx.def_span(method.def_id),
format!("error: {err}\n while computing layout for type {ty:?}"),
);
@ -525,7 +525,7 @@ fn virtual_call_violations_for_method<'tcx>(
match abi_of_ty(unit_receiver_ty) {
Some(Abi::Scalar(..)) => (),
abi => {
tcx.sess.delay_span_bug(
tcx.sess.span_delayed_bug(
tcx.def_span(method.def_id),
format!(
"receiver when `Self = ()` should have a Scalar ABI; found {abi:?}"
@ -543,7 +543,7 @@ fn virtual_call_violations_for_method<'tcx>(
match abi_of_ty(trait_object_receiver) {
Some(Abi::ScalarPair(..)) => (),
abi => {
tcx.sess.delay_span_bug(
tcx.sess.span_delayed_bug(
tcx.def_span(method.def_id),
format!(
"receiver when `Self = {trait_object_ty}` should have a ScalarPair ABI; found {abi:?}"
@ -597,7 +597,7 @@ fn virtual_call_violations_for_method<'tcx>(
if pred_trait_ref.args.len() != 1 {
tcx.sess
.diagnostic()
.delay_span_bug(span, "auto traits cannot have generic parameters");
.span_delayed_bug(span, "auto traits cannot have generic parameters");
}
return false;
}

View file

@ -111,7 +111,7 @@ impl<'a, 'tcx: 'a> InferCtxtExt<'a, 'tcx> for InferCtxt<'tcx> {
let errors = ocx.select_all_or_error();
if !errors.is_empty() {
self.tcx.sess.delay_span_bug(
self.tcx.sess.span_delayed_bug(
span,
"implied_outlives_bounds failed to solve obligations from instantiation",
);

View file

@ -1469,7 +1469,7 @@ pub fn compute_inherent_assoc_ty_args<'a, 'b, 'tcx>(
match selcx.infcx.at(&cause, param_env).eq(DefineOpaqueTypes::No, impl_ty, self_ty) {
Ok(mut ok) => obligations.append(&mut ok.obligations),
Err(_) => {
tcx.sess.delay_span_bug(
tcx.sess.span_delayed_bug(
cause.span,
format!(
"{self_ty:?} was a subtype of {impl_ty:?} during selection but now it is not"
@ -1974,7 +1974,7 @@ fn assemble_candidates_from_impls<'cx, 'tcx>(
ImplSource::Builtin(BuiltinImplSource::TraitUpcasting { .. }, _)
| ImplSource::Builtin(BuiltinImplSource::TupleUnsizing, _) => {
// These traits have no associated types.
selcx.tcx().sess.delay_span_bug(
selcx.tcx().sess.span_delayed_bug(
obligation.cause.span,
format!("Cannot project an associated type from `{impl_source:?}`"),
);

View file

@ -237,7 +237,7 @@ pub fn dtorck_constraint_for_ty_inner<'tcx>(
// By the time this code runs, all type variables ought to
// be fully resolved.
tcx.sess.delay_span_bug(
tcx.sess.span_delayed_bug(
span,
format!("upvar_tys for closure not found. Expected capture information for closure {ty}",),
);
@ -286,7 +286,7 @@ pub fn dtorck_constraint_for_ty_inner<'tcx>(
if !args.is_valid() {
// By the time this code runs, all type variables ought to
// be fully resolved.
tcx.sess.delay_span_bug(
tcx.sess.span_delayed_bug(
span,
format!("upvar_tys for coroutine not found. Expected capture information for coroutine {ty}",),
);

View file

@ -292,7 +292,7 @@ impl<'cx, 'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for QueryNormalizer<'cx, 'tcx>
// Rustdoc normalizes possibly not well-formed types, so only
// treat this as a bug if we're not in rustdoc.
if !tcx.sess.opts.actually_rustdoc {
tcx.sess.delay_span_bug(
tcx.sess.span_delayed_bug(
DUMMY_SP,
format!("unexpected ambiguity: {c_data:?} {result:?}"),
);

View file

@ -82,13 +82,13 @@ where
let value = infcx.commit_if_ok(|_| {
let ocx = ObligationCtxt::new(infcx);
let value = op(&ocx).map_err(|_| {
infcx.tcx.sess.delay_span_bug(span, format!("error performing operation: {name}"))
infcx.tcx.sess.span_delayed_bug(span, format!("error performing operation: {name}"))
})?;
let errors = ocx.select_all_or_error();
if errors.is_empty() {
Ok(value)
} else {
Err(infcx.tcx.sess.delay_span_bug(
Err(infcx.tcx.sess.span_delayed_bug(
DUMMY_SP,
format!("errors selecting obligation during MIR typeck: {errors:?}"),
))

View file

@ -160,14 +160,14 @@ where
let (output, error_info, mut obligations) =
Q::fully_perform_into(self, infcx, &mut region_constraints)
.map_err(|_| {
infcx.tcx.sess.delay_span_bug(span, format!("error performing {self:?}"))
infcx.tcx.sess.span_delayed_bug(span, format!("error performing {self:?}"))
})
.and_then(|(output, error_info, obligations, certainty)| match certainty {
Certainty::Proven => Ok((output, error_info, obligations)),
Certainty::Ambiguous => Err(infcx
.tcx
.sess
.delay_span_bug(span, format!("ambiguity performing {self:?}"))),
.span_delayed_bug(span, format!("ambiguity performing {self:?}"))),
})?;
// Typically, instantiating NLL query results does not
@ -196,7 +196,7 @@ where
}
}
if !progress {
return Err(infcx.tcx.sess.delay_span_bug(
return Err(infcx.tcx.sess.span_delayed_bug(
span,
format!("ambiguity processing {obligations:?} from {self:?}"),
));

View file

@ -553,7 +553,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
let defs: &ty::Generics = tcx.generics_of(assoc_type);
if !defs.params.is_empty() && !tcx.features().generic_associated_types_extended {
tcx.sess.delay_span_bug(
tcx.sess.span_delayed_bug(
obligation.cause.span,
"GATs in trait object shouldn't have been considered",
);

View file

@ -2419,7 +2419,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
// the placeholder trait ref may fail due the Generalizer relation
// raising a CyclicalTy error due to a sub_root_var relation
// for a variable being generalized...
let guar = self.infcx.tcx.sess.delay_span_bug(
let guar = self.infcx.tcx.sess.span_delayed_bug(
obligation.cause.span,
format!(
"Impl {impl_def_id:?} was matchable against {obligation:?} but now is not"

View file

@ -202,7 +202,7 @@ fn fulfill_implication<'tcx>(
{
Ok(source_trait_ref) => source_trait_ref,
Err(_errors) => {
infcx.tcx.sess.delay_span_bug(
infcx.tcx.sess.span_delayed_bug(
infcx.tcx.def_span(source_impl),
format!("failed to fully normalize {source_trait_ref}"),
);
@ -431,7 +431,10 @@ fn report_conflicting_impls<'tcx>(
decorate(tcx, &overlap, impl_span, &mut err);
Some(err.emit())
} else {
Some(tcx.sess.delay_span_bug(impl_span, "impl should have failed the orphan check"))
Some(
tcx.sess
.span_delayed_bug(impl_span, "impl should have failed the orphan check"),
)
};
sg.has_errored = reported;
}

View file

@ -135,7 +135,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for Search<'tcx> {
bug!("unexpected type during structural-match checking: {:?}", ty);
}
ty::Error(_) => {
self.tcx.sess.delay_span_bug(self.span, "ty::Error in structural-match check");
self.tcx.sess.span_delayed_bug(self.span, "ty::Error in structural-match check");
// We still want to check other types after encountering an error,
// as this may still emit relevant errors.
return ControlFlow::Continue(());