diff options
Diffstat (limited to 'src/test/ui/lint/must_not_suspend')
-rw-r--r-- | src/test/ui/lint/must_not_suspend/boxed.stderr | 10 | ||||
-rw-r--r-- | src/test/ui/lint/must_not_suspend/dedup.stderr | 10 | ||||
-rw-r--r-- | src/test/ui/lint/must_not_suspend/gated.stderr | 2 | ||||
-rw-r--r-- | src/test/ui/lint/must_not_suspend/mutex.stderr | 10 | ||||
-rw-r--r-- | src/test/ui/lint/must_not_suspend/ref-drop-tracking.rs | 30 | ||||
-rw-r--r-- | src/test/ui/lint/must_not_suspend/ref-drop-tracking.stderr | 27 | ||||
-rw-r--r-- | src/test/ui/lint/must_not_suspend/ref.drop_tracking.stderr | 27 | ||||
-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) | 16 | ||||
-rw-r--r-- | src/test/ui/lint/must_not_suspend/ref.rs | 12 | ||||
-rw-r--r-- | src/test/ui/lint/must_not_suspend/trait.stderr | 10 | ||||
-rw-r--r-- | src/test/ui/lint/must_not_suspend/unit.stderr | 10 | ||||
-rw-r--r-- | src/test/ui/lint/must_not_suspend/warn.stderr | 10 |
12 files changed, 129 insertions, 45 deletions
diff --git a/src/test/ui/lint/must_not_suspend/boxed.stderr b/src/test/ui/lint/must_not_suspend/boxed.stderr index b3c9b4381..9efc7b069 100644 --- a/src/test/ui/lint/must_not_suspend/boxed.stderr +++ b/src/test/ui/lint/must_not_suspend/boxed.stderr @@ -6,11 +6,6 @@ LL | let _guard = bar(); LL | other().await; | ------ the value is held across this suspend point | -note: the lint level is defined here - --> $DIR/boxed.rs:3:9 - | -LL | #![deny(must_not_suspend)] - | ^^^^^^^^^^^^^^^^ note: You gotta use Umm's, ya know? --> $DIR/boxed.rs:20:9 | @@ -21,6 +16,11 @@ help: consider using a block (`{ ... }`) to shrink the value's scope, ending bef | LL | let _guard = bar(); | ^^^^^^ +note: the lint level is defined here + --> $DIR/boxed.rs:3:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/lint/must_not_suspend/dedup.stderr b/src/test/ui/lint/must_not_suspend/dedup.stderr index 13fa3ae30..f8978ba57 100644 --- a/src/test/ui/lint/must_not_suspend/dedup.stderr +++ b/src/test/ui/lint/must_not_suspend/dedup.stderr @@ -4,16 +4,16 @@ error: `No` held across a suspend point, but should not be 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:13 | LL | wheeee(&No {}).await; | ^^^^^ +note: the lint level is defined here + --> $DIR/dedup.rs:3:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/lint/must_not_suspend/gated.stderr b/src/test/ui/lint/must_not_suspend/gated.stderr index b58ecb555..64de1ebea 100644 --- a/src/test/ui/lint/must_not_suspend/gated.stderr +++ b/src/test/ui/lint/must_not_suspend/gated.stderr @@ -4,10 +4,10 @@ warning: unknown lint: `must_not_suspend` LL | #![deny(must_not_suspend)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(unknown_lints)]` on by default = note: the `must_not_suspend` lint is unstable = note: see issue #83310 <https://github.com/rust-lang/rust/issues/83310> for more information = help: add `#![feature(must_not_suspend)]` to the crate attributes to enable + = note: `#[warn(unknown_lints)]` on by default warning: unknown lint: `must_not_suspend` --> $DIR/gated.rs:4:1 diff --git a/src/test/ui/lint/must_not_suspend/mutex.stderr b/src/test/ui/lint/must_not_suspend/mutex.stderr index a968b7ca0..c251cb845 100644 --- a/src/test/ui/lint/must_not_suspend/mutex.stderr +++ b/src/test/ui/lint/must_not_suspend/mutex.stderr @@ -6,11 +6,6 @@ LL | let _guard = m.lock().unwrap(); LL | other().await; | ------ the value is held across this suspend point | -note: the lint level is defined here - --> $DIR/mutex.rs:3:9 - | -LL | #![deny(must_not_suspend)] - | ^^^^^^^^^^^^^^^^ note: holding a MutexGuard across suspend points can cause deadlocks, delays, and cause Futures to not implement `Send` --> $DIR/mutex.rs:8:9 | @@ -21,6 +16,11 @@ help: consider using a block (`{ ... }`) to shrink the value's scope, ending bef | LL | let _guard = m.lock().unwrap(); | ^^^^^^ +note: the lint level is defined here + --> $DIR/mutex.rs:3:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ error: aborting due to previous error 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..180e187c1 --- /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: 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; + | ^^^^^ +note: the lint level is defined here + --> $DIR/ref-drop-tracking.rs:4:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +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..abf76711b --- /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: 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; + | ^^^^^ +note: the lint level is defined here + --> $DIR/ref.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +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..41ac09ea7 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; | ^^^^^^ @@ -7,21 +7,21 @@ LL | LL | other().await; | ------ the value is held across this suspend point | -note: the lint level is defined here - --> $DIR/ref.rs:3: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; | ^^^^^^ +note: the lint level is defined here + --> $DIR/ref.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ error: aborting due to previous error 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() {} diff --git a/src/test/ui/lint/must_not_suspend/trait.stderr b/src/test/ui/lint/must_not_suspend/trait.stderr index 60369430a..d64d25aae 100644 --- a/src/test/ui/lint/must_not_suspend/trait.stderr +++ b/src/test/ui/lint/must_not_suspend/trait.stderr @@ -7,16 +7,16 @@ LL | let _guard1 = r#impl(); LL | other().await; | ------ the value is held across this suspend point | -note: the lint level is defined here - --> $DIR/trait.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/trait.rs:21:9 | LL | let _guard1 = r#impl(); | ^^^^^^^ +note: the lint level is defined here + --> $DIR/trait.rs:3:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ error: boxed `Wow` trait object held across a suspend point, but should not be --> $DIR/trait.rs:22:9 diff --git a/src/test/ui/lint/must_not_suspend/unit.stderr b/src/test/ui/lint/must_not_suspend/unit.stderr index 42d037b35..c967dbac5 100644 --- a/src/test/ui/lint/must_not_suspend/unit.stderr +++ b/src/test/ui/lint/must_not_suspend/unit.stderr @@ -6,11 +6,6 @@ LL | let _guard = bar(); LL | other().await; | ------ the value is held across this suspend point | -note: the lint level is defined here - --> $DIR/unit.rs:3:9 - | -LL | #![deny(must_not_suspend)] - | ^^^^^^^^^^^^^^^^ note: You gotta use Umm's, ya know? --> $DIR/unit.rs:20:9 | @@ -21,6 +16,11 @@ help: consider using a block (`{ ... }`) to shrink the value's scope, ending bef | LL | let _guard = bar(); | ^^^^^^ +note: the lint level is defined here + --> $DIR/unit.rs:3:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/lint/must_not_suspend/warn.stderr b/src/test/ui/lint/must_not_suspend/warn.stderr index 417c397da..fe551c652 100644 --- a/src/test/ui/lint/must_not_suspend/warn.stderr +++ b/src/test/ui/lint/must_not_suspend/warn.stderr @@ -6,11 +6,6 @@ LL | let _guard = bar(); LL | other().await; | ------ the value is held across this suspend point | -note: the lint level is defined here - --> $DIR/warn.rs:4:9 - | -LL | #![warn(must_not_suspend)] - | ^^^^^^^^^^^^^^^^ note: You gotta use Umm's, ya know? --> $DIR/warn.rs:21:9 | @@ -21,6 +16,11 @@ help: consider using a block (`{ ... }`) to shrink the value's scope, ending bef | LL | let _guard = bar(); | ^^^^^^ +note: the lint level is defined here + --> $DIR/warn.rs:4:9 + | +LL | #![warn(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ warning: 1 warning emitted |