about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEric Holk <ericholk@microsoft.com>2022-09-13 14:44:11 -0700
committerEric Holk <ericholk@microsoft.com>2022-09-13 15:16:19 -0700
commit87bb475ae7f18fe57f081daaf95e5e47520163c8 (patch)
tree2d230d217b269beb77cda68640c4d8aac827e295 /src
parent5671a7611924fef91cc69d6a394412f4e990e4e4 (diff)
downloadrust-87bb475ae7f18fe57f081daaf95e5e47520163c8.tar.gz
rust-87bb475ae7f18fe57f081daaf95e5e47520163c8.zip
Update must_not_suspend/ref.rs
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/lint/must_not_suspend/ref.drop_tracking.stderr27
-rw-r--r--src/test/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr (renamed from src/test/ui/lint/must_not_suspend/ref.stderr)8
-rw-r--r--src/test/ui/lint/must_not_suspend/ref.rs12
3 files changed, 37 insertions, 10 deletions
diff --git a/src/test/ui/lint/must_not_suspend/ref.drop_tracking.stderr b/src/test/ui/lint/must_not_suspend/ref.drop_tracking.stderr
new file mode 100644
index 00000000000..0157c8b7fe1
--- /dev/null
+++ b/src/test/ui/lint/must_not_suspend/ref.drop_tracking.stderr
@@ -0,0 +1,27 @@
+error: reference to `Umm` held across a suspend point, but should not be
+  --> $DIR/ref.rs:21:13
+   |
+LL |         let guard = &mut self.u;
+   |             ^^^^^
+LL |
+LL |         other().await;
+   |                ------ the value is held across this suspend point
+   |
+note: the lint level is defined here
+  --> $DIR/ref.rs:6:9
+   |
+LL | #![deny(must_not_suspend)]
+   |         ^^^^^^^^^^^^^^^^
+note: You gotta use Umm's, ya know?
+  --> $DIR/ref.rs:21:13
+   |
+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:21:13
+   |
+LL |         let guard = &mut self.u;
+   |             ^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lint/must_not_suspend/ref.stderr b/src/test/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr
index 5f000014c7d..438e6489e31 100644
--- a/src/test/ui/lint/must_not_suspend/ref.stderr
+++ b/src/test/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr
@@ -1,5 +1,5 @@
 error: `Umm` held across a suspend point, but should not be
-  --> $DIR/ref.rs:18:26
+  --> $DIR/ref.rs:21:26
    |
 LL |         let guard = &mut self.u;
    |                          ^^^^^^
@@ -8,17 +8,17 @@ LL |         other().await;
    |                ------ the value is held across this suspend point
    |
 note: the lint level is defined here
-  --> $DIR/ref.rs:3:9
+  --> $DIR/ref.rs:6:9
    |
 LL | #![deny(must_not_suspend)]
    |         ^^^^^^^^^^^^^^^^
 note: You gotta use Umm's, ya know?
-  --> $DIR/ref.rs:18:26
+  --> $DIR/ref.rs:21: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
+  --> $DIR/ref.rs:21:26
    |
 LL |         let guard = &mut self.u;
    |                          ^^^^^^
diff --git a/src/test/ui/lint/must_not_suspend/ref.rs b/src/test/ui/lint/must_not_suspend/ref.rs
index 738dd9e0465..f6b23746fef 100644
--- a/src/test/ui/lint/must_not_suspend/ref.rs
+++ b/src/test/ui/lint/must_not_suspend/ref.rs
@@ -1,10 +1,13 @@
 // edition:2018
+// revisions: no_drop_tracking drop_tracking
+// [drop_tracking] compile-flags: -Zdrop-tracking=yes
+// [no_drop_tracking] compile-flags: -Zdrop-tracking=no
 #![feature(must_not_suspend)]
 #![deny(must_not_suspend)]
 
 #[must_not_suspend = "You gotta use Umm's, ya know?"]
 struct Umm {
-    i: i64
+    i: i64,
 }
 
 struct Bar {
@@ -19,11 +22,8 @@ impl Bar {
 
         other().await;
 
-        *guard = Umm {
-            i: 2
-        }
+        *guard = Umm { i: 2 }
     }
 }
 
-fn main() {
-}
+fn main() {}