From 0ae72509a71fed8e63fac06b629338bc00d7c9e2 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Thu, 4 Mar 2021 18:03:21 +0900 Subject: [PATCH] Add a regression test for issue-81712 --- .../issue-81712-cyclic-traits.rs | 21 +++++++++++++++++++ .../issue-81712-cyclic-traits.stderr | 19 +++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/test/ui/generic-associated-types/issue-81712-cyclic-traits.rs create mode 100644 src/test/ui/generic-associated-types/issue-81712-cyclic-traits.stderr 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 0000000000000..934870afc119c --- /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; +} + +trait B { + type AType: A; +} +trait C { + type DType: D; + //~^ ERROR: missing generics for associated type `C::DType` [E0107] +} +trait D { + type CType: C; +} + +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 0000000000000..75f68cd314893 --- /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: D; + | ^^^^^ 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: D; + | ^^^^^ - +help: use angle brackets to add missing type argument + | +LL | type DType: D; + | ^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0107`.