-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
handle global trait bounds defining assoc type
- Loading branch information
Showing
2 changed files
with
43 additions
and
2 deletions.
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
21 changes: 21 additions & 0 deletions
21
tests/ui/traits/next-solver/normalization-shadowing/global-trait-with-project.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,21 @@ | ||
//@ compile-flags: -Znext-solver | ||
//@ check-pass | ||
|
||
// `(): Trait` is a global where-bound with a projection bound. | ||
// This previously resulted in ambiguity as we considered both | ||
// the impl and the where-bound while normalizing. | ||
|
||
trait Trait { | ||
type Assoc; | ||
} | ||
impl Trait for () { | ||
type Assoc = &'static (); | ||
} | ||
|
||
fn foo<'a>(x: <() as Trait>::Assoc) | ||
where | ||
(): Trait<Assoc = &'a ()>, | ||
{ | ||
} | ||
|
||
fn main() {} |