diff options
| author | XIAO Tian <tian@example.com> | 2020-05-30 11:28:33 +0800 |
|---|---|---|
| committer | XIAO Tian <tian@example.com> | 2020-05-31 12:13:30 +0800 |
| commit | 3bf9eb0f7a1f2da9df2983aa8cf95a420130cada (patch) | |
| tree | cb6697d7d31abc29a4b941b8035ccc6011d766b6 | |
| parent | 4bd32c98047a809ba5fd1fac2aa044638e5f2105 (diff) | |
| download | rust-3bf9eb0f7a1f2da9df2983aa8cf95a420130cada.tar.gz rust-3bf9eb0f7a1f2da9df2983aa8cf95a420130cada.zip | |
Add a test for wrong assoc type diagnostics
| -rw-r--r-- | src/test/ui/associated-types/issue-72806.rs | 20 | ||||
| -rw-r--r-- | src/test/ui/associated-types/issue-72806.stderr | 9 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/test/ui/associated-types/issue-72806.rs b/src/test/ui/associated-types/issue-72806.rs new file mode 100644 index 00000000000..ae63781d568 --- /dev/null +++ b/src/test/ui/associated-types/issue-72806.rs @@ -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() {} diff --git a/src/test/ui/associated-types/issue-72806.stderr b/src/test/ui/associated-types/issue-72806.stderr new file mode 100644 index 00000000000..03a6565848d --- /dev/null +++ b/src/test/ui/associated-types/issue-72806.stderr @@ -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`. |
