Convert delayed_bugs to bugs.

I have a suspicion that quite a few delayed bug paths are impossible to
reach, so I did an experiment.

I converted every `delayed_bug` to a `bug`, ran the full test suite,
then converted back every `bug` that was hit. A surprising number were
never hit.

The next commit will convert some more back, based on human judgment.
This commit is contained in:
Nicholas Nethercote 2024-02-17 01:23:40 +11:00
parent bb594538fc
commit 010f3944e0
44 changed files with 87 additions and 157 deletions

View file

@ -645,7 +645,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.dcx().span_delayed_bug(
tcx.dcx().span_bug(
cause.span,
format!(
"{self_ty:?} was a subtype of {impl_ty:?} during selection but now it is not"
@ -1190,11 +1190,10 @@ fn assemble_candidates_from_impls<'cx, 'tcx>(
ImplSource::Builtin(BuiltinImplSource::TraitUpcasting { .. }, _)
| ImplSource::Builtin(BuiltinImplSource::TupleUnsizing, _) => {
// These traits have no associated types.
selcx.tcx().dcx().span_delayed_bug(
selcx.tcx().dcx().span_bug(
obligation.cause.span,
format!("Cannot project an associated type from `{impl_source:?}`"),
);
return Err(());
}
};