File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed
src/test/ui/generic-associated-types Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ #![ feature( associated_type_defaults) ]
2+ #![ feature( generic_associated_types) ]
3+ #![ allow( incomplete_features) ]
4+
5+ trait Trait1 {
6+ fn foo ( ) ;
7+ }
8+
9+ trait Trait2 {
10+ type Associated : Trait1 = Self ;
11+ //~^ ERROR: the trait bound `Self: Trait1` is not satisfied
12+ //~| the size for values of type `Self` cannot be known
13+ }
14+
15+ impl Trait2 for ( ) { }
16+
17+ fn call_foo < T : Trait2 > ( ) {
18+ T :: Associated :: foo ( )
19+ }
20+
21+ fn main ( ) {
22+ call_foo :: < ( ) > ( )
23+ }
Original file line number Diff line number Diff line change 1+ error[E0277]: the trait bound `Self: Trait1` is not satisfied
2+ --> $DIR/issue-74816.rs:10:5
3+ |
4+ LL | type Associated: Trait1 = Self;
5+ | ^^^^^^^^^^^^^^^^^------^^^^^^^^
6+ | | |
7+ | | required by this bound in `Trait2::Associated`
8+ | the trait `Trait1` is not implemented for `Self`
9+ |
10+ help: consider further restricting `Self`
11+ |
12+ LL | trait Trait2: Trait1 {
13+ | ^^^^^^^^
14+
15+ error[E0277]: the size for values of type `Self` cannot be known at compilation time
16+ --> $DIR/issue-74816.rs:10:5
17+ |
18+ LL | type Associated: Trait1 = Self;
19+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20+ | |
21+ | doesn't have a size known at compile-time
22+ | required by this bound in `Trait2::Associated`
23+ |
24+ help: consider further restricting `Self`
25+ |
26+ LL | trait Trait2: Sized {
27+ | ^^^^^^^
28+
29+ error: aborting due to 2 previous errors
30+
31+ For more information about this error, try `rustc --explain E0277`.
You can’t perform that action at this time.
0 commit comments