Skip to content

Commit 34a3154

Browse files
committed
Use revisions for NLL in async-await
1 parent 0fbb315 commit 34a3154

15 files changed

+76
-31
lines changed

src/test/ui/async-await/issue-76547.stderr renamed to src/test/ui/async-await/issue-76547.base.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error[E0623]: lifetime mismatch
2-
--> $DIR/issue-76547.rs:20:13
2+
--> $DIR/issue-76547.rs:24:13
33
|
44
LL | async fn fut(bufs: &mut [&mut [u8]]) {
55
| ---------------- these two types are declared with different lifetimes...
66
LL | ListFut(bufs).await
77
| ^^^^ ...but data from `bufs` flows into `bufs` here
88

99
error[E0623]: lifetime mismatch
10-
--> $DIR/issue-76547.rs:34:14
10+
--> $DIR/issue-76547.rs:39:14
1111
|
1212
LL | async fn fut2(bufs: &mut [&mut [u8]]) -> i32 {
1313
| ---------------- these two types are declared with different lifetimes...

src/test/ui/async-await/issue-76547.nll.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: lifetime may not live long enough
2-
--> $DIR/issue-76547.rs:20:13
2+
--> $DIR/issue-76547.rs:24:13
33
|
44
LL | async fn fut(bufs: &mut [&mut [u8]]) {
55
| - - let's call the lifetime of this reference `'2`
@@ -9,7 +9,7 @@ LL | ListFut(bufs).await
99
| ^^^^ this usage requires that `'1` must outlive `'2`
1010

1111
error: lifetime may not live long enough
12-
--> $DIR/issue-76547.rs:34:14
12+
--> $DIR/issue-76547.rs:39:14
1313
|
1414
LL | async fn fut2(bufs: &mut [&mut [u8]]) -> i32 {
1515
| - - let's call the lifetime of this reference `'2`

src/test/ui/async-await/issue-76547.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// ignore-compare-mode-nll
2+
// revisions: base nll
3+
// [nll]compile-flags: -Zborrowck=mir
4+
15
// Test for diagnostic improvement issue #76547
26
// edition:2018
37

@@ -18,7 +22,8 @@ impl<'a> Future for ListFut<'a> {
1822

1923
async fn fut(bufs: &mut [&mut [u8]]) {
2024
ListFut(bufs).await
21-
//~^ ERROR lifetime mismatch
25+
//[base]~^ ERROR lifetime mismatch
26+
//[nll]~^^ ERROR lifetime may not live long enough
2227
}
2328

2429
pub struct ListFut2<'a>(&'a mut [&'a mut [u8]]);
@@ -32,7 +37,8 @@ impl<'a> Future for ListFut2<'a> {
3237

3338
async fn fut2(bufs: &mut [&mut [u8]]) -> i32 {
3439
ListFut2(bufs).await
35-
//~^ ERROR lifetime mismatch
40+
//[base]~^ ERROR lifetime mismatch
41+
//[nll]~^^ ERROR lifetime may not live long enough
3642
}
3743

3844
fn main() {}

src/test/ui/async-await/issues/issue-62097.stderr renamed to src/test/ui/async-await/issues/issue-62097.base.stderr

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
2-
--> $DIR/issue-62097.rs:12:31
2+
--> $DIR/issue-62097.rs:16:31
33
|
44
LL | pub async fn run_dummy_fn(&self) {
55
| ^^^^^ this data with an anonymous lifetime `'_`...
6+
LL |
67
LL | foo(|| self.bar()).await;
78
| --- ...is used and required to live as long as `'static` here
89
|
910
note: `'static` lifetime requirement introduced by this bound
10-
--> $DIR/issue-62097.rs:4:19
11+
--> $DIR/issue-62097.rs:8:19
1112
|
1213
LL | F: FnOnce() + 'static
1314
| ^^^^^^^

src/test/ui/async-await/issues/issue-62097.nll.stderr

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error[E0373]: closure may outlive the current function, but it borrows `self`, which is owned by the current function
2-
--> $DIR/issue-62097.rs:13:13
2+
--> $DIR/issue-62097.rs:18:13
33
|
44
LL | foo(|| self.bar()).await;
55
| ^^ ---- `self` is borrowed here
66
| |
77
| may outlive borrowed value `self`
88
|
99
note: function requires argument type to outlive `'static`
10-
--> $DIR/issue-62097.rs:13:9
10+
--> $DIR/issue-62097.rs:18:9
1111
|
1212
LL | foo(|| self.bar()).await;
1313
| ^^^^^^^^^^^^^^^^^^
@@ -17,13 +17,14 @@ LL | foo(move || self.bar()).await;
1717
| ++++
1818

1919
error[E0521]: borrowed data escapes outside of associated function
20-
--> $DIR/issue-62097.rs:13:9
20+
--> $DIR/issue-62097.rs:18:9
2121
|
2222
LL | pub async fn run_dummy_fn(&self) {
2323
| -----
2424
| |
2525
| `self` is a reference that is only valid in the associated function body
2626
| let's call the lifetime of this reference `'1`
27+
LL |
2728
LL | foo(|| self.bar()).await;
2829
| ^^^^^^^^^^^^^^^^^^
2930
| |

src/test/ui/async-await/issues/issue-62097.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// ignore-compare-mode-nll
2+
// revisions: base nll
3+
// [nll]compile-flags: -Zborrowck=mir
4+
15
// edition:2018
26
async fn foo<F>(fun: F)
37
where
@@ -9,8 +13,11 @@ where
913
struct Struct;
1014

1115
impl Struct {
12-
pub async fn run_dummy_fn(&self) { //~ ERROR E0759
16+
pub async fn run_dummy_fn(&self) {
17+
//[base]~^ ERROR E0759
1318
foo(|| self.bar()).await;
19+
//[nll]~^ ERROR closure may outlive the current function
20+
//[nll]~| ERROR borrowed data escapes outside of associated function
1421
}
1522

1623
pub fn bar(&self) {}

src/test/ui/async-await/issues/issue-63388-1.stderr renamed to src/test/ui/async-await/issues/issue-63388-1.base.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0623]: lifetime mismatch
2-
--> $DIR/issue-63388-1.rs:14:9
2+
--> $DIR/issue-63388-1.rs:19:9
33
|
44
LL | &'a self, foo: &dyn Foo
55
| -------- this parameter and the return type are declared with different lifetimes...
66
LL | ) -> &dyn Foo
77
| --------
8-
LL | {
8+
...
99
LL | foo
1010
| ^^^ ...but data from `foo` is returned here
1111

src/test/ui/async-await/issues/issue-63388-1.nll.stderr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
error: lifetime may not live long enough
2-
--> $DIR/issue-63388-1.rs:13:5
2+
--> $DIR/issue-63388-1.rs:17:5
33
|
44
LL | async fn do_sth<'a>(
55
| -- lifetime `'a` defined here
66
LL | &'a self, foo: &dyn Foo
77
| - let's call the lifetime of this reference `'1`
88
LL | ) -> &dyn Foo
99
LL | / {
10+
LL | |
1011
LL | | foo
12+
LL | |
1113
LL | | }
1214
| |_____^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
1315

src/test/ui/async-await/issues/issue-63388-1.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// ignore-compare-mode-nll
2+
// revisions: base nll
3+
// [nll]compile-flags: -Zborrowck=mir
4+
15
// edition:2018
26

37
struct Xyz {
@@ -11,7 +15,9 @@ impl Xyz {
1115
&'a self, foo: &dyn Foo
1216
) -> &dyn Foo
1317
{
14-
foo //~ ERROR lifetime mismatch
18+
//[nll]~^ ERROR lifetime may not live long enough
19+
foo
20+
//[base]~^ ERROR lifetime mismatch
1521
}
1622
}
1723

src/test/ui/async-await/issues/issue-72312.stderr renamed to src/test/ui/async-await/issues/issue-72312.base.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
2-
--> $DIR/issue-72312.rs:10:24
2+
--> $DIR/issue-72312.rs:14:24
33
|
44
LL | pub async fn start(&self) {
55
| ^^^^^ this data with an anonymous lifetime `'_`...
@@ -8,12 +8,12 @@ LL | &self;
88
| ----- ...is used here...
99
|
1010
note: ...and is required to live as long as `'static` here
11-
--> $DIR/issue-72312.rs:13:9
11+
--> $DIR/issue-72312.rs:20:9
1212
|
1313
LL | require_static(async move {
1414
| ^^^^^^^^^^^^^^
1515
note: `'static` lifetime requirement introduced by this bound
16-
--> $DIR/issue-72312.rs:2:22
16+
--> $DIR/issue-72312.rs:6:22
1717
|
1818
LL | fn require_static<T: 'static>(val: T) -> T {
1919
| ^^^^^^^

0 commit comments

Comments
 (0)