-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only make GAT ambiguous in match_projection_projections considering s…
…hallow resolvability
- Loading branch information
1 parent
ddba1dc
commit 3518606
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
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
18 changes: 18 additions & 0 deletions
18
tests/ui/generic-associated-types/guide-inference-in-gat-arg-deeper.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,18 @@ | ||
// Fix for <https://github.com/rust-lang/rust/issues/125196>. | ||
|
||
trait Tr { | ||
type Gat<T>; | ||
} | ||
|
||
struct W<T>(T); | ||
|
||
fn foo<T: Tr>() where for<'a> &'a T: Tr<Gat<W<i32>> = i32> { | ||
let x: <&T as Tr>::Gat<W<_>> = 1i32; | ||
// Previously, `match_projection_projections` only checked that | ||
// `shallow_resolve(W<?0>) = W<?0>`. This won't prevent *all* inference guidance | ||
// from projection predicates in the environment, just ones that guide the | ||
// outermost type of each GAT constructor. This is definitely wrong, but there is | ||
// code that relies on it in the wild :/ | ||
} | ||
|
||
fn main() {} |