Skip to content

Commit

Permalink
Update issue-70935-complex-spans.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
eholk committed Sep 13, 2022
1 parent 5114cf3 commit 911c178
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
error[E0277]: `Sender<i32>` cannot be shared between threads safely
--> $DIR/issue-70935-complex-spans.rs:12:45
--> $DIR/issue-70935-complex-spans.rs:13: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 for `&Sender<i32>` to implement `Send`
note: required because it's used within this closure
--> $DIR/issue-70935-complex-spans.rs:16:13
--> $DIR/issue-70935-complex-spans.rs:17:13
|
LL | baz(|| async{
| ^^
note: required because it's used within this `async fn` body
--> $DIR/issue-70935-complex-spans.rs:9:67
--> $DIR/issue-70935-complex-spans.rs:10:67
|
LL | async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> {
| ___________________________________________________________________^
LL | | }
| |_^
= note: required because it captures the following types: `ResumeTy`, `impl for<'r, 's, 't0> Future<Output = ()>`, `()`
note: required because it's used within this `async` block
--> $DIR/issue-70935-complex-spans.rs:15:16
--> $DIR/issue-70935-complex-spans.rs:16:16
|
LL | async move {
| ________________^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
error: future cannot be sent between threads safely
--> $DIR/issue-70935-complex-spans.rs:12:45
--> $DIR/issue-70935-complex-spans.rs:13:45
|
LL | 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
--> $DIR/issue-70935-complex-spans.rs:18:11
--> $DIR/issue-70935-complex-spans.rs:19:11
|
LL | baz(|| async{
| _____________-
LL | | foo(tx.clone());
LL | | }).await;
| | - ^^^^^^ await occurs here, with the value maybe used later
| |_________|
| has type `[closure@$DIR/issue-70935-complex-spans.rs:16:13: 16:15]` which is not `Send`
| has type `[closure@$DIR/issue-70935-complex-spans.rs:17:13: 17:15]` which is not `Send`
note: the value is later dropped here
--> $DIR/issue-70935-complex-spans.rs:18:17
--> $DIR/issue-70935-complex-spans.rs:19:17
|
LL | }).await;
| ^
Expand Down
5 changes: 3 additions & 2 deletions src/test/ui/async-await/issue-70935-complex-spans.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// edition:2018
// revisions: normal drop_tracking
// revisions: no_drop_tracking drop_tracking
// [no_drop_tracking]compile-flags:-Zdrop-tracking=no
// [drop_tracking]compile-flags:-Zdrop-tracking
// #70935: Check if we do not emit snippet
// with newlines which lead complex diagnostics.
Expand All @@ -10,7 +11,7 @@ async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> {
}

fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
//[normal]~^ ERROR future cannot be sent between threads safely
//[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
//[drop_tracking]~^^ ERROR `Sender<i32>` cannot be shared between threads
async move {
baz(|| async{
Expand Down

0 comments on commit 911c178

Please sign in to comment.