rust/tests/ui/errors/traits/blame-trait-error-spans-on-exprs.stderr
Esteban Küber 6efddac288 Provide more context on derived obligation error primary label
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.
2024-01-30 21:28:18 +00:00

413 lines
15 KiB
Plaintext

error[E0277]: the trait bound `Q: T3` is not satisfied
--> $DIR/blame-trait-error-spans-on-exprs.rs:81:60
|
LL | want(Wrapper { value: Burrito { spicy: false, filling: q } });
| ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q`, which is required by `Wrapper<Burrito<Q>>: T1`
|
note: required for `Burrito<Q>` to implement `T2`
--> $DIR/blame-trait-error-spans-on-exprs.rs:22:13
|
LL | impl<A: T3> T2 for Burrito<A> {}
| -- ^^ ^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
note: required for `Wrapper<Burrito<Q>>` to implement `T1`
--> $DIR/blame-trait-error-spans-on-exprs.rs:16:13
|
LL | impl<B: T2> T1 for Wrapper<B> {}
| -- ^^ ^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
note: required by a bound in `want`
--> $DIR/blame-trait-error-spans-on-exprs.rs:53:12
|
LL | fn want<V: T1>(_x: V) {}
| ^^ required by this bound in `want`
help: consider restricting type parameter `Q`
|
LL | fn example<Q: T3>(q: Q) {
| ++++
error[E0277]: the trait bound `Q: T3` is not satisfied
--> $DIR/blame-trait-error-spans-on-exprs.rs:85:84
|
LL | want(Wrapper { value: BurritoKinds::SmallBurrito { spicy: true, small_filling: q } });
| ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q`, which is required by `Wrapper<BurritoKinds<Q>>: T1`
|
note: required for `BurritoKinds<Q>` to implement `T2`
--> $DIR/blame-trait-error-spans-on-exprs.rs:32:13
|
LL | impl<D: T3> T2 for BurritoKinds<D> {}
| -- ^^ ^^^^^^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
note: required for `Wrapper<BurritoKinds<Q>>` to implement `T1`
--> $DIR/blame-trait-error-spans-on-exprs.rs:16:13
|
LL | impl<B: T2> T1 for Wrapper<B> {}
| -- ^^ ^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
note: required by a bound in `want`
--> $DIR/blame-trait-error-spans-on-exprs.rs:53:12
|
LL | fn want<V: T1>(_x: V) {}
| ^^ required by this bound in `want`
help: consider restricting type parameter `Q`
|
LL | fn example<Q: T3>(q: Q) {
| ++++
error[E0277]: the trait bound `Q: T3` is not satisfied
--> $DIR/blame-trait-error-spans-on-exprs.rs:89:39
|
LL | want(Wrapper { value: Taco(false, q) });
| ---- ^ the trait `T3` is not implemented for `Q`, which is required by `Wrapper<Taco<Q>>: T1`
| |
| required by a bound introduced by this call
|
note: required for `Taco<Q>` to implement `T2`
--> $DIR/blame-trait-error-spans-on-exprs.rs:35:13
|
LL | impl<E: T3> T2 for Taco<E> {}
| -- ^^ ^^^^^^^
| |
| unsatisfied trait bound introduced here
note: required for `Wrapper<Taco<Q>>` to implement `T1`
--> $DIR/blame-trait-error-spans-on-exprs.rs:16:13
|
LL | impl<B: T2> T1 for Wrapper<B> {}
| -- ^^ ^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
note: required by a bound in `want`
--> $DIR/blame-trait-error-spans-on-exprs.rs:53:12
|
LL | fn want<V: T1>(_x: V) {}
| ^^ required by this bound in `want`
help: consider restricting type parameter `Q`
|
LL | fn example<Q: T3>(q: Q) {
| ++++
error[E0277]: the trait bound `Q: T3` is not satisfied
--> $DIR/blame-trait-error-spans-on-exprs.rs:93:53
|
LL | want(Wrapper { value: TacoKinds::OneTaco(false, q) });
| ---- ^ the trait `T3` is not implemented for `Q`, which is required by `Wrapper<TacoKinds<Q>>: T1`
| |
| required by a bound introduced by this call
|
note: required for `TacoKinds<Q>` to implement `T2`
--> $DIR/blame-trait-error-spans-on-exprs.rs:41:13
|
LL | impl<F: T3> T2 for TacoKinds<F> {}
| -- ^^ ^^^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
note: required for `Wrapper<TacoKinds<Q>>` to implement `T1`
--> $DIR/blame-trait-error-spans-on-exprs.rs:16:13
|
LL | impl<B: T2> T1 for Wrapper<B> {}
| -- ^^ ^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
note: required by a bound in `want`
--> $DIR/blame-trait-error-spans-on-exprs.rs:53:12
|
LL | fn want<V: T1>(_x: V) {}
| ^^ required by this bound in `want`
help: consider restricting type parameter `Q`
|
LL | fn example<Q: T3>(q: Q) {
| ++++
error[E0277]: the trait bound `Q: T3` is not satisfied
--> $DIR/blame-trait-error-spans-on-exprs.rs:97:74
|
LL | want(Wrapper { value: GenericBurrito { spiciness: NotSpicy, filling: q } });
| ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q`, which is required by `Wrapper<GenericBurrito<NotSpicy, Q>>: T1`
|
note: required for `GenericBurrito<NotSpicy, Q>` to implement `T2`
--> $DIR/blame-trait-error-spans-on-exprs.rs:47:16
|
LL | impl<X, Y: T3> T2 for GenericBurrito<X, Y> {}
| -- ^^ ^^^^^^^^^^^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
note: required for `Wrapper<GenericBurrito<NotSpicy, Q>>` to implement `T1`
--> $DIR/blame-trait-error-spans-on-exprs.rs:16:13
|
LL | impl<B: T2> T1 for Wrapper<B> {}
| -- ^^ ^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
note: required by a bound in `want`
--> $DIR/blame-trait-error-spans-on-exprs.rs:53:12
|
LL | fn want<V: T1>(_x: V) {}
| ^^ required by this bound in `want`
help: consider restricting type parameter `Q`
|
LL | fn example<Q: T3>(q: Q) {
| ++++
error[E0277]: the trait bound `Q: T2` is not satisfied
--> $DIR/blame-trait-error-spans-on-exprs.rs:101:14
|
LL | want((3, q));
| ---- ^ the trait `T2` is not implemented for `Q`, which is required by `({integer}, Q): T1`
| |
| required by a bound introduced by this call
|
note: required for `(i32, Q)` to implement `T1`
--> $DIR/blame-trait-error-spans-on-exprs.rs:51:20
|
LL | impl<A: T2, B: T2> T1 for (A, B) {}
| -- ^^ ^^^^^^
| |
| unsatisfied trait bound introduced here
note: required by a bound in `want`
--> $DIR/blame-trait-error-spans-on-exprs.rs:53:12
|
LL | fn want<V: T1>(_x: V) {}
| ^^ required by this bound in `want`
help: consider restricting type parameter `Q`
|
LL | fn example<Q: T2>(q: Q) {
| ++++
error[E0277]: the trait bound `Q: T3` is not satisfied
--> $DIR/blame-trait-error-spans-on-exprs.rs:105:31
|
LL | want(Wrapper { value: (3, q) });
| ---- ^ the trait `T3` is not implemented for `Q`, which is required by `Wrapper<({integer}, Q)>: T1`
| |
| required by a bound introduced by this call
|
note: required for `(i32, Q)` to implement `T2`
--> $DIR/blame-trait-error-spans-on-exprs.rs:50:20
|
LL | impl<A: T3, B: T3> T2 for (A, B) {}
| -- ^^ ^^^^^^
| |
| unsatisfied trait bound introduced here
note: required for `Wrapper<(i32, Q)>` to implement `T1`
--> $DIR/blame-trait-error-spans-on-exprs.rs:16:13
|
LL | impl<B: T2> T1 for Wrapper<B> {}
| -- ^^ ^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
note: required by a bound in `want`
--> $DIR/blame-trait-error-spans-on-exprs.rs:53:12
|
LL | fn want<V: T1>(_x: V) {}
| ^^ required by this bound in `want`
help: consider restricting type parameter `Q`
|
LL | fn example<Q: T3>(q: Q) {
| ++++
error[E0277]: the trait bound `Q: T3` is not satisfied
--> $DIR/blame-trait-error-spans-on-exprs.rs:109:15
|
LL | want(((3, q), 5));
| ---- ^ the trait `T3` is not implemented for `Q`, which is required by `(({integer}, Q), {integer}): T1`
| |
| required by a bound introduced by this call
|
note: required for `(i32, Q)` to implement `T2`
--> $DIR/blame-trait-error-spans-on-exprs.rs:50:20
|
LL | impl<A: T3, B: T3> T2 for (A, B) {}
| -- ^^ ^^^^^^
| |
| unsatisfied trait bound introduced here
note: required for `((i32, Q), i32)` to implement `T1`
--> $DIR/blame-trait-error-spans-on-exprs.rs:51:20
|
LL | impl<A: T2, B: T2> T1 for (A, B) {}
| -- ^^ ^^^^^^
| |
| unsatisfied trait bound introduced here
note: required by a bound in `want`
--> $DIR/blame-trait-error-spans-on-exprs.rs:53:12
|
LL | fn want<V: T1>(_x: V) {}
| ^^ required by this bound in `want`
help: consider restricting type parameter `Q`
|
LL | fn example<Q: T3>(q: Q) {
| ++++
error[E0277]: the trait bound `Q: T1` is not satisfied
--> $DIR/blame-trait-error-spans-on-exprs.rs:112:49
|
LL | want(DoubleWrapper { item: Wrapper { value: q } });
| ---- ^ the trait `T1` is not implemented for `Q`, which is required by `DoubleWrapper<Q>: T1`
| |
| required by a bound introduced by this call
|
note: required for `DoubleWrapper<Q>` to implement `T1`
--> $DIR/blame-trait-error-spans-on-exprs.rs:72:13
|
LL | impl<T: T1> T1 for DoubleWrapper<T> {}
| -- ^^ ^^^^^^^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
note: required by a bound in `want`
--> $DIR/blame-trait-error-spans-on-exprs.rs:53:12
|
LL | fn want<V: T1>(_x: V) {}
| ^^ required by this bound in `want`
help: consider restricting type parameter `Q`
|
LL | fn example<Q: T1>(q: Q) {
| ++++
error[E0277]: the trait bound `Q: T1` is not satisfied
--> $DIR/blame-trait-error-spans-on-exprs.rs:115:88
|
LL | want(DoubleWrapper { item: Wrapper { value: DoubleWrapper { item: Wrapper { value: q } } } });
| ---- required by a bound introduced by this call ^ the trait `T1` is not implemented for `Q`, which is required by `DoubleWrapper<DoubleWrapper<Q>>: T1`
|
note: required for `DoubleWrapper<Q>` to implement `T1`
--> $DIR/blame-trait-error-spans-on-exprs.rs:72:13
|
LL | impl<T: T1> T1 for DoubleWrapper<T> {}
| -- ^^ ^^^^^^^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
= note: 1 redundant requirement hidden
= note: required for `DoubleWrapper<DoubleWrapper<Q>>` to implement `T1`
note: required by a bound in `want`
--> $DIR/blame-trait-error-spans-on-exprs.rs:53:12
|
LL | fn want<V: T1>(_x: V) {}
| ^^ required by this bound in `want`
help: consider restricting type parameter `Q`
|
LL | fn example<Q: T1>(q: Q) {
| ++++
error[E0277]: the trait bound `Q: T3` is not satisfied
--> $DIR/blame-trait-error-spans-on-exprs.rs:119:27
|
LL | want(Wrapper { value: AliasBurrito { spiciness: q, filling: q } });
| ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `T3` is not implemented for `Q`, which is required by `Wrapper<GenericBurrito<Q, Q>>: T1`
| |
| required by a bound introduced by this call
|
note: required for `GenericBurrito<Q, Q>` to implement `T2`
--> $DIR/blame-trait-error-spans-on-exprs.rs:47:16
|
LL | impl<X, Y: T3> T2 for GenericBurrito<X, Y> {}
| -- ^^ ^^^^^^^^^^^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
note: required for `Wrapper<GenericBurrito<Q, Q>>` to implement `T1`
--> $DIR/blame-trait-error-spans-on-exprs.rs:16:13
|
LL | impl<B: T2> T1 for Wrapper<B> {}
| -- ^^ ^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
note: required by a bound in `want`
--> $DIR/blame-trait-error-spans-on-exprs.rs:53:12
|
LL | fn want<V: T1>(_x: V) {}
| ^^ required by this bound in `want`
help: consider restricting type parameter `Q`
|
LL | fn example<Q: T3>(q: Q) {
| ++++
error[E0277]: the trait bound `Q: T1` is not satisfied
--> $DIR/blame-trait-error-spans-on-exprs.rs:122:35
|
LL | want(Two { a: Two { a: (), b: q }, b: () });
| ---- ^ the trait `T1` is not implemented for `Q`, which is required by `Two<Two<(), Q>, ()>: T1`
| |
| required by a bound introduced by this call
|
note: required for `Two<Two<(), Q>, ()>` to implement `T1`
--> $DIR/blame-trait-error-spans-on-exprs.rs:66:19
|
LL | impl<X, Y: T1, Z> T1 for Two<Two<X, Y>, Z> {}
| -- ^^ ^^^^^^^^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
note: required by a bound in `want`
--> $DIR/blame-trait-error-spans-on-exprs.rs:53:12
|
LL | fn want<V: T1>(_x: V) {}
| ^^ required by this bound in `want`
help: consider restricting type parameter `Q`
|
LL | fn example<Q: T1>(q: Q) {
| ++++
error[E0277]: the trait bound `Q: T1` is not satisfied
--> $DIR/blame-trait-error-spans-on-exprs.rs:128:59
|
LL | want(
| ---- required by a bound introduced by this call
LL | Two { a: Two { a: (), b: Two { a: Two { a: (), b: q }, b: () } }, b: () },
| ^ the trait `T1` is not implemented for `Q`, which is required by `Two<Two<(), Two<Two<(), Q>, ()>>, ()>: T1`
|
note: required for `Two<Two<(), Q>, ()>` to implement `T1`
--> $DIR/blame-trait-error-spans-on-exprs.rs:66:19
|
LL | impl<X, Y: T1, Z> T1 for Two<Two<X, Y>, Z> {}
| -- ^^ ^^^^^^^^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
= note: 1 redundant requirement hidden
= note: required for `Two<Two<(), Two<Two<(), Q>, ()>>, ()>` to implement `T1`
note: required by a bound in `want`
--> $DIR/blame-trait-error-spans-on-exprs.rs:53:12
|
LL | fn want<V: T1>(_x: V) {}
| ^^ required by this bound in `want`
help: consider restricting type parameter `Q`
|
LL | fn example<Q: T1>(q: Q) {
| ++++
error[E0277]: the trait bound `Q: T3` is not satisfied
--> $DIR/blame-trait-error-spans-on-exprs.rs:133:44
|
LL | want(&Burrito { spicy: false, filling: q });
| ---- ^ the trait `T3` is not implemented for `Q`, which is required by `&Burrito<Q>: T1`
| |
| required by a bound introduced by this call
|
note: required for `Burrito<Q>` to implement `T2`
--> $DIR/blame-trait-error-spans-on-exprs.rs:22:13
|
LL | impl<A: T3> T2 for Burrito<A> {}
| -- ^^ ^^^^^^^^^^
| |
| unsatisfied trait bound introduced here
note: required for `&Burrito<Q>` to implement `T1`
--> $DIR/blame-trait-error-spans-on-exprs.rs:74:17
|
LL | impl<'a, T: T2> T1 for &'a T {}
| -- ^^ ^^^^^
| |
| unsatisfied trait bound introduced here
note: required by a bound in `want`
--> $DIR/blame-trait-error-spans-on-exprs.rs:53:12
|
LL | fn want<V: T1>(_x: V) {}
| ^^ required by this bound in `want`
help: consider restricting type parameter `Q`
|
LL | fn example<Q: T3>(q: Q) {
| ++++
error: aborting due to 14 previous errors
For more information about this error, try `rustc --explain E0277`.