diff options
| author | Gus Wynn <guswynn@gmail.com> | 2021-09-15 11:48:34 -0700 |
|---|---|---|
| committer | Gus Wynn <guswynn@gmail.com> | 2021-09-15 11:48:34 -0700 |
| commit | 110aecd23eefa603ffd1b5d8f64832230d42b435 (patch) | |
| tree | 67c85a49f6c8fe1038859ccd583455672dd4938e /src/test/ui/lint | |
| parent | 2af1ebfbdf01e4aa43fd9b1b5af602b545101e1f (diff) | |
| download | rust-110aecd23eefa603ffd1b5d8f64832230d42b435.tar.gz rust-110aecd23eefa603ffd1b5d8f64832230d42b435.zip | |
factor into struct, and comments
Diffstat (limited to 'src/test/ui/lint')
| -rw-r--r-- | src/test/ui/lint/must_not_suspend/boxed.stderr | 6 | ||||
| -rw-r--r-- | src/test/ui/lint/must_not_suspend/handled.rs | 28 | ||||
| -rw-r--r-- | src/test/ui/lint/must_not_suspend/ref.stderr | 12 | ||||
| -rw-r--r-- | src/test/ui/lint/must_not_suspend/trait.stderr | 12 | ||||
| -rw-r--r-- | src/test/ui/lint/must_not_suspend/unit.stderr | 6 | ||||
| -rw-r--r-- | src/test/ui/lint/must_not_suspend/warn.stderr | 6 |
6 files changed, 49 insertions, 21 deletions
diff --git a/src/test/ui/lint/must_not_suspend/boxed.stderr b/src/test/ui/lint/must_not_suspend/boxed.stderr index 7bd80405b5d..edc62b6d687 100644 --- a/src/test/ui/lint/must_not_suspend/boxed.stderr +++ b/src/test/ui/lint/must_not_suspend/boxed.stderr @@ -1,10 +1,10 @@ -error: boxed `Umm` held across a yield point, but should not be +error: boxed `Umm` held across a suspend point, but should not be --> $DIR/boxed.rs:20:9 | LL | let _guard = bar(); | ^^^^^^ LL | other().await; - | ------------- the value is held across this yield point + | ------------- the value is held across this suspend point | note: the lint level is defined here --> $DIR/boxed.rs:3:9 @@ -16,7 +16,7 @@ note: You gotta use Umm's, ya know? | LL | let _guard = bar(); | ^^^^^^ -help: `drop` this value before the yield point, or use a block (`{ ... }`) to shrink its scope +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point --> $DIR/boxed.rs:20:9 | LL | let _guard = bar(); diff --git a/src/test/ui/lint/must_not_suspend/handled.rs b/src/test/ui/lint/must_not_suspend/handled.rs new file mode 100644 index 00000000000..8714be6449f --- /dev/null +++ b/src/test/ui/lint/must_not_suspend/handled.rs @@ -0,0 +1,28 @@ +// edition:2018 +// run-pass +#![feature(must_not_suspend)] +#![deny(must_not_suspend)] + +#[must_not_suspend = "You gotta use Umm's, ya know?"] +struct Umm { + _i: i64 +} + + +fn bar() -> Umm { + Umm { + _i: 1 + } +} + +async fn other() {} + +pub async fn uhoh() { + { + let _guard = bar(); + } + other().await; +} + +fn main() { +} diff --git a/src/test/ui/lint/must_not_suspend/ref.stderr b/src/test/ui/lint/must_not_suspend/ref.stderr index d2a550d7b45..d4c58bcbcd2 100644 --- a/src/test/ui/lint/must_not_suspend/ref.stderr +++ b/src/test/ui/lint/must_not_suspend/ref.stderr @@ -1,11 +1,11 @@ -error: `Umm` held across a yield point, but should not be +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 yield point + | ------------- the value is held across this suspend point | note: the lint level is defined here --> $DIR/ref.rs:3:9 @@ -17,27 +17,27 @@ note: You gotta use Umm's, ya know? | LL | let guard = &mut self.u; | ^^^^^^ -help: `drop` this value before the yield point, or use a block (`{ ... }`) to shrink its scope +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: `Umm` held across a yield point, but should not be +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 yield point + | ------------- 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: `drop` this value before the yield point, or use a block (`{ ... }`) to shrink its scope +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; diff --git a/src/test/ui/lint/must_not_suspend/trait.stderr b/src/test/ui/lint/must_not_suspend/trait.stderr index 8d7bb808764..d19ffddd482 100644 --- a/src/test/ui/lint/must_not_suspend/trait.stderr +++ b/src/test/ui/lint/must_not_suspend/trait.stderr @@ -1,33 +1,33 @@ -error: implementer of `Wow` held across a yield point, but should not be +error: implementer of `Wow` held across a suspend point, but should not be --> $DIR/trait.rs:21:9 | LL | let _guard1 = r#impl(); | ^^^^^^^ ... LL | other().await; - | ------------- the value is held across this yield point + | ------------- 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: `drop` this value before the yield point, or use a block (`{ ... }`) to shrink its scope +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(); | ^^^^^^^ -error: boxed `Wow` trait object held across a yield point, but should not be +error: boxed `Wow` trait object held across a suspend point, but should not be --> $DIR/trait.rs:22:9 | LL | let _guard2 = r#dyn(); | ^^^^^^^ LL | LL | other().await; - | ------------- the value is held across this yield point + | ------------- the value is held across this suspend point | -help: `drop` this value before the yield point, or use a block (`{ ... }`) to shrink its scope +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point --> $DIR/trait.rs:22:9 | LL | let _guard2 = r#dyn(); diff --git a/src/test/ui/lint/must_not_suspend/unit.stderr b/src/test/ui/lint/must_not_suspend/unit.stderr index 87e0fd27e70..425c076823d 100644 --- a/src/test/ui/lint/must_not_suspend/unit.stderr +++ b/src/test/ui/lint/must_not_suspend/unit.stderr @@ -1,10 +1,10 @@ -error: `Umm` held across a yield point, but should not be +error: `Umm` held across a suspend point, but should not be --> $DIR/unit.rs:20:9 | LL | let _guard = bar(); | ^^^^^^ LL | other().await; - | ------------- the value is held across this yield point + | ------------- the value is held across this suspend point | note: the lint level is defined here --> $DIR/unit.rs:3:9 @@ -16,7 +16,7 @@ note: You gotta use Umm's, ya know? | LL | let _guard = bar(); | ^^^^^^ -help: `drop` this value before the yield point, or use a block (`{ ... }`) to shrink its scope +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point --> $DIR/unit.rs:20:9 | LL | let _guard = bar(); diff --git a/src/test/ui/lint/must_not_suspend/warn.stderr b/src/test/ui/lint/must_not_suspend/warn.stderr index 03b77520c9f..24f52275b43 100644 --- a/src/test/ui/lint/must_not_suspend/warn.stderr +++ b/src/test/ui/lint/must_not_suspend/warn.stderr @@ -1,10 +1,10 @@ -warning: `Umm` held across a yield point, but should not be +warning: `Umm` held across a suspend point, but should not be --> $DIR/warn.rs:20:9 | LL | let _guard = bar(); | ^^^^^^ LL | other().await; - | ------------- the value is held across this yield point + | ------------- the value is held across this suspend point | = note: `#[warn(must_not_suspend)]` on by default note: You gotta use Umm's, ya know? @@ -12,7 +12,7 @@ note: You gotta use Umm's, ya know? | LL | let _guard = bar(); | ^^^^^^ -help: `drop` this value before the yield point, or use a block (`{ ... }`) to shrink its scope +help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point --> $DIR/warn.rs:20:9 | LL | let _guard = bar(); |
