File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
tests/ui/const-generics/occurs-check Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 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 ( ) { }
You can’t perform that action at this time.
0 commit comments