Add test for issue #79636
This commit is contained in:
parent
b6647b5692
commit
19e51aaef7
24
src/test/ui/generic-associated-types/issue-79636-1.rs
Normal file
24
src/test/ui/generic-associated-types/issue-79636-1.rs
Normal file
@ -0,0 +1,24 @@
|
||||
#![allow(incomplete_features)]
|
||||
#![feature(generic_associated_types)]
|
||||
|
||||
trait Monad {
|
||||
type Unwrapped;
|
||||
type Wrapped<B>;
|
||||
//~^ ERROR: missing generics for associated type `Monad::Wrapped`
|
||||
|
||||
fn bind<B, F>(self, f: F) -> Self::Wrapped<B> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
fn join<MOuter, MInner, A>(outer: MOuter) -> MOuter::Wrapped<A>
|
||||
where
|
||||
MOuter: Monad<Unwrapped = MInner>,
|
||||
MInner: Monad<Unwrapped = A, Wrapped = MOuter::Wrapped<A>>,
|
||||
{
|
||||
outer.bind(|inner| inner)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
assert_eq!(join(Some(Some(true))), Some(true));
|
||||
}
|
19
src/test/ui/generic-associated-types/issue-79636-1.stderr
Normal file
19
src/test/ui/generic-associated-types/issue-79636-1.stderr
Normal file
@ -0,0 +1,19 @@
|
||||
error[E0107]: missing generics for associated type `Monad::Wrapped`
|
||||
--> $DIR/issue-79636-1.rs:6:10
|
||||
|
|
||||
LL | type Wrapped<B>;
|
||||
| ^^^^^^^ expected 1 type argument
|
||||
|
|
||||
note: associated type defined here, with 1 type parameter: `B`
|
||||
--> $DIR/issue-79636-1.rs:6:10
|
||||
|
|
||||
LL | type Wrapped<B>;
|
||||
| ^^^^^^^ -
|
||||
help: use angle brackets to add missing type argument
|
||||
|
|
||||
LL | type Wrapped<B><B>;
|
||||
| ^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0107`.
|
18
src/test/ui/generic-associated-types/issue-79636-2.rs
Normal file
18
src/test/ui/generic-associated-types/issue-79636-2.rs
Normal file
@ -0,0 +1,18 @@
|
||||
#![allow(incomplete_features)]
|
||||
#![feature(generic_associated_types)]
|
||||
|
||||
trait SomeTrait {
|
||||
type Wrapped<A>: SomeTrait;
|
||||
//~^ ERROR: missing generics for associated type `SomeTrait::Wrapped`
|
||||
|
||||
fn f() -> ();
|
||||
}
|
||||
|
||||
fn program<W>() -> ()
|
||||
where
|
||||
W: SomeTrait<Wrapped = W>,
|
||||
{
|
||||
return W::f();
|
||||
}
|
||||
|
||||
fn main() {}
|
19
src/test/ui/generic-associated-types/issue-79636-2.stderr
Normal file
19
src/test/ui/generic-associated-types/issue-79636-2.stderr
Normal file
@ -0,0 +1,19 @@
|
||||
error[E0107]: missing generics for associated type `SomeTrait::Wrapped`
|
||||
--> $DIR/issue-79636-2.rs:5:10
|
||||
|
|
||||
LL | type Wrapped<A>: SomeTrait;
|
||||
| ^^^^^^^ expected 1 type argument
|
||||
|
|
||||
note: associated type defined here, with 1 type parameter: `A`
|
||||
--> $DIR/issue-79636-2.rs:5:10
|
||||
|
|
||||
LL | type Wrapped<A>: SomeTrait;
|
||||
| ^^^^^^^ -
|
||||
help: use angle brackets to add missing type argument
|
||||
|
|
||||
LL | type Wrapped<A><A>: SomeTrait;
|
||||
| ^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0107`.
|
Loading…
x
Reference in New Issue
Block a user