Skip to content

Commit 87bb475

Browse files
committed
Update must_not_suspend/ref.rs
1 parent 5671a76 commit 87bb475

File tree

3 files changed

+37
-10
lines changed

3 files changed

+37
-10
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
error: reference to `Umm` held across a suspend point, but should not be
2+
--> $DIR/ref.rs:21:13
3+
|
4+
LL | let guard = &mut self.u;
5+
| ^^^^^
6+
LL |
7+
LL | other().await;
8+
| ------ the value is held across this suspend point
9+
|
10+
note: the lint level is defined here
11+
--> $DIR/ref.rs:6:9
12+
|
13+
LL | #![deny(must_not_suspend)]
14+
| ^^^^^^^^^^^^^^^^
15+
note: You gotta use Umm's, ya know?
16+
--> $DIR/ref.rs:21:13
17+
|
18+
LL | let guard = &mut self.u;
19+
| ^^^^^
20+
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
21+
--> $DIR/ref.rs:21:13
22+
|
23+
LL | let guard = &mut self.u;
24+
| ^^^^^
25+
26+
error: aborting due to previous error
27+

src/test/ui/lint/must_not_suspend/ref.stderr renamed to src/test/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: `Umm` held across a suspend point, but should not be
2-
--> $DIR/ref.rs:18:26
2+
--> $DIR/ref.rs:21:26
33
|
44
LL | let guard = &mut self.u;
55
| ^^^^^^
@@ -8,17 +8,17 @@ LL | other().await;
88
| ------ the value is held across this suspend point
99
|
1010
note: the lint level is defined here
11-
--> $DIR/ref.rs:3:9
11+
--> $DIR/ref.rs:6:9
1212
|
1313
LL | #![deny(must_not_suspend)]
1414
| ^^^^^^^^^^^^^^^^
1515
note: You gotta use Umm's, ya know?
16-
--> $DIR/ref.rs:18:26
16+
--> $DIR/ref.rs:21:26
1717
|
1818
LL | let guard = &mut self.u;
1919
| ^^^^^^
2020
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
21-
--> $DIR/ref.rs:18:26
21+
--> $DIR/ref.rs:21:26
2222
|
2323
LL | let guard = &mut self.u;
2424
| ^^^^^^

src/test/ui/lint/must_not_suspend/ref.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
// edition:2018
2+
// revisions: no_drop_tracking drop_tracking
3+
// [drop_tracking] compile-flags: -Zdrop-tracking=yes
4+
// [no_drop_tracking] compile-flags: -Zdrop-tracking=no
25
#![feature(must_not_suspend)]
36
#![deny(must_not_suspend)]
47

58
#[must_not_suspend = "You gotta use Umm's, ya know?"]
69
struct Umm {
7-
i: i64
10+
i: i64,
811
}
912

1013
struct Bar {
@@ -19,11 +22,8 @@ impl Bar {
1922

2023
other().await;
2124

22-
*guard = Umm {
23-
i: 2
24-
}
25+
*guard = Umm { i: 2 }
2526
}
2627
}
2728

28-
fn main() {
29-
}
29+
fn main() {}

0 commit comments

Comments
 (0)