Skip to content

Commit a4606f5

Browse files
committed
Remove two unnecessary span_delayed_bug calls.
In both cases, the existing code calls a function that returns `Result<_, ErrorGuaranteed>`, and then calls `span_delayed_bug` pointlessly in the `Err` case. This commits removes those calls.
1 parent bb59453 commit a4606f5

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

compiler/rustc_borrowck/src/type_check/free_region_relations.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,14 +311,14 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
311311
// Add implied bounds from impl header.
312312
if matches!(tcx.def_kind(defining_ty_def_id), DefKind::AssocFn | DefKind::AssocConst) {
313313
for &(ty, _) in tcx.assumed_wf_types(tcx.local_parent(defining_ty_def_id)) {
314-
let Ok(TypeOpOutput { output: norm_ty, constraints: c, .. }) = self
314+
let result: Result<_, ErrorGuaranteed> = self
315315
.param_env
316316
.and(type_op::normalize::Normalize::new(ty))
317-
.fully_perform(self.infcx, span)
318-
else {
319-
tcx.dcx().span_delayed_bug(span, format!("failed to normalize {ty:?}"));
317+
.fully_perform(self.infcx, span);
318+
let Ok(TypeOpOutput { output: norm_ty, constraints: c, .. }) = result else {
320319
continue;
321320
};
321+
322322
constraints.extend(c);
323323

324324
// We currently add implied bounds from the normalized ty only.

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
10541054
});
10551055

10561056
let param_env = self.param_env;
1057-
let result = self.fully_perform_op(
1057+
let _: Result<_, ErrorGuaranteed> = self.fully_perform_op(
10581058
Locations::All(self.body.span),
10591059
ConstraintCategory::OpaqueType,
10601060
CustomTypeOp::new(
@@ -1087,13 +1087,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
10871087
"register pre-defined opaques",
10881088
),
10891089
);
1090-
1091-
if result.is_err() {
1092-
self.infcx.dcx().span_delayed_bug(
1093-
self.body.span,
1094-
"failed re-defining predefined opaques in mir typeck",
1095-
);
1096-
}
10971090
}
10981091

10991092
fn body(&self) -> &Body<'tcx> {

0 commit comments

Comments
 (0)