Remove an unnecessary span_delayed_bug call.

The existing code calls a function that returns `Result<_,
ErrorGuaranteed>`, and then calls `span_delayed_bug` pointlessly in the
`Err` case.
This commit is contained in:
Nicholas Nethercote 2024-02-16 05:40:46 +11:00
parent 829308e9af
commit 2fc94cefc5

View File

@ -311,17 +311,14 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
// Add implied bounds from impl header.
if matches!(tcx.def_kind(defining_ty_def_id), DefKind::AssocFn | DefKind::AssocConst) {
for &(ty, _) in tcx.assumed_wf_types(tcx.local_parent(defining_ty_def_id)) {
let Ok(TypeOpOutput { output: norm_ty, constraints: c, .. }) = self
let result: Result<_, ErrorGuaranteed> = self
.param_env
.and(type_op::normalize::Normalize::new(ty))
.fully_perform(self.infcx, span)
else {
// Note: this path is currently not reached in any test, so
// any example that triggers this would be worth minimizing
// and converting into a test.
tcx.dcx().span_delayed_bug(span, format!("failed to normalize {ty:?}"));
.fully_perform(self.infcx, span);
let Ok(TypeOpOutput { output: norm_ty, constraints: c, .. }) = result else {
continue;
};
constraints.extend(c);
// We currently add implied bounds from the normalized ty only.