diff options
| author | b-naber <bn263@gmx.de> | 2022-05-23 09:50:32 +0200 |
|---|---|---|
| committer | b-naber <bn263@gmx.de> | 2022-05-25 18:13:18 +0200 |
| commit | 99fa123f6619433d39a2e9f04d80c244fec17980 (patch) | |
| tree | bac4435aa38dee0858d853ba7f6e6d4d9f24ef7b /src/test | |
| parent | ca9d72540b0f90dee4a090b362843e9a38606520 (diff) | |
| download | rust-99fa123f6619433d39a2e9f04d80c244fec17980.tar.gz rust-99fa123f6619433d39a2e9f04d80c244fec17980.zip | |
bless existing test with compare-mode=nll and remove test
Diffstat (limited to 'src/test')
8 files changed, 66 insertions, 237 deletions
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant-nll.krisskross.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant-nll.krisskross.stderr index 231e98cf841..09119ea2bb5 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-invariant-nll.krisskross.stderr +++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant-nll.krisskross.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/project-fn-ret-invariant-nll.rs:63:5 + --> $DIR/project-fn-ret-invariant-nll.rs:64:5 | LL | fn transmute<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) { | -- -- lifetime `'b` defined here @@ -15,7 +15,7 @@ LL | (a, b) = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance error: lifetime may not live long enough - --> $DIR/project-fn-ret-invariant-nll.rs:63:5 + --> $DIR/project-fn-ret-invariant-nll.rs:64:5 | LL | fn transmute<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant-nll.oneuse.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant-nll.oneuse.stderr index 1dbfff6a8cd..266f3b99f9f 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-invariant-nll.oneuse.stderr +++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant-nll.oneuse.stderr @@ -15,19 +15,19 @@ LL | let a = bar(f, x); = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance error: lifetime may not live long enough - --> $DIR/project-fn-ret-invariant-nll.rs:47:13 + --> $DIR/project-fn-ret-invariant-nll.rs:46:13 | LL | fn baz<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here -... -LL | let b = bar(f, y); +LL | let f = foo; // <-- No consistent type can be inferred for `f` here. +LL | let a = bar(f, x); | ^^^^^^^^^ argument requires that `'b` must outlive `'a` | = help: consider adding the following bound: `'b: 'a` - = note: requirement occurs because of the type `Type<'_>`, which makes the generic argument `'_` invariant - = note: the struct `Type<'a>` is invariant over the parameter `'a` + = note: requirement occurs because of a function pointer to `foo` + = note: the function `foo` is invariant over the parameter `'a` = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance help: `'a` and `'b` must be the same: replace one with the other diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant-nll.rs b/src/test/ui/associated-types/cache/project-fn-ret-invariant-nll.rs index 6cd5c6417a9..15bf38dabc0 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-invariant-nll.rs +++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant-nll.rs @@ -44,7 +44,8 @@ fn baz<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) { fn baz<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) { let f = foo; // <-- No consistent type can be inferred for `f` here. let a = bar(f, x); //[oneuse]~ ERROR lifetime may not live long enough - let b = bar(f, y); //[oneuse]~ ERROR lifetime may not live long enough + //[oneuse]~^ ERROR lifetime may not live long enough + let b = bar(f, y); (a, b) } diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant-nll.transmute.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant-nll.transmute.stderr index 352914f020c..56f08152999 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-invariant-nll.transmute.stderr +++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant-nll.transmute.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/project-fn-ret-invariant-nll.rs:56:5 + --> $DIR/project-fn-ret-invariant-nll.rs:57:5 | LL | fn baz<'a, 'b>(x: Type<'a>) -> Type<'static> { | -- lifetime `'a` defined here 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 53b2c931cce..02e47721e0c 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:20:24 + --> $DIR/issue-72312.rs:20:9 | LL | pub async fn start(&self) { | ----- @@ -7,18 +7,17 @@ LL | pub async fn start(&self) { | `self` is a reference that is only valid in the associated function body | let's call the lifetime of this reference `'1` ... -LL | require_static(async move { - | ________________________^ +LL | / require_static(async move { LL | | LL | | LL | | LL | | LL | | &self; LL | | }); - | | ^ - | | | - | |_________`self` escapes the associated function body here - | argument requires that `'1` must outlive `'static` + | | ^ + | | | + | |__________`self` escapes the associated function body here + | argument requires that `'1` must outlive `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/impl-dyn-trait-static-bound.rs b/src/test/ui/nll/impl-dyn-trait-static-bound.rs deleted file mode 100644 index ea835f2e052..00000000000 --- a/src/test/ui/nll/impl-dyn-trait-static-bound.rs +++ /dev/null @@ -1,116 +0,0 @@ -#![allow(dead_code)] -#![feature(nll)] - -mod foo { - trait OtherTrait<'a> {} - impl<'a> OtherTrait<'a> for &'a () {} - - trait ObjectTrait<T> {} - trait MyTrait<T> { - fn use_self<K>(&self) -> &(); - } - trait Irrelevant {} - - impl<T> MyTrait<T> for dyn ObjectTrait<T> { - fn use_self<K>(&self) -> &() { panic!() } - } - impl<T> Irrelevant for dyn ObjectTrait<T> {} - - fn use_it<'a, T>(val: &'a dyn ObjectTrait<T>) -> impl OtherTrait<'a> + 'a { - val.use_self::<T>() - //~^ ERROR borrowed data escapes outside - } -} - -mod bar { - trait ObjectTrait {} - trait MyTrait { - fn use_self(&self) -> &(); - } - trait Irrelevant {} - - impl MyTrait for dyn ObjectTrait { - fn use_self(&self) -> &() { panic!() } - } - impl Irrelevant for dyn ObjectTrait {} - - fn use_it<'a>(val: &'a dyn ObjectTrait) -> &'a () { - val.use_self() - } -} - -mod baz { - trait ObjectTrait {} - trait MyTrait { - fn use_self(&self) -> &(); - } - trait Irrelevant {} - - impl MyTrait for Box<dyn ObjectTrait> { - fn use_self(&self) -> &() { panic!() } - } - impl Irrelevant for Box<dyn ObjectTrait> {} - - fn use_it<'a>(val: &'a Box<dyn ObjectTrait + 'a>) -> &'a () { - val.use_self() - } -} - -mod bat { - trait OtherTrait<'a> {} - impl<'a> OtherTrait<'a> for &'a () {} - - trait ObjectTrait {} - - impl dyn ObjectTrait { - fn use_self(&self) -> &() { panic!() } - } - - fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a { - val.use_self() - //~^ ERROR borrowed data escapes outside - } -} - -mod ban { - trait OtherTrait<'a> {} - impl<'a> OtherTrait<'a> for &'a () {} - - trait ObjectTrait {} - trait MyTrait { - fn use_self(&self) -> &() { panic!() } - } - trait Irrelevant { - fn use_self(&self) -> &() { panic!() } - } - - impl MyTrait for dyn ObjectTrait {} - - fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> { - val.use_self() - //~^ ERROR borrowed data escapes outside - } -} - -mod bal { - trait OtherTrait<'a> {} - impl<'a> OtherTrait<'a> for &'a () {} - - trait ObjectTrait {} - trait MyTrait { - fn use_self(&self) -> &() { panic!() } - } - trait Irrelevant { - fn use_self(&self) -> &() { panic!() } - } - - impl MyTrait for dyn ObjectTrait {} - impl Irrelevant for dyn ObjectTrait {} - - fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a { - MyTrait::use_self(val) - //~^ ERROR borrowed data escapes outside - } -} - -fn main() {} diff --git a/src/test/ui/nll/impl-dyn-trait-static-bound.stderr b/src/test/ui/nll/impl-dyn-trait-static-bound.stderr deleted file mode 100644 index dd6b50839ef..00000000000 --- a/src/test/ui/nll/impl-dyn-trait-static-bound.stderr +++ /dev/null @@ -1,105 +0,0 @@ -error[E0521]: borrowed data escapes outside of function - --> $DIR/impl-dyn-trait-static-bound.rs:20:9 - | -LL | fn use_it<'a, T>(val: &'a dyn ObjectTrait<T>) -> impl OtherTrait<'a> + 'a { - | -- --- `val` is a reference that is only valid in the function body - | | - | lifetime `'a` defined here -LL | val.use_self::<T>() - | ^^^^^^^^^^^^^^^^^^^ - | | - | `val` escapes the function body here - | argument requires that `'a` must outlive `'static` - | -note: the used `impl` has a `'static` requirement - --> $DIR/impl-dyn-trait-static-bound.rs:14:32 - | -LL | impl<T> MyTrait<T> for dyn ObjectTrait<T> { - | ^^^^^^^^^^^^^^ this has an implicit `'static` lifetime requirement -LL | fn use_self<K>(&self) -> &() { panic!() } - | -------- calling this method introduces the `impl`'s 'static` requirement -help: consider relaxing the implicit `'static` requirement - | -LL | impl<T> MyTrait<T> for dyn ObjectTrait<T> + '_ { - | ++++ - -error[E0521]: borrowed data escapes outside of function - --> $DIR/impl-dyn-trait-static-bound.rs:70:9 - | -LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a { - | -- --- `val` is a reference that is only valid in the function body - | | - | lifetime `'a` defined here -LL | val.use_self() - | ^^^^^^^^^^^^^^ - | | - | `val` escapes the function body here - | argument requires that `'a` must outlive `'static` - | -note: the used `impl` has a `'static` requirement - --> $DIR/impl-dyn-trait-static-bound.rs:65:14 - | -LL | impl dyn ObjectTrait { - | ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement -LL | fn use_self(&self) -> &() { panic!() } - | -------- calling this method introduces the `impl`'s 'static` requirement -help: consider relaxing the implicit `'static` requirement - | -LL | impl dyn ObjectTrait + '_ { - | ++++ - -error[E0521]: borrowed data escapes outside of function - --> $DIR/impl-dyn-trait-static-bound.rs:90:9 - | -LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> { - | -- --- `val` is a reference that is only valid in the function body - | | - | lifetime `'a` defined here -LL | val.use_self() - | ^^^^^^^^^^^^^^ - | | - | `val` escapes the function body here - | argument requires that `'a` must outlive `'static` - | -note: the used `impl` has a `'static` requirement - --> $DIR/impl-dyn-trait-static-bound.rs:87:26 - | -LL | fn use_self(&self) -> &() { panic!() } - | -------- calling this method introduces the `impl`'s 'static` requirement -... -LL | impl MyTrait for dyn ObjectTrait {} - | ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement -help: consider relaxing the implicit `'static` requirement - | -LL | impl MyTrait for dyn ObjectTrait + '_ {} - | ++++ - -error[E0521]: borrowed data escapes outside of function - --> $DIR/impl-dyn-trait-static-bound.rs:111:9 - | -LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a { - | -- --- `val` is a reference that is only valid in the function body - | | - | lifetime `'a` defined here -LL | MyTrait::use_self(val) - | ^^^^^^^^^^^^^^^^^^^^^^ - | | - | `val` escapes the function body here - | argument requires that `'a` must outlive `'static` - | -note: the used `impl` has a `'static` requirement - --> $DIR/impl-dyn-trait-static-bound.rs:107:26 - | -LL | fn use_self(&self) -> &() { panic!() } - | -------- calling this method introduces the `impl`'s 'static` requirement -... -LL | impl MyTrait for dyn ObjectTrait {} - | ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement -help: consider relaxing the implicit `'static` requirement - | -LL | impl MyTrait for dyn ObjectTrait + '_ {} - | ++++ - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0521`. diff --git a/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-nll.stderr b/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-nll.stderr index 38731ea8955..5d9c7077fa1 100644 --- a/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-nll.stderr +++ b/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-nll.stderr @@ -10,6 +10,18 @@ LL | val.use_self::<T>() | | | `val` escapes the function body here | argument requires that `'a` must outlive `'static` + | +note: the used `impl` has a `'static` requirement + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-nll.rs:19:32 + | +LL | impl<T> MyTrait<T> for dyn ObjectTrait<T> { + | ^^^^^^^^^^^^^^ this has an implicit `'static` lifetime requirement +LL | fn use_self<K>(&self) -> &() { panic!() } + | -------- calling this method introduces the `impl`'s 'static` requirement +help: consider relaxing the implicit `'static` requirement + | +LL | impl<T> MyTrait<T> for dyn ObjectTrait<T> + '_ { + | ++++ error[E0521]: borrowed data escapes outside of function --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-nll.rs:74:9 @@ -23,6 +35,18 @@ LL | val.use_self() | | | `val` escapes the function body here | argument requires that `'a` must outlive `'static` + | +note: the used `impl` has a `'static` requirement + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-nll.rs:69:14 + | +LL | impl dyn ObjectTrait { + | ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement +LL | fn use_self(&self) -> &() { panic!() } + | -------- calling this method introduces the `impl`'s 'static` requirement +help: consider relaxing the implicit `'static` requirement + | +LL | impl dyn ObjectTrait + '_ { + | ++++ error[E0521]: borrowed data escapes outside of function --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-nll.rs:94:9 @@ -36,6 +60,19 @@ LL | val.use_self() | | | `val` escapes the function body here | argument requires that `'a` must outlive `'static` + | +note: the used `impl` has a `'static` requirement + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-nll.rs:91:26 + | +LL | fn use_self(&self) -> &() { panic!() } + | -------- calling this method introduces the `impl`'s 'static` requirement +... +LL | impl MyTrait for dyn ObjectTrait {} + | ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement +help: consider relaxing the implicit `'static` requirement + | +LL | impl MyTrait for dyn ObjectTrait + '_ {} + | ++++ error[E0521]: borrowed data escapes outside of function --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-nll.rs:114:9 @@ -49,6 +86,19 @@ LL | MyTrait::use_self(val) | | | `val` escapes the function body here | argument requires that `'a` must outlive `'static` + | +note: the used `impl` has a `'static` requirement + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-nll.rs:110:26 + | +LL | fn use_self(&self) -> &() { panic!() } + | -------- calling this method introduces the `impl`'s 'static` requirement +... +LL | impl MyTrait for dyn ObjectTrait {} + | ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement +help: consider relaxing the implicit `'static` requirement + | +LL | impl MyTrait for dyn ObjectTrait + '_ {} + | ++++ error: aborting due to 4 previous errors |
