Add a test for wrong assoc type diagnostics
This commit is contained in:
parent
4bd32c9804
commit
3bf9eb0f7a
2 changed files with 29 additions and 0 deletions
20
src/test/ui/associated-types/issue-72806.rs
Normal file
20
src/test/ui/associated-types/issue-72806.rs
Normal 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() {}
|
9
src/test/ui/associated-types/issue-72806.stderr
Normal file
9
src/test/ui/associated-types/issue-72806.stderr
Normal 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`.
|
Loading…
Add table
Add a link
Reference in a new issue