mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
Update must_not_suspend/ref.rs
This commit is contained in:
parent
5671a76119
commit
87bb475ae7
27
src/test/ui/lint/must_not_suspend/ref.drop_tracking.stderr
Normal file
27
src/test/ui/lint/must_not_suspend/ref.drop_tracking.stderr
Normal file
@ -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
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
error: `Umm` held across a suspend point, but should not be
|
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;
|
LL | let guard = &mut self.u;
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
@ -8,17 +8,17 @@ LL | other().await;
|
|||||||
| ------ the value is held across this suspend point
|
| ------ the value is held across this suspend point
|
||||||
|
|
|
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/ref.rs:3:9
|
--> $DIR/ref.rs:6:9
|
||||||
|
|
|
|
||||||
LL | #![deny(must_not_suspend)]
|
LL | #![deny(must_not_suspend)]
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
note: You gotta use Umm's, ya know?
|
note: You gotta use Umm's, ya know?
|
||||||
--> $DIR/ref.rs:18:26
|
--> $DIR/ref.rs:21:26
|
||||||
|
|
|
|
||||||
LL | let guard = &mut self.u;
|
LL | let guard = &mut self.u;
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
|
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;
|
LL | let guard = &mut self.u;
|
||||||
| ^^^^^^
|
| ^^^^^^
|
@ -1,10 +1,13 @@
|
|||||||
// edition:2018
|
// 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)]
|
#![feature(must_not_suspend)]
|
||||||
#![deny(must_not_suspend)]
|
#![deny(must_not_suspend)]
|
||||||
|
|
||||||
#[must_not_suspend = "You gotta use Umm's, ya know?"]
|
#[must_not_suspend = "You gotta use Umm's, ya know?"]
|
||||||
struct Umm {
|
struct Umm {
|
||||||
i: i64
|
i: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Bar {
|
struct Bar {
|
||||||
@ -19,11 +22,8 @@ impl Bar {
|
|||||||
|
|
||||||
other().await;
|
other().await;
|
||||||
|
|
||||||
*guard = Umm {
|
*guard = Umm { i: 2 }
|
||||||
i: 2
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {}
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user