Skip to content

Commit 8e7613f

Browse files
committed
Only add_implied_bounds for norm_ty if different
1 parent c49b076 commit 8e7613f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

compiler/rustc_borrowck/src/type_check/free_region_relations.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ impl UniversalRegionRelationsBuilder<'cx, 'tcx> {
259259
// We add implied bounds from both the unnormalized and normalized ty
260260
// See issue #87748
261261
let constraints_implied_1 = self.add_implied_bounds(ty);
262-
let TypeOpOutput { output: ty, constraints: constraints1, .. } = self
262+
let TypeOpOutput { output: norm_ty, constraints: constraints1, .. } = self
263263
.param_env
264264
.and(type_op::normalize::Normalize::new(ty))
265265
.fully_perform(self.infcx)
@@ -286,8 +286,9 @@ impl UniversalRegionRelationsBuilder<'cx, 'tcx> {
286286
// }
287287
// ```
288288
// Both &Self::Bar and &() are WF
289-
let constraints_implied_2 = self.add_implied_bounds(ty);
290-
normalized_inputs_and_output.push(ty);
289+
let constraints_implied_2 =
290+
if ty != norm_ty { self.add_implied_bounds(norm_ty) } else { None };
291+
normalized_inputs_and_output.push(norm_ty);
291292
constraints1.into_iter().chain(constraints_implied_1).chain(constraints_implied_2)
292293
})
293294
.collect();

0 commit comments

Comments
 (0)