diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:50 +0000 |
commit | 2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35 (patch) | |
tree | d325add32978dbdc1db975a438b3a77d571b1ab8 /tests/ui/lint/must_not_suspend | |
parent | Releasing progress-linux version 1.68.2+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.tar.xz rustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.zip |
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/lint/must_not_suspend')
25 files changed, 419 insertions, 30 deletions
diff --git a/tests/ui/lint/must_not_suspend/dedup.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/dedup.drop_tracking.stderr new file mode 100644 index 000000000..262657da5 --- /dev/null +++ b/tests/ui/lint/must_not_suspend/dedup.drop_tracking.stderr @@ -0,0 +1,21 @@ +error: `No` held across a suspend point, but should not be + --> $DIR/dedup.rs:19:9 + | +LL | let no = No {}; + | ^^ +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/dedup.rs:19:9 + | +LL | let no = No {}; + | ^^ +note: the lint level is defined here + --> $DIR/dedup.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/lint/must_not_suspend/dedup.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/dedup.drop_tracking_mir.stderr new file mode 100644 index 000000000..262657da5 --- /dev/null +++ b/tests/ui/lint/must_not_suspend/dedup.drop_tracking_mir.stderr @@ -0,0 +1,21 @@ +error: `No` held across a suspend point, but should not be + --> $DIR/dedup.rs:19:9 + | +LL | let no = No {}; + | ^^ +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/dedup.rs:19:9 + | +LL | let no = No {}; + | ^^ +note: the lint level is defined here + --> $DIR/dedup.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/lint/must_not_suspend/dedup.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/dedup.no_drop_tracking.stderr new file mode 100644 index 000000000..7ed43d257 --- /dev/null +++ b/tests/ui/lint/must_not_suspend/dedup.no_drop_tracking.stderr @@ -0,0 +1,33 @@ +error: `No` held across a suspend point, but should not be + --> $DIR/dedup.rs:19:9 + | +LL | let no = No {}; + | ^^ +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/dedup.rs:19:9 + | +LL | let no = No {}; + | ^^ +note: the lint level is defined here + --> $DIR/dedup.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +error: `No` held across a suspend point, but should not be + --> $DIR/dedup.rs:20:13 + | +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/dedup.rs:20:13 + | +LL | wheeee(&no).await; + | ^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lint/must_not_suspend/dedup.rs b/tests/ui/lint/must_not_suspend/dedup.rs index 81a08579b..96bdb7715 100644 --- a/tests/ui/lint/must_not_suspend/dedup.rs +++ b/tests/ui/lint/must_not_suspend/dedup.rs @@ -1,3 +1,6 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // edition:2018 #![feature(must_not_suspend)] #![deny(must_not_suspend)] @@ -13,7 +16,9 @@ async fn wheeee<T>(t: T) { } async fn yes() { - wheeee(&No {}).await; //~ ERROR `No` held across + let no = No {}; //~ ERROR `No` held across + wheeee(&no).await; //[no_drop_tracking]~ ERROR `No` held across + drop(no); } fn main() { diff --git a/tests/ui/lint/must_not_suspend/dedup.stderr b/tests/ui/lint/must_not_suspend/dedup.stderr index f8978ba57..18880f5a7 100644 --- a/tests/ui/lint/must_not_suspend/dedup.stderr +++ b/tests/ui/lint/must_not_suspend/dedup.stderr @@ -1,16 +1,16 @@ error: `No` held across a suspend point, but should not be - --> $DIR/dedup.rs:16:13 + --> $DIR/dedup.rs:19:13 | 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/dedup.rs:16:13 + --> $DIR/dedup.rs:19:13 | LL | wheeee(&No {}).await; | ^^^^^ note: the lint level is defined here - --> $DIR/dedup.rs:3:9 + --> $DIR/dedup.rs:6:9 | LL | #![deny(must_not_suspend)] | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/must_not_suspend/ref.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/ref.drop_tracking.stderr index abf76711b..e3628ca5e 100644 --- a/tests/ui/lint/must_not_suspend/ref.drop_tracking.stderr +++ b/tests/ui/lint/must_not_suspend/ref.drop_tracking.stderr @@ -1,5 +1,5 @@ error: reference to `Umm` held across a suspend point, but should not be - --> $DIR/ref.rs:21:13 + --> $DIR/ref.rs:22:13 | LL | let guard = &mut self.u; | ^^^^^ @@ -8,17 +8,17 @@ LL | other().await; | ------ the value is held across this suspend point | note: You gotta use Umm's, ya know? - --> $DIR/ref.rs:21:13 + --> $DIR/ref.rs:22: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 + --> $DIR/ref.rs:22:13 | LL | let guard = &mut self.u; | ^^^^^ note: the lint level is defined here - --> $DIR/ref.rs:6:9 + --> $DIR/ref.rs:7:9 | LL | #![deny(must_not_suspend)] | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/must_not_suspend/ref.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/ref.drop_tracking_mir.stderr new file mode 100644 index 000000000..e3628ca5e --- /dev/null +++ b/tests/ui/lint/must_not_suspend/ref.drop_tracking_mir.stderr @@ -0,0 +1,27 @@ +error: reference to `Umm` held across a suspend point, but should not be + --> $DIR/ref.rs:22: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:22: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:22:13 + | +LL | let guard = &mut self.u; + | ^^^^^ +note: the lint level is defined here + --> $DIR/ref.rs:7:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr index 41ac09ea7..e9bfa08b5 100644 --- a/tests/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr +++ b/tests/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:21:26 + --> $DIR/ref.rs:22:26 | LL | let guard = &mut self.u; | ^^^^^^ @@ -8,17 +8,17 @@ LL | other().await; | ------ the value is held across this suspend point | note: You gotta use Umm's, ya know? - --> $DIR/ref.rs:21:26 + --> $DIR/ref.rs:22: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:21:26 + --> $DIR/ref.rs:22:26 | LL | let guard = &mut self.u; | ^^^^^^ note: the lint level is defined here - --> $DIR/ref.rs:6:9 + --> $DIR/ref.rs:7:9 | LL | #![deny(must_not_suspend)] | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/must_not_suspend/ref.rs b/tests/ui/lint/must_not_suspend/ref.rs index f6b23746f..d05dcb83a 100644 --- a/tests/ui/lint/must_not_suspend/ref.rs +++ b/tests/ui/lint/must_not_suspend/ref.rs @@ -1,7 +1,8 @@ // edition:2018 -// revisions: no_drop_tracking drop_tracking -// [drop_tracking] compile-flags: -Zdrop-tracking=yes -// [no_drop_tracking] compile-flags: -Zdrop-tracking=no +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir + #![feature(must_not_suspend)] #![deny(must_not_suspend)] @@ -22,6 +23,7 @@ impl Bar { other().await; + let _g = &*guard; *guard = Umm { i: 2 } } } diff --git a/tests/ui/lint/must_not_suspend/trait.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/trait.drop_tracking.stderr new file mode 100644 index 000000000..6e62a228a --- /dev/null +++ b/tests/ui/lint/must_not_suspend/trait.drop_tracking.stderr @@ -0,0 +1,37 @@ +error: implementer of `Wow` held across a suspend point, but should not be + --> $DIR/trait.rs:24:9 + | +LL | let _guard1 = r#impl(); + | ^^^^^^^ +... +LL | other().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/trait.rs:24:9 + | +LL | let _guard1 = r#impl(); + | ^^^^^^^ +note: the lint level is defined here + --> $DIR/trait.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +error: boxed `Wow` trait object held across a suspend point, but should not be + --> $DIR/trait.rs:25:9 + | +LL | let _guard2 = r#dyn(); + | ^^^^^^^ +LL | +LL | other().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/trait.rs:25:9 + | +LL | let _guard2 = r#dyn(); + | ^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lint/must_not_suspend/trait.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/trait.drop_tracking_mir.stderr new file mode 100644 index 000000000..6e62a228a --- /dev/null +++ b/tests/ui/lint/must_not_suspend/trait.drop_tracking_mir.stderr @@ -0,0 +1,37 @@ +error: implementer of `Wow` held across a suspend point, but should not be + --> $DIR/trait.rs:24:9 + | +LL | let _guard1 = r#impl(); + | ^^^^^^^ +... +LL | other().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/trait.rs:24:9 + | +LL | let _guard1 = r#impl(); + | ^^^^^^^ +note: the lint level is defined here + --> $DIR/trait.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +error: boxed `Wow` trait object held across a suspend point, but should not be + --> $DIR/trait.rs:25:9 + | +LL | let _guard2 = r#dyn(); + | ^^^^^^^ +LL | +LL | other().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/trait.rs:25:9 + | +LL | let _guard2 = r#dyn(); + | ^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lint/must_not_suspend/trait.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/trait.no_drop_tracking.stderr new file mode 100644 index 000000000..6e62a228a --- /dev/null +++ b/tests/ui/lint/must_not_suspend/trait.no_drop_tracking.stderr @@ -0,0 +1,37 @@ +error: implementer of `Wow` held across a suspend point, but should not be + --> $DIR/trait.rs:24:9 + | +LL | let _guard1 = r#impl(); + | ^^^^^^^ +... +LL | other().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/trait.rs:24:9 + | +LL | let _guard1 = r#impl(); + | ^^^^^^^ +note: the lint level is defined here + --> $DIR/trait.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +error: boxed `Wow` trait object held across a suspend point, but should not be + --> $DIR/trait.rs:25:9 + | +LL | let _guard2 = r#dyn(); + | ^^^^^^^ +LL | +LL | other().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/trait.rs:25:9 + | +LL | let _guard2 = r#dyn(); + | ^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lint/must_not_suspend/trait.rs b/tests/ui/lint/must_not_suspend/trait.rs index 6c911cb4b..cc3ae298d 100644 --- a/tests/ui/lint/must_not_suspend/trait.rs +++ b/tests/ui/lint/must_not_suspend/trait.rs @@ -1,3 +1,6 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // edition:2018 #![feature(must_not_suspend)] #![deny(must_not_suspend)] @@ -22,6 +25,9 @@ pub async fn uhoh() { let _guard2 = r#dyn(); //~ ERROR boxed `Wow` trait object held across other().await; + + drop(_guard1); + drop(_guard2); } fn main() { diff --git a/tests/ui/lint/must_not_suspend/trait.stderr b/tests/ui/lint/must_not_suspend/trait.stderr index d64d25aae..6e62a228a 100644 --- a/tests/ui/lint/must_not_suspend/trait.stderr +++ b/tests/ui/lint/must_not_suspend/trait.stderr @@ -1,5 +1,5 @@ error: implementer of `Wow` held across a suspend point, but should not be - --> $DIR/trait.rs:21:9 + --> $DIR/trait.rs:24:9 | LL | let _guard1 = r#impl(); | ^^^^^^^ @@ -8,18 +8,18 @@ LL | other().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/trait.rs:21:9 + --> $DIR/trait.rs:24:9 | LL | let _guard1 = r#impl(); | ^^^^^^^ note: the lint level is defined here - --> $DIR/trait.rs:3:9 + --> $DIR/trait.rs:6: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 + --> $DIR/trait.rs:25:9 | LL | let _guard2 = r#dyn(); | ^^^^^^^ @@ -28,7 +28,7 @@ LL | other().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/trait.rs:22:9 + --> $DIR/trait.rs:25:9 | LL | let _guard2 = r#dyn(); | ^^^^^^^ diff --git a/tests/ui/lint/must_not_suspend/tuple-mismatch.stderr b/tests/ui/lint/must_not_suspend/tuple-mismatch.stderr index cca8cd9bd..294476107 100644 --- a/tests/ui/lint/must_not_suspend/tuple-mismatch.stderr +++ b/tests/ui/lint/must_not_suspend/tuple-mismatch.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/tuple-mismatch.rs:6:20 | LL | yield ((), ()); - | ^^ expected tuple, found `()` + | ^^ expected `((), ())`, found `()` | = note: expected tuple `((), ())` found unit type `()` diff --git a/tests/ui/lint/must_not_suspend/unit.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/unit.drop_tracking.stderr new file mode 100644 index 000000000..f89b3e341 --- /dev/null +++ b/tests/ui/lint/must_not_suspend/unit.drop_tracking.stderr @@ -0,0 +1,26 @@ +error: `Umm` held across a suspend point, but should not be + --> $DIR/unit.rs:22:9 + | +LL | let _guard = bar(); + | ^^^^^^ +LL | other().await; + | ------ the value is held across this suspend point + | +note: You gotta use Umm's, ya know? + --> $DIR/unit.rs:22:9 + | +LL | let _guard = bar(); + | ^^^^^^ +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/unit.rs:22:9 + | +LL | let _guard = bar(); + | ^^^^^^ +note: the lint level is defined here + --> $DIR/unit.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/lint/must_not_suspend/unit.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/unit.drop_tracking_mir.stderr new file mode 100644 index 000000000..f89b3e341 --- /dev/null +++ b/tests/ui/lint/must_not_suspend/unit.drop_tracking_mir.stderr @@ -0,0 +1,26 @@ +error: `Umm` held across a suspend point, but should not be + --> $DIR/unit.rs:22:9 + | +LL | let _guard = bar(); + | ^^^^^^ +LL | other().await; + | ------ the value is held across this suspend point + | +note: You gotta use Umm's, ya know? + --> $DIR/unit.rs:22:9 + | +LL | let _guard = bar(); + | ^^^^^^ +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/unit.rs:22:9 + | +LL | let _guard = bar(); + | ^^^^^^ +note: the lint level is defined here + --> $DIR/unit.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/lint/must_not_suspend/unit.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/unit.no_drop_tracking.stderr new file mode 100644 index 000000000..f89b3e341 --- /dev/null +++ b/tests/ui/lint/must_not_suspend/unit.no_drop_tracking.stderr @@ -0,0 +1,26 @@ +error: `Umm` held across a suspend point, but should not be + --> $DIR/unit.rs:22:9 + | +LL | let _guard = bar(); + | ^^^^^^ +LL | other().await; + | ------ the value is held across this suspend point + | +note: You gotta use Umm's, ya know? + --> $DIR/unit.rs:22:9 + | +LL | let _guard = bar(); + | ^^^^^^ +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/unit.rs:22:9 + | +LL | let _guard = bar(); + | ^^^^^^ +note: the lint level is defined here + --> $DIR/unit.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/lint/must_not_suspend/unit.rs b/tests/ui/lint/must_not_suspend/unit.rs index d3a19f704..fbc51b366 100644 --- a/tests/ui/lint/must_not_suspend/unit.rs +++ b/tests/ui/lint/must_not_suspend/unit.rs @@ -1,3 +1,6 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // edition:2018 #![feature(must_not_suspend)] #![deny(must_not_suspend)] @@ -7,7 +10,6 @@ struct Umm { i: i64 } - fn bar() -> Umm { Umm { i: 1 @@ -19,6 +21,7 @@ async fn other() {} pub async fn uhoh() { let _guard = bar(); //~ ERROR `Umm` held across other().await; + drop(_guard); } fn main() { diff --git a/tests/ui/lint/must_not_suspend/unit.stderr b/tests/ui/lint/must_not_suspend/unit.stderr index c967dbac5..50ca292c2 100644 --- a/tests/ui/lint/must_not_suspend/unit.stderr +++ b/tests/ui/lint/must_not_suspend/unit.stderr @@ -1,5 +1,5 @@ error: `Umm` held across a suspend point, but should not be - --> $DIR/unit.rs:20:9 + --> $DIR/unit.rs:23:9 | LL | let _guard = bar(); | ^^^^^^ @@ -7,17 +7,17 @@ LL | other().await; | ------ the value is held across this suspend point | note: You gotta use Umm's, ya know? - --> $DIR/unit.rs:20:9 + --> $DIR/unit.rs:23:9 | LL | let _guard = bar(); | ^^^^^^ help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point - --> $DIR/unit.rs:20:9 + --> $DIR/unit.rs:23:9 | LL | let _guard = bar(); | ^^^^^^ note: the lint level is defined here - --> $DIR/unit.rs:3:9 + --> $DIR/unit.rs:6:9 | LL | #![deny(must_not_suspend)] | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/must_not_suspend/warn.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/warn.drop_tracking.stderr new file mode 100644 index 000000000..7a422891a --- /dev/null +++ b/tests/ui/lint/must_not_suspend/warn.drop_tracking.stderr @@ -0,0 +1,26 @@ +warning: `Umm` held across a suspend point, but should not be + --> $DIR/warn.rs:24:9 + | +LL | let _guard = bar(); + | ^^^^^^ +LL | other().await; + | ------ the value is held across this suspend point + | +note: You gotta use Umm's, ya know? + --> $DIR/warn.rs:24:9 + | +LL | let _guard = bar(); + | ^^^^^^ +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/warn.rs:24:9 + | +LL | let _guard = bar(); + | ^^^^^^ +note: the lint level is defined here + --> $DIR/warn.rs:7:9 + | +LL | #![warn(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +warning: 1 warning emitted + diff --git a/tests/ui/lint/must_not_suspend/warn.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/warn.drop_tracking_mir.stderr new file mode 100644 index 000000000..7a422891a --- /dev/null +++ b/tests/ui/lint/must_not_suspend/warn.drop_tracking_mir.stderr @@ -0,0 +1,26 @@ +warning: `Umm` held across a suspend point, but should not be + --> $DIR/warn.rs:24:9 + | +LL | let _guard = bar(); + | ^^^^^^ +LL | other().await; + | ------ the value is held across this suspend point + | +note: You gotta use Umm's, ya know? + --> $DIR/warn.rs:24:9 + | +LL | let _guard = bar(); + | ^^^^^^ +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/warn.rs:24:9 + | +LL | let _guard = bar(); + | ^^^^^^ +note: the lint level is defined here + --> $DIR/warn.rs:7:9 + | +LL | #![warn(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +warning: 1 warning emitted + diff --git a/tests/ui/lint/must_not_suspend/warn.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/warn.no_drop_tracking.stderr new file mode 100644 index 000000000..7a422891a --- /dev/null +++ b/tests/ui/lint/must_not_suspend/warn.no_drop_tracking.stderr @@ -0,0 +1,26 @@ +warning: `Umm` held across a suspend point, but should not be + --> $DIR/warn.rs:24:9 + | +LL | let _guard = bar(); + | ^^^^^^ +LL | other().await; + | ------ the value is held across this suspend point + | +note: You gotta use Umm's, ya know? + --> $DIR/warn.rs:24:9 + | +LL | let _guard = bar(); + | ^^^^^^ +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point + --> $DIR/warn.rs:24:9 + | +LL | let _guard = bar(); + | ^^^^^^ +note: the lint level is defined here + --> $DIR/warn.rs:7:9 + | +LL | #![warn(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ + +warning: 1 warning emitted + diff --git a/tests/ui/lint/must_not_suspend/warn.rs b/tests/ui/lint/must_not_suspend/warn.rs index 7fdea66a2..5a4863169 100644 --- a/tests/ui/lint/must_not_suspend/warn.rs +++ b/tests/ui/lint/must_not_suspend/warn.rs @@ -1,3 +1,6 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // edition:2018 // run-pass #![feature(must_not_suspend)] @@ -20,6 +23,7 @@ async fn other() {} pub async fn uhoh() { let _guard = bar(); //~ WARNING `Umm` held across other().await; + drop(_guard); } fn main() { diff --git a/tests/ui/lint/must_not_suspend/warn.stderr b/tests/ui/lint/must_not_suspend/warn.stderr index fe551c652..7a422891a 100644 --- a/tests/ui/lint/must_not_suspend/warn.stderr +++ b/tests/ui/lint/must_not_suspend/warn.stderr @@ -1,5 +1,5 @@ warning: `Umm` held across a suspend point, but should not be - --> $DIR/warn.rs:21:9 + --> $DIR/warn.rs:24:9 | LL | let _guard = bar(); | ^^^^^^ @@ -7,17 +7,17 @@ LL | other().await; | ------ the value is held across this suspend point | note: You gotta use Umm's, ya know? - --> $DIR/warn.rs:21:9 + --> $DIR/warn.rs:24:9 | LL | let _guard = bar(); | ^^^^^^ help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point - --> $DIR/warn.rs:21:9 + --> $DIR/warn.rs:24:9 | LL | let _guard = bar(); | ^^^^^^ note: the lint level is defined here - --> $DIR/warn.rs:4:9 + --> $DIR/warn.rs:7:9 | LL | #![warn(must_not_suspend)] | ^^^^^^^^^^^^^^^^ |