error[E0666]: nested `impl Trait` is not allowed
  --> $DIR/nested_impl_trait.rs:5:56
   |
LL | fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }
   |                                              ----------^^^^^^^^^^-
   |                                              |         |
   |                                              |         nested `impl Trait` here
   |                                              outer `impl Trait`

error[E0666]: nested `impl Trait` is not allowed
  --> $DIR/nested_impl_trait.rs:8:42
   |
LL | fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}
   |                                ----------^^^^^^^^^^-
   |                                |         |
   |                                |         nested `impl Trait` here
   |                                outer `impl Trait`

error[E0666]: nested `impl Trait` is not allowed
  --> $DIR/nested_impl_trait.rs:12:37
   |
LL | fn bad_in_arg_position(_: impl Into<impl Debug>) { }
   |                           ----------^^^^^^^^^^-
   |                           |         |
   |                           |         nested `impl Trait` here
   |                           outer `impl Trait`

error[E0666]: nested `impl Trait` is not allowed
  --> $DIR/nested_impl_trait.rs:17:44
   |
LL |     fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x }
   |                                  ----------^^^^^^^^^^-
   |                                  |         |
   |                                  |         nested `impl Trait` here
   |                                  outer `impl Trait`

error[E0562]: `impl Trait` not allowed outside of function and method return types
  --> $DIR/nested_impl_trait.rs:8:32
   |
LL | fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}
   |                                ^^^^^^^^^^^^^^^^^^^^^

error[E0562]: `impl Trait` not allowed outside of function and method return types
  --> $DIR/nested_impl_trait.rs:25:42
   |
LL | fn allowed_in_ret_type() -> impl Fn() -> impl Into<u32> {
   |                                          ^^^^^^^^^^^^^^

error: aborting due to 6 previous errors

Some errors have detailed explanations: E0562, E0666.
For more information about an error, try `rustc --explain E0562`.
