File tree Expand file tree Collapse file tree 4 files changed +80
-0
lines changed
src/test/ui/generic-associated-types Expand file tree Collapse file tree 4 files changed +80
-0
lines changed Original file line number Diff line number Diff line change 1+ #![ allow( incomplete_features) ]
2+ #![ feature( generic_associated_types) ]
3+
4+ trait Monad {
5+ type Unwrapped ;
6+ type Wrapped < B > ;
7+ //~^ ERROR: missing generics for associated type `Monad::Wrapped`
8+
9+ fn bind < B , F > ( self , f : F ) -> Self :: Wrapped < B > {
10+ todo ! ( )
11+ }
12+ }
13+
14+ fn join < MOuter , MInner , A > ( outer : MOuter ) -> MOuter :: Wrapped < A >
15+ where
16+ MOuter : Monad < Unwrapped = MInner > ,
17+ MInner : Monad < Unwrapped = A , Wrapped = MOuter :: Wrapped < A > > ,
18+ {
19+ outer. bind ( |inner| inner)
20+ }
21+
22+ fn main ( ) {
23+ assert_eq ! ( join( Some ( Some ( true ) ) ) , Some ( true ) ) ;
24+ }
Original file line number Diff line number Diff line change 1+ error[E0107]: missing generics for associated type `Monad::Wrapped`
2+ --> $DIR/issue-79636-1.rs:6:10
3+ |
4+ LL | type Wrapped<B>;
5+ | ^^^^^^^ expected 1 type argument
6+ |
7+ note: associated type defined here, with 1 type parameter: `B`
8+ --> $DIR/issue-79636-1.rs:6:10
9+ |
10+ LL | type Wrapped<B>;
11+ | ^^^^^^^ -
12+ help: use angle brackets to add missing type argument
13+ |
14+ LL | type Wrapped<B><B>;
15+ | ^^^
16+
17+ error: aborting due to previous error
18+
19+ For more information about this error, try `rustc --explain E0107`.
Original file line number Diff line number Diff line change 1+ #![ allow( incomplete_features) ]
2+ #![ feature( generic_associated_types) ]
3+
4+ trait SomeTrait {
5+ type Wrapped < A > : SomeTrait ;
6+ //~^ ERROR: missing generics for associated type `SomeTrait::Wrapped`
7+
8+ fn f ( ) -> ( ) ;
9+ }
10+
11+ fn program < W > ( ) -> ( )
12+ where
13+ W : SomeTrait < Wrapped = W > ,
14+ {
15+ return W :: f ( ) ;
16+ }
17+
18+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0107]: missing generics for associated type `SomeTrait::Wrapped`
2+ --> $DIR/issue-79636-2.rs:5:10
3+ |
4+ LL | type Wrapped<A>: SomeTrait;
5+ | ^^^^^^^ expected 1 type argument
6+ |
7+ note: associated type defined here, with 1 type parameter: `A`
8+ --> $DIR/issue-79636-2.rs:5:10
9+ |
10+ LL | type Wrapped<A>: SomeTrait;
11+ | ^^^^^^^ -
12+ help: use angle brackets to add missing type argument
13+ |
14+ LL | type Wrapped<A><A>: SomeTrait;
15+ | ^^^
16+
17+ error: aborting due to previous error
18+
19+ For more information about this error, try `rustc --explain E0107`.
You can’t perform that action at this time.
0 commit comments