--- /dev/null
+// normalize-stderr-test: "`.*`" -> "`DEF_ID`"
+// normalize-stdout-test: "`.*`" -> "`DEF_ID`"
+// edition:2018
+
+pub async fn f() -> impl std::fmt::Debug {
+ #[derive(Debug)]
+ enum E {
+ //~^ ERROR recursive type `f::{{closure}}#0::E` has infinite size
+ This(E),
+ Unit,
+ }
+ E::Unit
+}
+
+fn main() {}
--- /dev/null
+error[E0072]: recursive type `DEF_ID` has infinite size
+ --> $DIR/infinite-recursive-type-impl-trait-return.rs:7:5
+ |
+LL | enum E {
+ | ^^^^^^ recursive type has infinite size
+LL |
+LL | This(E),
+ | - recursive without indirection
+ |
+help: insert some indirection (e.g., a `DEF_ID` representable
+ |
+LL | This(Box<E>),
+ | ^^^^ ^
+
+error: aborting due to previous error
+
+For more information about this error, try `DEF_ID`.