forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
tests/ui/const-generics/occurs-check/param-env-eager-norm-dedup.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() {} |