rust/tests/ui/coroutine/drop-tracking-parent-expression.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

123 lines
5.6 KiB
Plaintext

error: coroutine cannot be sent between threads safely
--> $DIR/drop-tracking-parent-expression.rs:23:13
|
LL | assert_send(g);
| ^^^^^^^^^^^^^^ coroutine is not `Send`
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
|
= help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `derived_drop::Client`, which is required by `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}: Send`
note: coroutine is not `Send` as this value is used across a yield
--> $DIR/drop-tracking-parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
| ------------------------ has type `derived_drop::Client` which is not `Send`
...
LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/drop-tracking-parent-expression.rs:40:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: coroutine cannot be sent between threads safely
--> $DIR/drop-tracking-parent-expression.rs:23:13
|
LL | assert_send(g);
| ^^^^^^^^^^^^^^ coroutine is not `Send`
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
|
= help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `significant_drop::Client`, which is required by `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}: Send`
note: coroutine is not `Send` as this value is used across a yield
--> $DIR/drop-tracking-parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
| ------------------------ has type `significant_drop::Client` which is not `Send`
...
LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/drop-tracking-parent-expression.rs:40:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: coroutine cannot be sent between threads safely
--> $DIR/drop-tracking-parent-expression.rs:23:13
|
LL | assert_send(g);
| ^^^^^^^^^^^^^^ coroutine is not `Send`
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
|
= help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `insignificant_dtor::Client`, which is required by `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}: Send`
note: coroutine is not `Send` as this value is used across a yield
--> $DIR/drop-tracking-parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
| ------------------------ has type `insignificant_dtor::Client` which is not `Send`
...
LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/drop-tracking-parent-expression.rs:40:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors