about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2020-11-20 11:22:36 -0300
committerSantiago Pastorino <spastorino@gmail.com>2020-11-27 11:23:48 -0300
commita6d2235de12b09cdcbeb23db4a164e559fe44483 (patch)
tree72ae52434e678dba8368391c1990ad27325226a5
parent3c8cf6d80204d0963cc91965042b00655a1c676d (diff)
downloadrust-a6d2235de12b09cdcbeb23db4a164e559fe44483.tar.gz
rust-a6d2235de12b09cdcbeb23db4a164e559fe44483.zip
Add test for a still ambiguous scenario
-rw-r--r--src/test/ui/associated-type-bounds/ambiguous-associated-type2.rs10
-rw-r--r--src/test/ui/associated-type-bounds/ambiguous-associated-type2.stderr16
2 files changed, 26 insertions, 0 deletions
diff --git a/src/test/ui/associated-type-bounds/ambiguous-associated-type2.rs b/src/test/ui/associated-type-bounds/ambiguous-associated-type2.rs
new file mode 100644
index 00000000000..92b5dc1a1fb
--- /dev/null
+++ b/src/test/ui/associated-type-bounds/ambiguous-associated-type2.rs
@@ -0,0 +1,10 @@
+trait Foo {
+    type Item;
+}
+trait Bar<T> {
+    type Item;
+}
+trait Baz: Foo + Bar<Self::Item> {}
+//~^ ERROR cycle detected when computing the supertraits of `Baz` [E0391]
+
+fn main() {}
diff --git a/src/test/ui/associated-type-bounds/ambiguous-associated-type2.stderr b/src/test/ui/associated-type-bounds/ambiguous-associated-type2.stderr
new file mode 100644
index 00000000000..1a168a59541
--- /dev/null
+++ b/src/test/ui/associated-type-bounds/ambiguous-associated-type2.stderr
@@ -0,0 +1,16 @@
+error[E0391]: cycle detected when computing the supertraits of `Baz`
+  --> $DIR/ambiguous-associated-type2.rs:7:1
+   |
+LL | trait Baz: Foo + Bar<Self::Item> {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: ...which again requires computing the supertraits of `Baz`, completing the cycle
+note: cycle used when computing the supertraits of `Baz`
+  --> $DIR/ambiguous-associated-type2.rs:7:1
+   |
+LL | trait Baz: Foo + Bar<Self::Item> {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0391`.