diff --git a/src/test/ui/async-await/issue-76547.stderr b/src/test/ui/async-await/issue-76547.base.stderr similarity index 91% rename from src/test/ui/async-await/issue-76547.stderr rename to src/test/ui/async-await/issue-76547.base.stderr index ac5f99970c8..34705d4838e 100644 --- a/src/test/ui/async-await/issue-76547.stderr +++ b/src/test/ui/async-await/issue-76547.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/issue-76547.rs:20:13 + --> $DIR/issue-76547.rs:24:13 | LL | async fn fut(bufs: &mut [&mut [u8]]) { | ---------------- these two types are declared with different lifetimes... @@ -7,7 +7,7 @@ LL | ListFut(bufs).await | ^^^^ ...but data from `bufs` flows into `bufs` here error[E0623]: lifetime mismatch - --> $DIR/issue-76547.rs:34:14 + --> $DIR/issue-76547.rs:39:14 | LL | async fn fut2(bufs: &mut [&mut [u8]]) -> i32 { | ---------------- these two types are declared with different lifetimes... diff --git a/src/test/ui/async-await/issue-76547.nll.stderr b/src/test/ui/async-await/issue-76547.nll.stderr index 0ac2a396669..bc30da1e389 100644 --- a/src/test/ui/async-await/issue-76547.nll.stderr +++ b/src/test/ui/async-await/issue-76547.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/issue-76547.rs:20:13 + --> $DIR/issue-76547.rs:24:13 | LL | async fn fut(bufs: &mut [&mut [u8]]) { | - - let's call the lifetime of this reference `'2` @@ -9,7 +9,7 @@ LL | ListFut(bufs).await | ^^^^ this usage requires that `'1` must outlive `'2` error: lifetime may not live long enough - --> $DIR/issue-76547.rs:34:14 + --> $DIR/issue-76547.rs:39:14 | LL | async fn fut2(bufs: &mut [&mut [u8]]) -> i32 { | - - let's call the lifetime of this reference `'2` diff --git a/src/test/ui/async-await/issue-76547.rs b/src/test/ui/async-await/issue-76547.rs index 5b3ee5b95c4..45c7ab63135 100644 --- a/src/test/ui/async-await/issue-76547.rs +++ b/src/test/ui/async-await/issue-76547.rs @@ -1,3 +1,7 @@ +// ignore-compare-mode-nll +// revisions: base nll +// [nll]compile-flags: -Zborrowck=mir + // Test for diagnostic improvement issue #76547 // edition:2018 @@ -18,7 +22,8 @@ impl<'a> Future for ListFut<'a> { async fn fut(bufs: &mut [&mut [u8]]) { ListFut(bufs).await - //~^ ERROR lifetime mismatch + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough } pub struct ListFut2<'a>(&'a mut [&'a mut [u8]]); @@ -32,7 +37,8 @@ impl<'a> Future for ListFut2<'a> { async fn fut2(bufs: &mut [&mut [u8]]) -> i32 { ListFut2(bufs).await - //~^ ERROR lifetime mismatch + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/async-await/issues/issue-62097.stderr b/src/test/ui/async-await/issues/issue-62097.base.stderr similarity index 89% rename from src/test/ui/async-await/issues/issue-62097.stderr rename to src/test/ui/async-await/issues/issue-62097.base.stderr index e23277543c6..7577b95fa2e 100644 --- a/src/test/ui/async-await/issues/issue-62097.stderr +++ b/src/test/ui/async-await/issues/issue-62097.base.stderr @@ -1,13 +1,14 @@ error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/issue-62097.rs:12:31 + --> $DIR/issue-62097.rs:16:31 | LL | pub async fn run_dummy_fn(&self) { | ^^^^^ this data with an anonymous lifetime `'_`... +LL | LL | foo(|| self.bar()).await; | --- ...is used and required to live as long as `'static` here | note: `'static` lifetime requirement introduced by this bound - --> $DIR/issue-62097.rs:4:19 + --> $DIR/issue-62097.rs:8:19 | LL | F: FnOnce() + 'static | ^^^^^^^ diff --git a/src/test/ui/async-await/issues/issue-62097.nll.stderr b/src/test/ui/async-await/issues/issue-62097.nll.stderr index 786f6213260..b2b7c46d348 100644 --- a/src/test/ui/async-await/issues/issue-62097.nll.stderr +++ b/src/test/ui/async-await/issues/issue-62097.nll.stderr @@ -1,5 +1,5 @@ error[E0373]: closure may outlive the current function, but it borrows `self`, which is owned by the current function - --> $DIR/issue-62097.rs:13:13 + --> $DIR/issue-62097.rs:18:13 | LL | foo(|| self.bar()).await; | ^^ ---- `self` is borrowed here @@ -7,7 +7,7 @@ LL | foo(|| self.bar()).await; | may outlive borrowed value `self` | note: function requires argument type to outlive `'static` - --> $DIR/issue-62097.rs:13:9 + --> $DIR/issue-62097.rs:18:9 | LL | foo(|| self.bar()).await; | ^^^^^^^^^^^^^^^^^^ @@ -17,13 +17,14 @@ LL | foo(move || self.bar()).await; | ++++ error[E0521]: borrowed data escapes outside of associated function - --> $DIR/issue-62097.rs:13:9 + --> $DIR/issue-62097.rs:18:9 | LL | pub async fn run_dummy_fn(&self) { | ----- | | | `self` is a reference that is only valid in the associated function body | let's call the lifetime of this reference `'1` +LL | LL | foo(|| self.bar()).await; | ^^^^^^^^^^^^^^^^^^ | | diff --git a/src/test/ui/async-await/issues/issue-62097.rs b/src/test/ui/async-await/issues/issue-62097.rs index 66ebbd83ffa..d2260cd68c1 100644 --- a/src/test/ui/async-await/issues/issue-62097.rs +++ b/src/test/ui/async-await/issues/issue-62097.rs @@ -1,3 +1,7 @@ +// ignore-compare-mode-nll +// revisions: base nll +// [nll]compile-flags: -Zborrowck=mir + // edition:2018 async fn foo(fun: F) where @@ -9,8 +13,11 @@ where struct Struct; impl Struct { - pub async fn run_dummy_fn(&self) { //~ ERROR E0759 + pub async fn run_dummy_fn(&self) { + //[base]~^ ERROR E0759 foo(|| self.bar()).await; + //[nll]~^ ERROR closure may outlive the current function + //[nll]~| ERROR borrowed data escapes outside of associated function } pub fn bar(&self) {} diff --git a/src/test/ui/async-await/issues/issue-63388-1.stderr b/src/test/ui/async-await/issues/issue-63388-1.base.stderr similarity index 90% rename from src/test/ui/async-await/issues/issue-63388-1.stderr rename to src/test/ui/async-await/issues/issue-63388-1.base.stderr index 8f602a1492a..2ff85a27a46 100644 --- a/src/test/ui/async-await/issues/issue-63388-1.stderr +++ b/src/test/ui/async-await/issues/issue-63388-1.base.stderr @@ -1,11 +1,11 @@ error[E0623]: lifetime mismatch - --> $DIR/issue-63388-1.rs:14:9 + --> $DIR/issue-63388-1.rs:19:9 | LL | &'a self, foo: &dyn Foo | -------- this parameter and the return type are declared with different lifetimes... LL | ) -> &dyn Foo | -------- -LL | { +... LL | foo | ^^^ ...but data from `foo` is returned here diff --git a/src/test/ui/async-await/issues/issue-63388-1.nll.stderr b/src/test/ui/async-await/issues/issue-63388-1.nll.stderr index 464459d2d61..eee0cee278b 100644 --- a/src/test/ui/async-await/issues/issue-63388-1.nll.stderr +++ b/src/test/ui/async-await/issues/issue-63388-1.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/issue-63388-1.rs:13:5 + --> $DIR/issue-63388-1.rs:17:5 | LL | async fn do_sth<'a>( | -- lifetime `'a` defined here @@ -7,7 +7,9 @@ LL | &'a self, foo: &dyn Foo | - let's call the lifetime of this reference `'1` LL | ) -> &dyn Foo LL | / { +LL | | LL | | foo +LL | | LL | | } | |_____^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1` diff --git a/src/test/ui/async-await/issues/issue-63388-1.rs b/src/test/ui/async-await/issues/issue-63388-1.rs index baecf49c798..c45d2a42177 100644 --- a/src/test/ui/async-await/issues/issue-63388-1.rs +++ b/src/test/ui/async-await/issues/issue-63388-1.rs @@ -1,3 +1,7 @@ +// ignore-compare-mode-nll +// revisions: base nll +// [nll]compile-flags: -Zborrowck=mir + // edition:2018 struct Xyz { @@ -11,7 +15,9 @@ impl Xyz { &'a self, foo: &dyn Foo ) -> &dyn Foo { - foo //~ ERROR lifetime mismatch + //[nll]~^ ERROR lifetime may not live long enough + foo + //[base]~^ ERROR lifetime mismatch } } diff --git a/src/test/ui/async-await/issues/issue-72312.stderr b/src/test/ui/async-await/issues/issue-72312.base.stderr similarity index 88% rename from src/test/ui/async-await/issues/issue-72312.stderr rename to src/test/ui/async-await/issues/issue-72312.base.stderr index 798f755765c..a4bdc447f65 100644 --- a/src/test/ui/async-await/issues/issue-72312.stderr +++ b/src/test/ui/async-await/issues/issue-72312.base.stderr @@ -1,5 +1,5 @@ error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/issue-72312.rs:10:24 + --> $DIR/issue-72312.rs:14:24 | LL | pub async fn start(&self) { | ^^^^^ this data with an anonymous lifetime `'_`... @@ -8,12 +8,12 @@ LL | &self; | ----- ...is used here... | note: ...and is required to live as long as `'static` here - --> $DIR/issue-72312.rs:13:9 + --> $DIR/issue-72312.rs:20:9 | LL | require_static(async move { | ^^^^^^^^^^^^^^ note: `'static` lifetime requirement introduced by this bound - --> $DIR/issue-72312.rs:2:22 + --> $DIR/issue-72312.rs:6:22 | LL | fn require_static(val: T) -> T { | ^^^^^^^ diff --git a/src/test/ui/async-await/issues/issue-72312.nll.stderr b/src/test/ui/async-await/issues/issue-72312.nll.stderr index 068d8c64d68..53b2c931cce 100644 --- a/src/test/ui/async-await/issues/issue-72312.nll.stderr +++ b/src/test/ui/async-await/issues/issue-72312.nll.stderr @@ -1,5 +1,5 @@ error[E0521]: borrowed data escapes outside of associated function - --> $DIR/issue-72312.rs:13:24 + --> $DIR/issue-72312.rs:20:24 | LL | pub async fn start(&self) { | ----- @@ -9,6 +9,10 @@ LL | pub async fn start(&self) { ... LL | require_static(async move { | ________________________^ +LL | | +LL | | +LL | | +LL | | LL | | &self; LL | | }); | | ^ diff --git a/src/test/ui/async-await/issues/issue-72312.rs b/src/test/ui/async-await/issues/issue-72312.rs index eb7d12e290c..c1eceefd643 100644 --- a/src/test/ui/async-await/issues/issue-72312.rs +++ b/src/test/ui/async-await/issues/issue-72312.rs @@ -1,17 +1,28 @@ +// ignore-compare-mode-nll +// revisions: base nll +// [nll]compile-flags: -Zborrowck=mir + // edition:2018 fn require_static(val: T) -> T { - //~^ NOTE 'static` lifetime requirement introduced by this bound + //[base]~^ NOTE 'static` lifetime requirement introduced by this bound val } struct Problem; impl Problem { - pub async fn start(&self) { //~ ERROR E0759 - //~^ NOTE this data with an anonymous lifetime `'_` - //~| NOTE in this expansion of desugaring of `async` block or function - require_static(async move { //~ NOTE ...and is required to live as long as `'static` here - &self; //~ NOTE ...is used here... + pub async fn start(&self) { + //[base]~^ ERROR E0759 + //[base]~| NOTE this data with an anonymous lifetime `'_` + //[base]~| NOTE in this expansion of desugaring of `async` block or function + //[nll]~^^^^ NOTE let's call + //[nll]~| NOTE `self` is a reference + require_static(async move { + //[base]~^ NOTE ...and is required to live as long as `'static` here + //[nll]~^^ ERROR borrowed data escapes + //[nll]~| NOTE `self` escapes + //[nll]~| NOTE argument requires + &self; //[base]~ NOTE ...is used here... }); } } diff --git a/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr b/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.base.stderr similarity index 94% rename from src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr rename to src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.base.stderr index 2eb3a07059f..907c1f6c407 100644 --- a/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr +++ b/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.base.stderr @@ -1,17 +1,18 @@ error[E0623]: lifetime mismatch - --> $DIR/ret-impl-trait-one.rs:10:85 + --> $DIR/ret-impl-trait-one.rs:14:85 | LL | async fn async_ret_impl_trait3<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b { | ______________________________________________________------_____-------------------_^ | | | | | this parameter and the return type are declared with different lifetimes... LL | | +LL | | LL | | (a, b) LL | | } | |_^ ...but data from `a` is returned here error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds - --> $DIR/ret-impl-trait-one.rs:16:80 + --> $DIR/ret-impl-trait-one.rs:21:80 | LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> { | ____________________________________--__________________________________________^ diff --git a/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.nll.stderr b/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.nll.stderr index cdb141c0e3e..dbf7293a389 100644 --- a/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.nll.stderr +++ b/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ret-impl-trait-one.rs:10:85 + --> $DIR/ret-impl-trait-one.rs:14:85 | LL | async fn async_ret_impl_trait3<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b { | ________________________________--__--_______________________________________________^ @@ -7,6 +7,7 @@ LL | async fn async_ret_impl_trait3<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trai | | | lifetime `'b` defined here | | lifetime `'a` defined here LL | | +LL | | LL | | (a, b) LL | | } | |_^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` @@ -14,7 +15,7 @@ LL | | } = help: consider adding the following bound: `'a: 'b` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds - --> $DIR/ret-impl-trait-one.rs:16:80 + --> $DIR/ret-impl-trait-one.rs:21:80 | LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> { | ____________________________________--__________________________________________^ diff --git a/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.rs b/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.rs index 4f32489014d..f4c309b4c10 100644 --- a/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.rs +++ b/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.rs @@ -1,3 +1,7 @@ +// ignore-compare-mode-nll +// revisions: base nll +// [nll]compile-flags: -Zborrowck=mir + // edition:2018 // Test that a feature gate is needed to use `impl Trait` as the @@ -8,7 +12,8 @@ impl Trait<'_> for T { } // Fails to recognize that both 'a and 'b are mentioned and should thus be accepted async fn async_ret_impl_trait3<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b { - //~^ ERROR lifetime mismatch + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough (a, b) }