-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't require specifying unrelated assoc types when trait alias is in…
… dyn type
- Loading branch information
1 parent
7d3702e
commit 850cc34
Showing
4 changed files
with
55 additions
and
50 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
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
7 changes: 2 additions & 5 deletions
7
tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr
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
16 changes: 16 additions & 0 deletions
16
tests/ui/traits/alias/only-require-assocs-from-supertraits.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,16 @@ | ||
//@ check-pass | ||
|
||
#![feature(trait_alias)] | ||
|
||
trait Foo<T> {} | ||
trait Bar { type Assoc; } | ||
|
||
trait Alias<T: Bar> = Foo<T>; | ||
|
||
// Check that an alias only requires us to specify the associated types | ||
// of the principal's supertraits. For example, we shouldn't require | ||
// specifying the type `Assoc` on trait `Bar` just because we have some | ||
// `T: Bar` where clause on the alias... because that makes no sense. | ||
fn use_alias<T: Bar>(x: &dyn Alias<T>) {} | ||
|
||
fn main() {} |