1
Fork 0

Add a test for wrong assoc type diagnostics

This commit is contained in:
XIAO Tian 2020-05-30 11:28:33 +08:00
parent 4bd32c9804
commit 3bf9eb0f7a
2 changed files with 29 additions and 0 deletions

View file

@ -0,0 +1,20 @@
trait Bar {
type Ok;
type Sibling: Bar2<Ok=char>;
}
trait Bar2 {
type Ok;
}
struct Foo;
struct Foo2;
impl Bar for Foo { //~ ERROR type mismatch resolving `<Foo2 as Bar2>::Ok == char`
type Ok = ();
type Sibling = Foo2;
}
impl Bar2 for Foo2 {
type Ok = u32;
}
fn main() {}

View file

@ -0,0 +1,9 @@
error[E0271]: type mismatch resolving `<Foo2 as Bar2>::Ok == char`
--> $DIR/issue-72806.rs:12:6
|
LL | impl Bar for Foo {
| ^^^ expected `u32`, found `char`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0271`.