Skip to content

Commit 3bf9eb0

Browse files
author
XIAO Tian
committed
Add a test for wrong assoc type diagnostics
1 parent 4bd32c9 commit 3bf9eb0

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

Diff for: src/test/ui/associated-types/issue-72806.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
trait Bar {
2+
type Ok;
3+
type Sibling: Bar2<Ok=char>;
4+
}
5+
trait Bar2 {
6+
type Ok;
7+
}
8+
9+
struct Foo;
10+
struct Foo2;
11+
12+
impl Bar for Foo { //~ ERROR type mismatch resolving `<Foo2 as Bar2>::Ok == char`
13+
type Ok = ();
14+
type Sibling = Foo2;
15+
}
16+
impl Bar2 for Foo2 {
17+
type Ok = u32;
18+
}
19+
20+
fn main() {}

Diff for: src/test/ui/associated-types/issue-72806.stderr

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

0 commit comments

Comments
 (0)