Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Nov 7, 2024
1 parent 88cb279 commit 2090bf2
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/ui/const-generics/occurs-check/param-env-eager-norm-dedup.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//@ check-pass

// This caused a regression in a crater run in #132325.
//
// The underlying issue is a really subtle implementation detail.
//
// When building the `param_env` for `Trait` we start out with its
// explicit predicates `Self: Trait` and `Self: for<'a> Super<'a, { 1 + 1 }>`.
//
// When normalizing the environment we also elaborate. This implicitly
// deduplicates its returned predicates. We currently first eagerly
// normalize constants in the unnormalized param env to avoid issues
// caused by our lack of deferred alias equality.
//
// So we actually elaborate `Self: Trait` and `Self: for<'a> Super<'a, 2>`,
// resulting in a third `Self: for<'a> Super<'a, { 1 + 1 }>` predicate which
// then gets normalized to `Self: for<'a> Super<'a, 2>` at which point we
// do not deduplicate however. By failing to handle equal where-bounds in
// candidate selection, this caused ambiguity when checking that `Trait` is
// well-formed.
trait Super<'a, const N: usize> {}
trait Trait: for<'a> Super<'a, { 1 + 1 }> {}
fn main() {}

0 comments on commit 2090bf2

Please sign in to comment.