mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
6efddac288
Expand the primary span of E0277 when the immediate unmet bound is not what the user wrote: ``` error[E0277]: the trait bound `i32: Bar` is not satisfied --> f100.rs:6:6 | 6 | <i32 as Foo>::foo(); | ^^^ the trait `Bar` is not implemented for `i32`, which is required by `i32: Foo` | help: this trait has no implementations, consider adding one --> f100.rs:2:1 | 2 | trait Bar {} | ^^^^^^^^^ note: required for `i32` to implement `Foo` --> f100.rs:3:14 | 3 | impl<T: Bar> Foo for T {} | --- ^^^ ^ | | | unsatisfied trait bound introduced here ``` Fix #40120.
67 lines
3.1 KiB
Plaintext
67 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 Debug: From<impl Into<u32>>` 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 `From<impl Into<u32>>` is not implemented for `impl Debug`, which is required by `impl Into<u32>: Into<impl Debug>`
|
|
|
|
|
= help: the trait `Into<U>` is implemented for `T`
|
|
= note: required for `impl Into<u32>` to implement `Into<impl Debug>`
|
|
|
|
error[E0277]: the trait bound `impl Debug: From<impl Into<u32>>` is not satisfied
|
|
--> $DIR/nested_impl_trait.rs:19:34
|
|
|
|
|
LL | fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x }
|
|
| ^^^^^^^^^^^^^^^^^^^^^ the trait `From<impl Into<u32>>` is not implemented for `impl Debug`, which is required by `impl Into<u32>: Into<impl Debug>`
|
|
|
|
|
= help: the trait `Into<U>` is implemented for `T`
|
|
= note: required for `impl Into<u32>` to implement `Into<impl Debug>`
|
|
|
|
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`.
|