summaryrefslogtreecommitdiffstats
path: root/src/test/ui/lint/must_not_suspend
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/lint/must_not_suspend')
-rw-r--r--src/test/ui/lint/must_not_suspend/ref-drop-tracking.rs30
-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.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
5 files changed, 94 insertions, 10 deletions
diff --git a/src/test/ui/lint/must_not_suspend/ref-drop-tracking.rs b/src/test/ui/lint/must_not_suspend/ref-drop-tracking.rs
new file mode 100644
index 000000000..1bc4a3812
--- /dev/null
+++ b/src/test/ui/lint/must_not_suspend/ref-drop-tracking.rs
@@ -0,0 +1,30 @@
+// edition:2018
+// compile-flags: -Zdrop-tracking
+#![feature(must_not_suspend)]
+#![deny(must_not_suspend)]
+
+#[must_not_suspend = "You gotta use Umm's, ya know?"]
+struct Umm {
+ i: i64
+}
+
+struct Bar {
+ u: Umm,
+}
+
+async fn other() {}
+
+impl Bar {
+ async fn uhoh(&mut self) {
+ let guard = &mut self.u; //~ ERROR `Umm` held across
+
+ other().await;
+
+ *guard = Umm {
+ i: 2
+ }
+ }
+}
+
+fn main() {
+}
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 000000000..c49d27128
--- /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-drop-tracking.rs:19: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-drop-tracking.rs:4:9
+ |
+LL | #![deny(must_not_suspend)]
+ | ^^^^^^^^^^^^^^^^
+note: You gotta use Umm's, ya know?
+ --> $DIR/ref-drop-tracking.rs:19: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-drop-tracking.rs:19:13
+ |
+LL | let guard = &mut self.u;
+ | ^^^^^
+
+error: aborting due to previous error
+
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 000000000..0157c8b7f
--- /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 5f000014c..438e6489e 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 738dd9e04..f6b23746f 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() {}