mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-29 20:15:27 +00:00 
			
		
		
		
	 29a630eb72
			
		
	
	
		29a630eb72
		
	
	
	
	
		
			
			We already handle this case this way on the coherence side, and it matches the new solver's behaviour. While there is some breakage around type-alias-impl-trait (see new "type annotations needed" in tests/ui/type-alias-impl-trait/issue-84660-unsoundness.rs), no stable code breaks, and no new stable code is accepted.
		
			
				
	
	
		
			71 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			71 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| error[E0666]: nested `impl Trait` is not allowed
 | |
|   --> $DIR/nested_impl_trait.rs:6: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:10: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:14: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:19:44
 | |
|    |
 | |
| LL |     fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x }
 | |
|    |                                  ----------^^^^^^^^^^-
 | |
|    |                                  |         |
 | |
|    |                                  |         nested `impl Trait` here
 | |
|    |                                  outer `impl Trait`
 | |
| 
 | |
| error[E0562]: `impl Trait` is not allowed in `fn` pointer return types
 | |
|   --> $DIR/nested_impl_trait.rs:10:32
 | |
|    |
 | |
| LL | fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}
 | |
|    |                                ^^^^^^^^^^^^^^^^^^^^^
 | |
|    |
 | |
|    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 | |
| 
 | |
| error[E0277]: the trait bound `impl Into<u32>: Into<impl Debug>` is not satisfied
 | |
|   --> $DIR/nested_impl_trait.rs:6:46
 | |
|    |
 | |
| LL | fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }
 | |
|    |                                              ^^^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for `impl Into<u32>`
 | |
|    |
 | |
| help: consider further restricting this bound
 | |
|    |
 | |
| LL | fn bad_in_ret_position(x: impl Into<u32> + std::fmt::Debug) -> impl Into<impl Debug> { x }
 | |
|    |                                          +++++++++++++++++
 | |
| 
 | |
| error[E0277]: the trait bound `impl Into<u32>: Into<impl Debug>` is not satisfied
 | |
|   --> $DIR/nested_impl_trait.rs:19:34
 | |
|    |
 | |
| LL |     fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x }
 | |
|    |                                  ^^^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for `impl Into<u32>`
 | |
|    |
 | |
| help: consider further restricting this bound
 | |
|    |
 | |
| LL |     fn bad(x: impl Into<u32> + std::fmt::Debug) -> impl Into<impl Debug> { x }
 | |
|    |                              +++++++++++++++++
 | |
| 
 | |
| error: aborting due to 7 previous errors
 | |
| 
 | |
| Some errors have detailed explanations: E0277, E0562, E0666.
 | |
| For more information about an error, try `rustc --explain E0277`.
 |