about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/lint/must_not_suspend/dedup.rs20
-rw-r--r--src/test/ui/lint/must_not_suspend/dedup.stderr19
-rw-r--r--src/test/ui/lint/must_not_suspend/generic.rs9
-rw-r--r--src/test/ui/lint/must_not_suspend/generic.stderr31
-rw-r--r--src/test/ui/lint/must_not_suspend/ref.rs1
-rw-r--r--src/test/ui/lint/must_not_suspend/ref.stderr24
6 files changed, 45 insertions, 59 deletions
diff --git a/src/test/ui/lint/must_not_suspend/dedup.rs b/src/test/ui/lint/must_not_suspend/dedup.rs
new file mode 100644
index 00000000000..040fff5a5a5
--- /dev/null
+++ b/src/test/ui/lint/must_not_suspend/dedup.rs
@@ -0,0 +1,20 @@
+// edition:2018
+#![feature(must_not_suspend)]
+#![deny(must_not_suspend)]
+
+#[must_not_suspend]
+struct No {}
+
+async fn shushspend() {}
+
+async fn wheeee<T>(t: T) {
+    shushspend().await;
+    drop(t);
+}
+
+async fn yes() {
+    wheeee(No {}).await; //~ ERROR `No` held across
+}
+
+fn main() {
+}
diff --git a/src/test/ui/lint/must_not_suspend/dedup.stderr b/src/test/ui/lint/must_not_suspend/dedup.stderr
new file mode 100644
index 00000000000..542b7a3bc7e
--- /dev/null
+++ b/src/test/ui/lint/must_not_suspend/dedup.stderr
@@ -0,0 +1,19 @@
+error: `No` held across a suspend point, but should not be
+  --> $DIR/dedup.rs:16:12
+   |
+LL |     wheeee(No {}).await;
+   |     -------^^^^^------- the value is held across this suspend point
+   |
+note: the lint level is defined here
+  --> $DIR/dedup.rs:3:9
+   |
+LL | #![deny(must_not_suspend)]
+   |         ^^^^^^^^^^^^^^^^
+help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
+  --> $DIR/dedup.rs:16:12
+   |
+LL |     wheeee(No {}).await;
+   |            ^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lint/must_not_suspend/generic.rs b/src/test/ui/lint/must_not_suspend/generic.rs
index 94457e37540..b3effa020c4 100644
--- a/src/test/ui/lint/must_not_suspend/generic.rs
+++ b/src/test/ui/lint/must_not_suspend/generic.rs
@@ -1,4 +1,7 @@
 // edition:2018
+// run-pass
+//
+// this test shows a case where the lint doesn't fire in generic code
 #![feature(must_not_suspend)]
 #![deny(must_not_suspend)]
 
@@ -12,10 +15,6 @@ async fn wheeee<T>(t: T) {
     drop(t);
 }
 
-async fn yes() {
-    wheeee(No {}).await; //~ ERROR `No` held across
-    //~^ ERROR `No` held across
-}
-
 fn main() {
+    let _fut = wheeee(No {});
 }
diff --git a/src/test/ui/lint/must_not_suspend/generic.stderr b/src/test/ui/lint/must_not_suspend/generic.stderr
deleted file mode 100644
index d853ba720a3..00000000000
--- a/src/test/ui/lint/must_not_suspend/generic.stderr
+++ /dev/null
@@ -1,31 +0,0 @@
-error: `No` held across a suspend point, but should not be
-  --> $DIR/generic.rs:16:12
-   |
-LL |     wheeee(No {}).await;
-   |     -------^^^^^------- the value is held across this suspend point
-   |
-note: the lint level is defined here
-  --> $DIR/generic.rs:3:9
-   |
-LL | #![deny(must_not_suspend)]
-   |         ^^^^^^^^^^^^^^^^
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
-  --> $DIR/generic.rs:16:12
-   |
-LL |     wheeee(No {}).await;
-   |            ^^^^^
-
-error: `No` held across a suspend point, but should not be
-  --> $DIR/generic.rs:16:12
-   |
-LL |     wheeee(No {}).await;
-   |     -------^^^^^------- the value is held across this suspend point
-   |
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
-  --> $DIR/generic.rs:16:12
-   |
-LL |     wheeee(No {}).await;
-   |            ^^^^^
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/lint/must_not_suspend/ref.rs b/src/test/ui/lint/must_not_suspend/ref.rs
index 89fd73c187e..738dd9e0465 100644
--- a/src/test/ui/lint/must_not_suspend/ref.rs
+++ b/src/test/ui/lint/must_not_suspend/ref.rs
@@ -16,7 +16,6 @@ async fn other() {}
 impl Bar {
     async fn uhoh(&mut self) {
         let guard = &mut self.u; //~ ERROR `Umm` held across
-        //~^ ERROR `Umm` held across
 
         other().await;
 
diff --git a/src/test/ui/lint/must_not_suspend/ref.stderr b/src/test/ui/lint/must_not_suspend/ref.stderr
index d4c58bcbcd2..78b44b00625 100644
--- a/src/test/ui/lint/must_not_suspend/ref.stderr
+++ b/src/test/ui/lint/must_not_suspend/ref.stderr
@@ -3,7 +3,7 @@ error: `Umm` held across a suspend point, but should not be
    |
 LL |         let guard = &mut self.u;
    |                          ^^^^^^
-...
+LL | 
 LL |         other().await;
    |         ------------- the value is held across this suspend point
    |
@@ -23,25 +23,5 @@ help: consider using a block (`{ ... }`) to shrink the value's scope, ending bef
 LL |         let guard = &mut self.u;
    |                          ^^^^^^
 
-error: `Umm` held across a suspend point, but should not be
-  --> $DIR/ref.rs:18:26
-   |
-LL |         let guard = &mut self.u;
-   |                          ^^^^^^
-...
-LL |         other().await;
-   |         ------------- the value is held across this suspend point
-   |
-note: You gotta use Umm's, ya know?
-  --> $DIR/ref.rs:18:26
-   |
-LL |         let guard = &mut self.u;
-   |                          ^^^^^^
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
-  --> $DIR/ref.rs:18:26
-   |
-LL |         let guard = &mut self.u;
-   |                          ^^^^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error