factor into struct, and comments
This commit is contained in:
parent
2af1ebfbdf
commit
110aecd23e
8 changed files with 104 additions and 92 deletions
|
|
@ -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();
|
||||
|
|
|
|||
28
src/test/ui/lint/must_not_suspend/handled.rs
Normal file
28
src/test/ui/lint/must_not_suspend/handled.rs
Normal file
|
|
@ -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() {
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue