Skip to content

Commit 2090bf2

Browse files
committed
add test
1 parent 88cb279 commit 2090bf2

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//@ check-pass
2+
3+
// This caused a regression in a crater run in #132325.
4+
//
5+
// The underlying issue is a really subtle implementation detail.
6+
//
7+
// When building the `param_env` for `Trait` we start out with its
8+
// explicit predicates `Self: Trait` and `Self: for<'a> Super<'a, { 1 + 1 }>`.
9+
//
10+
// When normalizing the environment we also elaborate. This implicitly
11+
// deduplicates its returned predicates. We currently first eagerly
12+
// normalize constants in the unnormalized param env to avoid issues
13+
// caused by our lack of deferred alias equality.
14+
//
15+
// So we actually elaborate `Self: Trait` and `Self: for<'a> Super<'a, 2>`,
16+
// resulting in a third `Self: for<'a> Super<'a, { 1 + 1 }>` predicate which
17+
// then gets normalized to `Self: for<'a> Super<'a, 2>` at which point we
18+
// do not deduplicate however. By failing to handle equal where-bounds in
19+
// candidate selection, this caused ambiguity when checking that `Trait` is
20+
// well-formed.
21+
trait Super<'a, const N: usize> {}
22+
trait Trait: for<'a> Super<'a, { 1 + 1 }> {}
23+
fn main() {}

0 commit comments

Comments
 (0)