about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2021-03-04 18:03:21 +0900
committerYuki Okushi <huyuumi.dev@gmail.com>2021-03-04 18:03:21 +0900
commit0ae72509a71fed8e63fac06b629338bc00d7c9e2 (patch)
tree75b23b6b8afc7d8fc38757492e2511bff6ad6ab6 /src
parent6f7673d077add6b9a066e988b1b8b132a8193d6c (diff)
Add a regression test for issue-81712
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/generic-associated-types/issue-81712-cyclic-traits.rs21
-rw-r--r--src/test/ui/generic-associated-types/issue-81712-cyclic-traits.stderr19
2 files changed, 40 insertions, 0 deletions
diff --git a/src/test/ui/generic-associated-types/issue-81712-cyclic-traits.rs b/src/test/ui/generic-associated-types/issue-81712-cyclic-traits.rs
new file mode 100644
index 00000000000..934870afc11
--- /dev/null
+++ b/src/test/ui/generic-associated-types/issue-81712-cyclic-traits.rs
@@ -0,0 +1,21 @@
+// Regression test for #81712.
+
+#![feature(generic_associated_types)]
+#![allow(incomplete_features)]
+
+trait A {
+    type BType: B<AType = Self>;
+}
+
+trait B {
+    type AType: A<BType = Self>;
+}
+trait C {
+    type DType<T>: D<T, CType = Self>;
+    //~^ ERROR: missing generics for associated type `C::DType` [E0107]
+}
+trait D<T> {
+    type CType: C<DType = Self>;
+}
+
+fn main() {}
diff --git a/src/test/ui/generic-associated-types/issue-81712-cyclic-traits.stderr b/src/test/ui/generic-associated-types/issue-81712-cyclic-traits.stderr
new file mode 100644
index 00000000000..75f68cd3148
--- /dev/null
+++ b/src/test/ui/generic-associated-types/issue-81712-cyclic-traits.stderr
@@ -0,0 +1,19 @@
+error[E0107]: missing generics for associated type `C::DType`
+  --> $DIR/issue-81712-cyclic-traits.rs:14:10
+   |
+LL |     type DType<T>: D<T, CType = Self>;
+   |          ^^^^^ expected 1 type argument
+   |
+note: associated type defined here, with 1 type parameter: `T`
+  --> $DIR/issue-81712-cyclic-traits.rs:14:10
+   |
+LL |     type DType<T>: D<T, CType = Self>;
+   |          ^^^^^ -
+help: use angle brackets to add missing type argument
+   |
+LL |     type DType<T><T>: D<T, CType = Self>;
+   |               ^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0107`.