about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorEric Holk <ericholk@microsoft.com>2022-09-13 14:30:54 -0700
committerEric Holk <ericholk@microsoft.com>2022-09-13 14:36:08 -0700
commit777db102dfdaa70ed7d91bad29d294874bfa9946 (patch)
tree143b67094d4357a16353da4e561b7ca727d2c577 /src/test
parent9bcc107ffe037a7329b94bf533c3af255981180f (diff)
downloadrust-777db102dfdaa70ed7d91bad29d294874bfa9946.tar.gz
rust-777db102dfdaa70ed7d91bad29d294874bfa9946.zip
Update issue-64130-4-async-move.rs
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr (renamed from src/test/ui/async-await/issue-64130-4-async-move.stderr)6
-rw-r--r--src/test/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr26
-rw-r--r--src/test/ui/async-await/issue-64130-4-async-move.rs10
3 files changed, 36 insertions, 6 deletions
diff --git a/src/test/ui/async-await/issue-64130-4-async-move.stderr b/src/test/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr
index d631e6dc7f7..f609e36362c 100644
--- a/src/test/ui/async-await/issue-64130-4-async-move.stderr
+++ b/src/test/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr
@@ -1,12 +1,12 @@
 error: future cannot be sent between threads safely
-  --> $DIR/issue-64130-4-async-move.rs:15:17
+  --> $DIR/issue-64130-4-async-move.rs:19:17
    |
 LL | pub fn foo() -> impl Future + Send {
    |                 ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
    |
    = help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)`
 note: future is not `Send` as this value is used across an await
-  --> $DIR/issue-64130-4-async-move.rs:21:31
+  --> $DIR/issue-64130-4-async-move.rs:25:31
    |
 LL |         match client.status() {
    |               ------ has type `&Client` which is not `Send`
@@ -17,7 +17,7 @@ LL |                 let _x = get().await;
 LL |     }
    |     - `client` is later dropped here
 help: consider moving this into a `let` binding to create a shorter lived borrow
-  --> $DIR/issue-64130-4-async-move.rs:19:15
+  --> $DIR/issue-64130-4-async-move.rs:23:15
    |
 LL |         match client.status() {
    |               ^^^^^^^^^^^^^^^
diff --git a/src/test/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr b/src/test/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr
new file mode 100644
index 00000000000..f609e36362c
--- /dev/null
+++ b/src/test/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr
@@ -0,0 +1,26 @@
+error: future cannot be sent between threads safely
+  --> $DIR/issue-64130-4-async-move.rs:19:17
+   |
+LL | pub fn foo() -> impl Future + Send {
+   |                 ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
+   |
+   = help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)`
+note: future is not `Send` as this value is used across an await
+  --> $DIR/issue-64130-4-async-move.rs:25:31
+   |
+LL |         match client.status() {
+   |               ------ has type `&Client` which is not `Send`
+LL |             200 => {
+LL |                 let _x = get().await;
+   |                               ^^^^^^ await occurs here, with `client` maybe used later
+...
+LL |     }
+   |     - `client` is later dropped here
+help: consider moving this into a `let` binding to create a shorter lived borrow
+  --> $DIR/issue-64130-4-async-move.rs:23:15
+   |
+LL |         match client.status() {
+   |               ^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/async-await/issue-64130-4-async-move.rs b/src/test/ui/async-await/issue-64130-4-async-move.rs
index 2538f34351e..a38428fc00f 100644
--- a/src/test/ui/async-await/issue-64130-4-async-move.rs
+++ b/src/test/ui/async-await/issue-64130-4-async-move.rs
@@ -1,4 +1,8 @@
 // edition:2018
+// revisions: no_drop_tracking drop_tracking
+// [drop_tracking] check-pass
+// [drop_tracking] compile-flags: -Zdrop-tracking=yes
+// [no_drop_tracking] compile-flags: -Zdrop-tracking=no
 use std::any::Any;
 use std::future::Future;
 
@@ -10,16 +14,16 @@ impl Client {
     }
 }
 
-async fn get() { }
+async fn get() {}
 
 pub fn foo() -> impl Future + Send {
-    //~^ ERROR future cannot be sent between threads safely
+    //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
     let client = Client(Box::new(true));
     async move {
         match client.status() {
             200 => {
                 let _x = get().await;
-            },
+            }
             _ => (),
         }
     }