Skip to content

Drop tracking error message regression in issue-70935-complex-spans.rs #97332

Closed
@eholk

Description

@eholk

With -Zdrop-tracking enabled, issue-70935-complex-spans.rs gives the following stderr output:

error[E0277]: `Sender<i32>` cannot be shared between threads safely
  --> $DIR/issue-70935-complex-spans.rs:10:45
   |
LL | fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
   |                                             ^^^^^^^^^^^^^^^^^^ `Sender<i32>` cannot be shared between threads safely
   |
   = help: the trait `Sync` is not implemented for `Sender<i32>`
   = note: required because of the requirements on the impl of `Send` for `&Sender<i32>`
   = note: required because it appears within the type `[closure@$DIR/issue-70935-complex-spans.rs:13:13: 15:10]`
   = note: required because it appears within the type `[static generator@$DIR/issue-70935-complex-spans.rs:7:67: 8:2]`
   = note: required because it appears within the type `from_generator::GenFuture<[static generator@$DIR/issue-70935-complex-spans.rs:7:67: 8:2]>`
   = note: required because it appears within the type `impl Future<Output = ()>`
   = note: required because it appears within the type `impl Future<Output = ()>`
   = note: required because it appears within the type `for<'r, 's, 't0> {ResumeTy, impl Future<Output = ()>, ()}`
   = note: required because it appears within the type `[static generator@$DIR/issue-70935-complex-spans.rs:12:16: 16:6]`
   = note: required because it appears within the type `from_generator::GenFuture<[static generator@$DIR/issue-70935-complex-spans.rs:12:16: 16:6]>`
   = note: required because it appears within the type `impl Future<Output = ()>`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.

Without -Zdrop-tracking, we get the following error message:

error: future cannot be sent between threads safely
  --> src/test/ui/async-await/issue-70935-complex-spans.rs:10:45
   |
10 | fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
   |                                             ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
   |
   = help: the trait `Sync` is not implemented for `Sender<i32>`
note: future is not `Send` as this value is used across an await
  --> src/test/ui/async-await/issue-70935-complex-spans.rs:15:11
   |
13 |           baz(|| async{
   |  _____________-
14 | |             foo(tx.clone());
15 | |         }).await;
   | |         - ^^^^^^ await occurs here, with the value maybe used later
   | |_________|
   |           has type `[closure@src/test/ui/async-await/issue-70935-complex-spans.rs:13:13: 15:10]` which is not `Send`
note: the value is later dropped here
  --> src/test/ui/async-await/issue-70935-complex-spans.rs:15:17
   |
15 |         }).await;
   |                 ^

error: aborting due to previous error

The old message seems much better, so it'd be good to match the behavior with drop tracking.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions