From 4a97c52630f9d8c5df3c229b1c2c0fb0fa3f3ca2 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sat, 14 Nov 2020 09:53:03 -0500 Subject: [PATCH] Add test to check that we do not get a cycle due to resolving `Self::Bar` in the where clauses --- .../super-trait-where-referencing-self.rs | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/test/ui/associated-type-bounds/super-trait-where-referencing-self.rs diff --git a/src/test/ui/associated-type-bounds/super-trait-where-referencing-self.rs b/src/test/ui/associated-type-bounds/super-trait-where-referencing-self.rs new file mode 100644 index 0000000000000..72a6be9ffc388 --- /dev/null +++ b/src/test/ui/associated-type-bounds/super-trait-where-referencing-self.rs @@ -0,0 +1,27 @@ +// check-pass + +// Test that we do not get a cycle due to +// resolving `Self::Bar` in the where clauses +// on a trait definition (in particular, in +// a where clause that is defining a superpredicate). + +trait Foo { + type Bar; +} +trait Qux +where + Self: Foo, + Self: AsRef, +{ +} +trait Foo2 {} + +trait Qux2 +where + Self: Foo2, + Self: AsRef, +{ + type Bar; +} + +fn main() {}