--- /dev/null
+// build-fail
+//~^ ERROR cycle detected when computing layout of `Foo<()>`
+
+trait A { type Assoc: ?Sized; }
+
+impl A for () {
+ type Assoc = Foo<()>;
+}
+struct Foo<T: A>(T::Assoc);
+
+fn main() {
+ let x: Foo<()>;
+}
--- /dev/null
+error[E0391]: cycle detected when computing layout of `Foo<()>`
+ |
+ = note: ...which again requires computing layout of `Foo<()>`, completing the cycle
+note: cycle used when optimizing MIR for `main`
+ --> $DIR/recursive-type-2.rs:11:1
+ |
+LL | fn main() {
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0391`.