about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-02-16 05:40:46 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-02-27 16:09:14 +1100
commit2fc94cefc5b784011e276a8d7893cc05e84dcdaa (patch)
tree64e7509de7bdb73e5c44e4de788e8e55c10e2ca7
parent829308e9af1a1f55540d2c8b0e007e1d0cb9c8c6 (diff)
downloadrust-2fc94cefc5b784011e276a8d7893cc05e84dcdaa.tar.gz
rust-2fc94cefc5b784011e276a8d7893cc05e84dcdaa.zip
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.
-rw-r--r--compiler/rustc_borrowck/src/type_check/free_region_relations.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/compiler/rustc_borrowck/src/type_check/free_region_relations.rs b/compiler/rustc_borrowck/src/type_check/free_region_relations.rs
index 897918fb0a4..86d20599a2a 100644
--- a/compiler/rustc_borrowck/src/type_check/free_region_relations.rs
+++ b/compiler/rustc_borrowck/src/type_check/free_region_relations.rs
@@ -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.