1
Fork 0

Update issue-70935-complex-spans.rs

This commit is contained in:
Eric Holk 2022-09-13 14:38:28 -07:00
parent 5114cf38b1
commit 911c178f03
3 changed files with 11 additions and 10 deletions

View file

@ -1,5 +1,5 @@
error[E0277]: `Sender<i32>` cannot be shared between threads safely 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 { LL | fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
| ^^^^^^^^^^^^^^^^^^ `Sender<i32>` cannot be shared between threads safely | ^^^^^^^^^^^^^^^^^^ `Sender<i32>` cannot be shared between threads safely
@ -7,12 +7,12 @@ LL | fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
= help: the trait `Sync` is not implemented for `Sender<i32>` = help: the trait `Sync` is not implemented for `Sender<i32>`
= note: required for `&Sender<i32>` to implement `Send` = note: required for `&Sender<i32>` to implement `Send`
note: required because it's used within this closure 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{ LL | baz(|| async{
| ^^ | ^^
note: required because it's used within this `async fn` body 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 | async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> {
| ___________________________________________________________________^ | ___________________________________________________________________^
@ -20,7 +20,7 @@ LL | | }
| |_^ | |_^
= note: required because it captures the following types: `ResumeTy`, `impl for<'r, 's, 't0> Future<Output = ()>`, `()` = 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 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 { LL | async move {
| ________________^ | ________________^

View file

@ -1,12 +1,12 @@
error: future cannot be sent between threads safely 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 { LL | fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
| ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` | ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
| |
= help: the trait `Sync` is not implemented for `Sender<i32>` = help: the trait `Sync` is not implemented for `Sender<i32>`
note: future is not `Send` as this value is used across an await 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 | baz(|| async{
| _____________- | _____________-
@ -14,9 +14,9 @@ LL | | foo(tx.clone());
LL | | }).await; LL | | }).await;
| | - ^^^^^^ await occurs here, with the value maybe used later | | - ^^^^^^ 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 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; LL | }).await;
| ^ | ^

View file

@ -1,5 +1,6 @@
// edition:2018 // 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 // [drop_tracking]compile-flags:-Zdrop-tracking
// #70935: Check if we do not emit snippet // #70935: Check if we do not emit snippet
// with newlines which lead complex diagnostics. // with newlines which lead complex diagnostics.
@ -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 { 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 //[drop_tracking]~^^ ERROR `Sender<i32>` cannot be shared between threads
async move { async move {
baz(|| async{ baz(|| async{