From fe91cfd684340f45dabd15568b7dae2f8118ee44 Mon Sep 17 00:00:00 2001 From: Jack Huey <31162821+jackh726@users.noreply.github.com> Date: Sun, 22 May 2022 01:36:12 -0400 Subject: Use revisions for NLL in suggestions --- ...atic-bound-needing-more-suggestions.base.stderr | 42 ++++++++ ...tatic-bound-needing-more-suggestions.nll.stderr | 6 +- ...plicit-static-bound-needing-more-suggestions.rs | 6 +- ...it-static-bound-needing-more-suggestions.stderr | 42 -------- ...-on-dyn-trait-with-implicit-static-bound-nll.rs | 118 +++++++++++++++++++++ ...dyn-trait-with-implicit-static-bound-nll.stderr | 55 ++++++++++ ...l-on-dyn-trait-with-implicit-static-bound.fixed | 5 + ...dyn-trait-with-implicit-static-bound.nll.stderr | 55 ---------- ...impl-on-dyn-trait-with-implicit-static-bound.rs | 5 + ...-on-dyn-trait-with-implicit-static-bound.stderr | 26 ++--- .../missing-lifetimes-in-signature-2.base.stderr | 28 +++++ .../missing-lifetimes-in-signature-2.nll.stderr | 6 +- .../lifetimes/missing-lifetimes-in-signature-2.rs | 4 + .../missing-lifetimes-in-signature-2.stderr | 28 ----- .../missing-lifetimes-in-signature.base.stderr | 114 ++++++++++++++++++++ .../missing-lifetimes-in-signature.nll.stderr | 47 +++++--- .../lifetimes/missing-lifetimes-in-signature.rs | 20 +++- .../missing-lifetimes-in-signature.stderr | 114 -------------------- .../trait-object-nested-in-impl-trait.base.stderr | 95 +++++++++++++++++ .../trait-object-nested-in-impl-trait.nll.stderr | 16 ++- .../lifetimes/trait-object-nested-in-impl-trait.rs | 20 +++- .../trait-object-nested-in-impl-trait.stderr | 95 ----------------- .../suggest-impl-trait-lifetime-nll.fixed | 24 +++++ .../suggestions/suggest-impl-trait-lifetime-nll.rs | 24 +++++ .../suggest-impl-trait-lifetime-nll.stderr | 14 +++ .../suggestions/suggest-impl-trait-lifetime.fixed | 5 + .../suggest-impl-trait-lifetime.nll.stderr | 14 --- .../ui/suggestions/suggest-impl-trait-lifetime.rs | 5 + .../suggestions/suggest-impl-trait-lifetime.stderr | 4 +- 29 files changed, 637 insertions(+), 400 deletions(-) create mode 100644 src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.base.stderr delete mode 100644 src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.stderr create mode 100644 src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-nll.rs create mode 100644 src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-nll.stderr delete mode 100644 src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.nll.stderr create mode 100644 src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.base.stderr delete mode 100644 src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr create mode 100644 src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.base.stderr delete mode 100644 src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr create mode 100644 src/test/ui/suggestions/lifetimes/trait-object-nested-in-impl-trait.base.stderr delete mode 100644 src/test/ui/suggestions/lifetimes/trait-object-nested-in-impl-trait.stderr create mode 100644 src/test/ui/suggestions/suggest-impl-trait-lifetime-nll.fixed create mode 100644 src/test/ui/suggestions/suggest-impl-trait-lifetime-nll.rs create mode 100644 src/test/ui/suggestions/suggest-impl-trait-lifetime-nll.stderr delete mode 100644 src/test/ui/suggestions/suggest-impl-trait-lifetime.nll.stderr (limited to 'src/test') diff --git a/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.base.stderr b/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.base.stderr new file mode 100644 index 00000000000..12c7c8f9b7e --- /dev/null +++ b/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.base.stderr @@ -0,0 +1,42 @@ +error[E0515]: cannot return reference to function parameter `val` + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:25:9 + | +LL | val.use_self() + | ^^^^^^^^^^^^^^ returns a reference to data owned by the current function + +error[E0515]: cannot return reference to function parameter `val` + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:47:9 + | +LL | val.use_self() + | ^^^^^^^^^^^^^^ returns a reference to data owned by the current function + +error[E0515]: cannot return reference to function parameter `val` + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:113:9 + | +LL | val.use_self() + | ^^^^^^^^^^^^^^ returns a reference to data owned by the current function + +error[E0772]: `val` has lifetime `'a` but calling `use_self` introduces an implicit `'static` lifetime requirement + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:70:13 + | +LL | fn use_it<'a>(val: Box + 'a>) -> &'a () { + | -------------------------------------- this data with lifetime `'a`... +LL | val.use_self() + | ^^^^^^^^ ...is used and required to live as long as `'static` here + | +note: the used `impl` has a `'static` requirement + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:64:30 + | +LL | impl MyTrait for Box> { + | ^^^^^^^^^^^^^^^^^^^^^^^^ 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 MyTrait for Box + '_> { + | ++++ + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0515, E0772. +For more information about an error, try `rustc --explain E0515`. diff --git a/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.nll.stderr b/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.nll.stderr index 2dc300ac76f..db790049c6f 100644 --- a/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.nll.stderr +++ b/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.nll.stderr @@ -1,17 +1,17 @@ error[E0515]: cannot return reference to function parameter `val` - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:21:9 + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:25:9 | LL | val.use_self() | ^^^^^^^^^^^^^^ returns a reference to data owned by the current function error[E0515]: cannot return reference to function parameter `val` - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:43:9 + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:47:9 | LL | val.use_self() | ^^^^^^^^^^^^^^ returns a reference to data owned by the current function error[E0515]: cannot return reference to function parameter `val` - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:109:9 + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:113:9 | LL | val.use_self() | ^^^^^^^^^^^^^^ returns a reference to data owned by the current function diff --git a/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs b/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs index 0045d3fcf1c..ec90a0987f0 100644 --- a/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs +++ b/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + // FIXME: the following cases need to suggest more things to make users reach a working end state. mod bav { @@ -63,7 +67,7 @@ mod bay { impl Bar for i32 {} fn use_it<'a>(val: Box + 'a>) -> &'a () { - val.use_self() //~ ERROR E0772 + val.use_self() //[base]~ ERROR E0772 } } diff --git a/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.stderr b/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.stderr deleted file mode 100644 index b125eacfb6c..00000000000 --- a/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.stderr +++ /dev/null @@ -1,42 +0,0 @@ -error[E0515]: cannot return reference to function parameter `val` - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:21:9 - | -LL | val.use_self() - | ^^^^^^^^^^^^^^ returns a reference to data owned by the current function - -error[E0515]: cannot return reference to function parameter `val` - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:43:9 - | -LL | val.use_self() - | ^^^^^^^^^^^^^^ returns a reference to data owned by the current function - -error[E0515]: cannot return reference to function parameter `val` - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:109:9 - | -LL | val.use_self() - | ^^^^^^^^^^^^^^ returns a reference to data owned by the current function - -error[E0772]: `val` has lifetime `'a` but calling `use_self` introduces an implicit `'static` lifetime requirement - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:66:13 - | -LL | fn use_it<'a>(val: Box + 'a>) -> &'a () { - | -------------------------------------- this data with lifetime `'a`... -LL | val.use_self() - | ^^^^^^^^ ...is used and required to live as long as `'static` here - | -note: the used `impl` has a `'static` requirement - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:60:30 - | -LL | impl MyTrait for Box> { - | ^^^^^^^^^^^^^^^^^^^^^^^^ 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 MyTrait for Box + '_> { - | ++++ - -error: aborting due to 4 previous errors - -Some errors have detailed explanations: E0515, E0772. -For more information about an error, try `rustc --explain E0515`. diff --git a/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-nll.rs b/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-nll.rs new file mode 100644 index 00000000000..37be629e77c --- /dev/null +++ b/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-nll.rs @@ -0,0 +1,118 @@ +// FIXME(nll): On NLL stabilization, this should replace +// `impl-on-dyn-trait-with-implicit-static-bound.rs`. Compiletest has +// problems with rustfix and revisions. +// ignore-compare-mode-nll +// compile-flags: -Zborrowck=mir + +#![allow(dead_code)] + +mod foo { + trait OtherTrait<'a> {} + impl<'a> OtherTrait<'a> for &'a () {} + + 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, T>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a { + val.use_self::() //~ ERROR borrowed data escapes + } +} + +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 { + fn use_self(&self) -> &() { panic!() } + } + impl Irrelevant for Box {} + + fn use_it<'a>(val: &'a Box) -> &'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 + } +} + +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 + } +} + +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 + } +} + +fn main() {} 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 new file mode 100644 index 00000000000..38731ea8955 --- /dev/null +++ b/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-nll.stderr @@ -0,0 +1,55 @@ +error[E0521]: borrowed data escapes outside of function + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-nll.rs:25:9 + | +LL | fn use_it<'a, T>(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` + +error[E0521]: borrowed data escapes outside of function + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-nll.rs:74: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` + +error[E0521]: borrowed data escapes outside of function + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-nll.rs:94: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` + +error[E0521]: borrowed data escapes outside of function + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-nll.rs:114: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` + +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.fixed b/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.fixed index 3c10f85d942..74da1cbfea5 100644 --- a/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.fixed +++ b/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.fixed @@ -1,3 +1,8 @@ +// FIXME(nll): On NLL stabilization, this should be replaced by +// `impl-on-dyn-trait-with-implicit-static-bound-nll.rs`. Compiletest has +// problems with rustfix and revisions. +// ignore-compare-mode-nll + // run-rustfix #![allow(dead_code)] 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 deleted file mode 100644 index a1ef32c5445..00000000000 --- a/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.nll.stderr +++ /dev/null @@ -1,55 +0,0 @@ -error[E0521]: borrowed data escapes outside of function - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:20:9 - | -LL | fn use_it<'a, T>(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` - -error[E0521]: borrowed data escapes outside of function - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:69: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` - -error[E0521]: borrowed data escapes outside of function - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:88: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` - -error[E0521]: borrowed data escapes outside of function - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:108: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` - -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.rs b/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.rs index 88ab03dfc1e..e0058b181b4 100644 --- a/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.rs +++ b/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.rs @@ -1,3 +1,8 @@ +// FIXME(nll): On NLL stabilization, this should be replaced by +// `impl-on-dyn-trait-with-implicit-static-bound-nll.rs`. Compiletest has +// problems with rustfix and revisions. +// ignore-compare-mode-nll + // run-rustfix #![allow(dead_code)] diff --git a/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.stderr b/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.stderr index ed094c1365c..fbe7ac94a0a 100644 --- a/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.stderr +++ b/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.stderr @@ -1,5 +1,5 @@ error[E0759]: `val` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:20:13 + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:25:13 | LL | fn use_it<'a, T>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a { | ---------------------- this data with lifetime `'a`... @@ -7,7 +7,7 @@ LL | val.use_self::() | ^^^^^^^^ ...is used and required to live as long as `'static` here | note: the used `impl` has a `'static` requirement - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:14:32 + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:19:32 | LL | impl MyTrait for dyn ObjectTrait { | ^^^^^^^^^^^^^^ this has an implicit `'static` lifetime requirement @@ -19,7 +19,7 @@ LL | impl MyTrait for dyn ObjectTrait + '_ { | ++++ error[E0772]: `val` has lifetime `'a` but calling `use_self` introduces an implicit `'static` lifetime requirement - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:69:13 + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:74:13 | LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a { | ------------------- this data with lifetime `'a`... @@ -27,7 +27,7 @@ LL | val.use_self() | ^^^^^^^^ ...is used and required to live as long as `'static` here because of an implicit lifetime bound on the inherent `impl` | note: the used `impl` has a `'static` requirement - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:64:14 + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:69:14 | LL | impl dyn ObjectTrait { | ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement @@ -39,7 +39,7 @@ LL | impl dyn ObjectTrait + '_ { | ++++ error[E0759]: `val` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:88:13 + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:93:13 | LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> { | ------------------- this data with lifetime `'a`... @@ -47,7 +47,7 @@ LL | val.use_self() | ^^^^^^^^ ...is used and required to live as long as `'static` here | note: the used `impl` has a `'static` requirement - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:85:26 + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:90:26 | LL | fn use_self(&self) -> &() { panic!() } | -------- calling this method introduces the `impl`'s 'static` requirement @@ -64,7 +64,7 @@ LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a { | ++++ error[E0759]: `val` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:108:27 + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:113:27 | LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a { | ------------------- this data with lifetime `'a`... @@ -72,12 +72,12 @@ LL | MyTrait::use_self(val) | ^^^ ...is used here... | note: ...and is required to live as long as `'static` here - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:108:9 + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:113:9 | LL | MyTrait::use_self(val) | ^^^^^^^^^^^^^^^^^ note: the used `impl` has a `'static` requirement - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:104:26 + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:109:26 | LL | fn use_self(&self) -> &() { panic!() } | -------- calling this method introduces the `impl`'s 'static` requirement @@ -90,7 +90,7 @@ LL | impl MyTrait for dyn ObjectTrait + '_ {} | ++++ error[E0772]: `val` has lifetime `'a` but calling `use_self` introduces an implicit `'static` lifetime requirement - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:37:13 + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:42:13 | LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> &'a () { | ------------------- this data with lifetime `'a`... @@ -98,7 +98,7 @@ LL | val.use_self() | ^^^^^^^^ ...is used and required to live as long as `'static` here | note: the used `impl` has a `'static` requirement - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:31:26 + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:36:26 | LL | impl MyTrait for dyn ObjectTrait { | ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement @@ -110,7 +110,7 @@ LL | impl MyTrait for dyn ObjectTrait + '_ { | ++++ error[E0772]: `val` has lifetime `'a` but calling `use_self` introduces an implicit `'static` lifetime requirement - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:54:13 + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:59:13 | LL | fn use_it<'a>(val: &'a Box) -> &'a () { | ----------------------------- this data with lifetime `'a`... @@ -118,7 +118,7 @@ LL | val.use_self() | ^^^^^^^^ ...is used and required to live as long as `'static` here | note: the used `impl` has a `'static` requirement - --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:48:30 + --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:53:30 | LL | impl MyTrait for Box { | ^^^^^^^^^^^ this has an implicit `'static` lifetime requirement diff --git a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.base.stderr b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.base.stderr new file mode 100644 index 00000000000..4e0e6675e5a --- /dev/null +++ b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.base.stderr @@ -0,0 +1,28 @@ +error[E0311]: the parameter type `T` may not live long enough + --> $DIR/missing-lifetimes-in-signature-2.rs:24:9 + | +LL | foo.bar(move |_| { + | ^^^ + | +note: the parameter type `T` must be valid for the anonymous lifetime defined here... + --> $DIR/missing-lifetimes-in-signature-2.rs:23:24 + | +LL | fn func(foo: &Foo, t: T) { + | ^^^ +note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature-2.rs:24:13: 27:6]` will meet its required lifetime bounds... + --> $DIR/missing-lifetimes-in-signature-2.rs:24:9 + | +LL | foo.bar(move |_| { + | ^^^ +note: ...that is required by this bound + --> $DIR/missing-lifetimes-in-signature-2.rs:15:12 + | +LL | F: 'a, + | ^^ +help: consider adding an explicit lifetime bound... + | +LL | fn func(foo: &Foo, t: T) { + | ++++ + +error: aborting due to previous error + diff --git a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.nll.stderr b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.nll.stderr index 0212c2d712c..9f35175c08d 100644 --- a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.nll.stderr +++ b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.nll.stderr @@ -1,5 +1,5 @@ error[E0311]: the parameter type `T` may not live long enough - --> $DIR/missing-lifetimes-in-signature-2.rs:20:5 + --> $DIR/missing-lifetimes-in-signature-2.rs:24:5 | LL | / foo.bar(move |_| { LL | | @@ -8,12 +8,12 @@ LL | | }); | |______^ | note: the parameter type `T` must be valid for the anonymous lifetime defined here... - --> $DIR/missing-lifetimes-in-signature-2.rs:19:24 + --> $DIR/missing-lifetimes-in-signature-2.rs:23:24 | LL | fn func(foo: &Foo, t: T) { | ^^^ note: ...so that the type `T` will meet its required lifetime bounds - --> $DIR/missing-lifetimes-in-signature-2.rs:20:5 + --> $DIR/missing-lifetimes-in-signature-2.rs:24:5 | LL | / foo.bar(move |_| { LL | | diff --git a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.rs b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.rs index c6802ac6cc7..3e3b4403304 100644 --- a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.rs +++ b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + // Regression test for #81650 struct Foo<'a> { diff --git a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr deleted file mode 100644 index 5d195e5ff32..00000000000 --- a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr +++ /dev/null @@ -1,28 +0,0 @@ -error[E0311]: the parameter type `T` may not live long enough - --> $DIR/missing-lifetimes-in-signature-2.rs:20:9 - | -LL | foo.bar(move |_| { - | ^^^ - | -note: the parameter type `T` must be valid for the anonymous lifetime defined here... - --> $DIR/missing-lifetimes-in-signature-2.rs:19:24 - | -LL | fn func(foo: &Foo, t: T) { - | ^^^ -note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature-2.rs:20:13: 23:6]` will meet its required lifetime bounds... - --> $DIR/missing-lifetimes-in-signature-2.rs:20:9 - | -LL | foo.bar(move |_| { - | ^^^ -note: ...that is required by this bound - --> $DIR/missing-lifetimes-in-signature-2.rs:11:12 - | -LL | F: 'a, - | ^^ -help: consider adding an explicit lifetime bound... - | -LL | fn func(foo: &Foo, t: T) { - | ++++ - -error: aborting due to previous error - diff --git a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.base.stderr b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.base.stderr new file mode 100644 index 00000000000..d51d12b909d --- /dev/null +++ b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.base.stderr @@ -0,0 +1,114 @@ +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/missing-lifetimes-in-signature.rs:42:11 + | +LL | fn baz(g: G, dest: &mut T) -> impl FnOnce() + '_ + | - ^^ undeclared lifetime + | | + | help: consider introducing lifetime `'a` here: `'a,` + +error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds + --> $DIR/missing-lifetimes-in-signature.rs:23:5 + | +LL | fn foo(g: G, dest: &mut T) -> impl FnOnce() + | ------ hidden type `[closure@$DIR/missing-lifetimes-in-signature.rs:23:5: 26:6]` captures the anonymous lifetime defined here +... +LL | / move || { +LL | | +LL | | *dest = g.get(); +LL | | } + | |_____^ + | +help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound + | +LL | fn foo(g: G, dest: &mut T) -> impl FnOnce() + '_ + | ++++ + +error[E0311]: the parameter type `G` may not live long enough + --> $DIR/missing-lifetimes-in-signature.rs:30:37 + | +LL | fn bar(g: G, dest: &mut T) -> impl FnOnce() + '_ + | ^^^^^^^^^^^^^^^^^^ + | +note: the parameter type `G` must be valid for the anonymous lifetime defined here... + --> $DIR/missing-lifetimes-in-signature.rs:30:26 + | +LL | fn bar(g: G, dest: &mut T) -> impl FnOnce() + '_ + | ^^^^^^ +note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:35:5: 38:6]` will meet its required lifetime bounds + --> $DIR/missing-lifetimes-in-signature.rs:30:37 + | +LL | fn bar(g: G, dest: &mut T) -> impl FnOnce() + '_ + | ^^^^^^^^^^^^^^^^^^ +help: consider introducing an explicit lifetime bound + | +LL ~ fn bar<'a, G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a +LL | +LL | where +LL ~ G: Get + 'a, + | + +error[E0311]: the parameter type `G` may not live long enough + --> $DIR/missing-lifetimes-in-signature.rs:53:45 + | +LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + | ^^^^^^^^^^^^^^^^^^ + | +note: the parameter type `G` must be valid for the anonymous lifetime defined here... + --> $DIR/missing-lifetimes-in-signature.rs:53:34 + | +LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + | ^^^^^^ +note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:58:5: 61:6]` will meet its required lifetime bounds + --> $DIR/missing-lifetimes-in-signature.rs:53:45 + | +LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + | ^^^^^^^^^^^^^^^^^^ +help: consider introducing an explicit lifetime bound + | +LL | fn qux<'b, 'a, G: 'a + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'b + | +++ ++++ ++++ + +error[E0311]: the parameter type `G` may not live long enough + --> $DIR/missing-lifetimes-in-signature.rs:66:58 + | +LL | fn qux<'b, G: Get + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ { + | ^^^^^^^^^^^^^^^^^^ + | +note: the parameter type `G` must be valid for the anonymous lifetime defined here... + --> $DIR/missing-lifetimes-in-signature.rs:66:47 + | +LL | fn qux<'b, G: Get + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ { + | ^^^^^^ +note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:68:9: 71:10]` will meet its required lifetime bounds + --> $DIR/missing-lifetimes-in-signature.rs:66:58 + | +LL | fn qux<'b, G: Get + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ { + | ^^^^^^^^^^^^^^^^^^ +help: consider introducing an explicit lifetime bound + | +LL | fn qux<'c, 'b, G: Get + 'b + 'c, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'c { + | +++ ++++ ++++ + +error[E0621]: explicit lifetime required in the type of `dest` + --> $DIR/missing-lifetimes-in-signature.rs:76:45 + | +LL | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a + | ------ ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required + | | + | help: add explicit lifetime `'a` to the type of `dest`: `&'a mut T` + +error[E0309]: the parameter type `G` may not live long enough + --> $DIR/missing-lifetimes-in-signature.rs:89:44 + | +LL | fn bak<'a, G, T>(g: G, dest: &'a mut T) -> impl FnOnce() + 'a + | ^^^^^^^^^^^^^^^^^^ ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:94:5: 97:6]` will meet its required lifetime bounds + | +help: consider adding an explicit lifetime bound... + | +LL | G: Get + 'a, + | ++++ + +error: aborting due to 7 previous errors + +Some errors have detailed explanations: E0261, E0309, E0621, E0700. +For more information about an error, try `rustc --explain E0261`. diff --git a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.nll.stderr b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.nll.stderr index 24eac64d334..63932cb6ba0 100644 --- a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.nll.stderr +++ b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.nll.stderr @@ -1,5 +1,5 @@ error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/missing-lifetimes-in-signature.rs:37:11 + --> $DIR/missing-lifetimes-in-signature.rs:42:11 | LL | fn baz(g: G, dest: &mut T) -> impl FnOnce() + '_ | - ^^ undeclared lifetime @@ -7,10 +7,10 @@ LL | fn baz(g: G, dest: &mut T) -> impl FnOnce() + '_ | help: consider introducing lifetime `'a` here: `'a,` error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds - --> $DIR/missing-lifetimes-in-signature.rs:19:5 + --> $DIR/missing-lifetimes-in-signature.rs:23:5 | LL | fn foo(g: G, dest: &mut T) -> impl FnOnce() - | ------ hidden type `[closure@$DIR/missing-lifetimes-in-signature.rs:19:5: 22:6]` captures the anonymous lifetime defined here + | ------ hidden type `[closure@$DIR/missing-lifetimes-in-signature.rs:23:5: 26:6]` captures the anonymous lifetime defined here ... LL | / move || { LL | | @@ -24,22 +24,24 @@ LL | fn foo(g: G, dest: &mut T) -> impl FnOnce() + '_ | ++++ error[E0311]: the parameter type `G` may not live long enough - --> $DIR/missing-lifetimes-in-signature.rs:31:5 + --> $DIR/missing-lifetimes-in-signature.rs:35:5 | LL | / move || { +LL | | LL | | *dest = g.get(); LL | | } | |_____^ | note: the parameter type `G` must be valid for the anonymous lifetime defined here... - --> $DIR/missing-lifetimes-in-signature.rs:26:26 + --> $DIR/missing-lifetimes-in-signature.rs:30:26 | LL | fn bar(g: G, dest: &mut T) -> impl FnOnce() + '_ | ^^^^^^ note: ...so that the type `G` will meet its required lifetime bounds - --> $DIR/missing-lifetimes-in-signature.rs:31:5 + --> $DIR/missing-lifetimes-in-signature.rs:35:5 | LL | / move || { +LL | | LL | | *dest = g.get(); LL | | } | |_____^ @@ -49,22 +51,24 @@ LL | G: Get + 'a, | ++++ error[E0311]: the parameter type `G` may not live long enough - --> $DIR/missing-lifetimes-in-signature.rs:53:5 + --> $DIR/missing-lifetimes-in-signature.rs:58:5 | LL | / move || { +LL | | LL | | *dest = g.get(); LL | | } | |_____^ | note: the parameter type `G` must be valid for the anonymous lifetime defined here... - --> $DIR/missing-lifetimes-in-signature.rs:48:34 + --> $DIR/missing-lifetimes-in-signature.rs:53:34 | LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ | ^^^^^^ note: ...so that the type `G` will meet its required lifetime bounds - --> $DIR/missing-lifetimes-in-signature.rs:53:5 + --> $DIR/missing-lifetimes-in-signature.rs:58:5 | LL | / move || { +LL | | LL | | *dest = g.get(); LL | | } | |_____^ @@ -74,22 +78,24 @@ LL | fn qux<'a, G: 'a + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ | ++++ error[E0311]: the parameter type `G` may not live long enough - --> $DIR/missing-lifetimes-in-signature.rs:62:9 + --> $DIR/missing-lifetimes-in-signature.rs:68:9 | LL | / move || { +LL | | LL | | *dest = g.get(); LL | | } | |_________^ | note: the parameter type `G` must be valid for the anonymous lifetime defined here... - --> $DIR/missing-lifetimes-in-signature.rs:60:47 + --> $DIR/missing-lifetimes-in-signature.rs:66:47 | LL | fn qux<'b, G: Get + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ { | ^^^^^^ note: ...so that the type `G` will meet its required lifetime bounds - --> $DIR/missing-lifetimes-in-signature.rs:62:9 + --> $DIR/missing-lifetimes-in-signature.rs:68:9 | LL | / move || { +LL | | LL | | *dest = g.get(); LL | | } | |_________^ @@ -99,22 +105,26 @@ LL | fn qux<'b, G: Get + 'b + 'c, T>(g: G, dest: &mut T) -> impl FnOnce() | ++++ error[E0311]: the parameter type `G` may not live long enough - --> $DIR/missing-lifetimes-in-signature.rs:74:5 + --> $DIR/missing-lifetimes-in-signature.rs:81:5 | LL | / move || { +LL | | +LL | | LL | | *dest = g.get(); LL | | } | |_____^ | note: the parameter type `G` must be valid for the anonymous lifetime defined here... - --> $DIR/missing-lifetimes-in-signature.rs:69:34 + --> $DIR/missing-lifetimes-in-signature.rs:76:34 | LL | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a | ^^^^^^ note: ...so that the type `G` will meet its required lifetime bounds - --> $DIR/missing-lifetimes-in-signature.rs:74:5 + --> $DIR/missing-lifetimes-in-signature.rs:81:5 | LL | / move || { +LL | | +LL | | LL | | *dest = g.get(); LL | | } | |_____^ @@ -124,20 +134,23 @@ LL | fn bat<'a, G: 'a + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a | ++++ error[E0621]: explicit lifetime required in the type of `dest` - --> $DIR/missing-lifetimes-in-signature.rs:74:5 + --> $DIR/missing-lifetimes-in-signature.rs:81:5 | LL | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a | ------ help: add explicit lifetime `'a` to the type of `dest`: `&'a mut T` ... LL | / move || { +LL | | +LL | | LL | | *dest = g.get(); LL | | } | |_____^ lifetime `'a` required error[E0309]: the parameter type `G` may not live long enough - --> $DIR/missing-lifetimes-in-signature.rs:85:5 + --> $DIR/missing-lifetimes-in-signature.rs:94:5 | LL | / move || { +LL | | LL | | *dest = g.get(); LL | | } | |_____^ ...so that the type `G` will meet its required lifetime bounds diff --git a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.rs b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.rs index 0a3e6b48163..20366201269 100644 --- a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.rs +++ b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + pub trait Get { fn get(self) -> T; } @@ -24,11 +28,12 @@ where // After applying suggestion for `foo`: fn bar(g: G, dest: &mut T) -> impl FnOnce() + '_ -//~^ ERROR the parameter type `G` may not live long enough +//[base]~^ ERROR the parameter type `G` may not live long enough where G: Get, { move || { + //[nll]~^ ERROR the parameter type `G` may not live long enough *dest = g.get(); } } @@ -46,11 +51,12 @@ where // After applying suggestion for `baz`: fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ -//~^ ERROR the parameter type `G` may not live long enough +//[base]~^ ERROR the parameter type `G` may not live long enough where G: Get, { move || { + //[nll]~^ ERROR the parameter type `G` may not live long enough *dest = g.get(); } } @@ -58,8 +64,9 @@ where // Same as above, but show that we pay attention to lifetime names from parent item impl<'a> Foo { fn qux<'b, G: Get + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ { - //~^ ERROR the parameter type `G` may not live long enough + //[base]~^ ERROR the parameter type `G` may not live long enough move || { + //[nll]~^ ERROR the parameter type `G` may not live long enough *dest = g.get(); } } @@ -67,22 +74,25 @@ impl<'a> Foo { // After applying suggestion for `qux`: fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a -//~^ ERROR explicit lifetime required in the type of `dest` +//[base]~^ ERROR explicit lifetime required in the type of `dest` where G: Get, { move || { + //[nll]~^ ERROR the parameter type `G` may not live long enough + //[nll]~| ERROR explicit lifetime required *dest = g.get(); } } // Potential incorrect attempt: fn bak<'a, G, T>(g: G, dest: &'a mut T) -> impl FnOnce() + 'a -//~^ ERROR the parameter type `G` may not live long enough +//[base]~^ ERROR the parameter type `G` may not live long enough where G: Get, { move || { + //[nll]~^ ERROR the parameter type `G` may not live long enough *dest = g.get(); } } diff --git a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr deleted file mode 100644 index ae9a020a099..00000000000 --- a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr +++ /dev/null @@ -1,114 +0,0 @@ -error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/missing-lifetimes-in-signature.rs:37:11 - | -LL | fn baz(g: G, dest: &mut T) -> impl FnOnce() + '_ - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'a` here: `'a,` - -error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds - --> $DIR/missing-lifetimes-in-signature.rs:19:5 - | -LL | fn foo(g: G, dest: &mut T) -> impl FnOnce() - | ------ hidden type `[closure@$DIR/missing-lifetimes-in-signature.rs:19:5: 22:6]` captures the anonymous lifetime defined here -... -LL | / move || { -LL | | -LL | | *dest = g.get(); -LL | | } - | |_____^ - | -help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound - | -LL | fn foo(g: G, dest: &mut T) -> impl FnOnce() + '_ - | ++++ - -error[E0311]: the parameter type `G` may not live long enough - --> $DIR/missing-lifetimes-in-signature.rs:26:37 - | -LL | fn bar(g: G, dest: &mut T) -> impl FnOnce() + '_ - | ^^^^^^^^^^^^^^^^^^ - | -note: the parameter type `G` must be valid for the anonymous lifetime defined here... - --> $DIR/missing-lifetimes-in-signature.rs:26:26 - | -LL | fn bar(g: G, dest: &mut T) -> impl FnOnce() + '_ - | ^^^^^^ -note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:31:5: 33:6]` will meet its required lifetime bounds - --> $DIR/missing-lifetimes-in-signature.rs:26:37 - | -LL | fn bar(g: G, dest: &mut T) -> impl FnOnce() + '_ - | ^^^^^^^^^^^^^^^^^^ -help: consider introducing an explicit lifetime bound - | -LL ~ fn bar<'a, G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a -LL | -LL | where -LL ~ G: Get + 'a, - | - -error[E0311]: the parameter type `G` may not live long enough - --> $DIR/missing-lifetimes-in-signature.rs:48:45 - | -LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ - | ^^^^^^^^^^^^^^^^^^ - | -note: the parameter type `G` must be valid for the anonymous lifetime defined here... - --> $DIR/missing-lifetimes-in-signature.rs:48:34 - | -LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ - | ^^^^^^ -note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:53:5: 55:6]` will meet its required lifetime bounds - --> $DIR/missing-lifetimes-in-signature.rs:48:45 - | -LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ - | ^^^^^^^^^^^^^^^^^^ -help: consider introducing an explicit lifetime bound - | -LL | fn qux<'b, 'a, G: 'a + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'b - | +++ ++++ ++++ - -error[E0311]: the parameter type `G` may not live long enough - --> $DIR/missing-lifetimes-in-signature.rs:60:58 - | -LL | fn qux<'b, G: Get + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ { - | ^^^^^^^^^^^^^^^^^^ - | -note: the parameter type `G` must be valid for the anonymous lifetime defined here... - --> $DIR/missing-lifetimes-in-signature.rs:60:47 - | -LL | fn qux<'b, G: Get + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ { - | ^^^^^^ -note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:62:9: 64:10]` will meet its required lifetime bounds - --> $DIR/missing-lifetimes-in-signature.rs:60:58 - | -LL | fn qux<'b, G: Get + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ { - | ^^^^^^^^^^^^^^^^^^ -help: consider introducing an explicit lifetime bound - | -LL | fn qux<'c, 'b, G: Get + 'b + 'c, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'c { - | +++ ++++ ++++ - -error[E0621]: explicit lifetime required in the type of `dest` - --> $DIR/missing-lifetimes-in-signature.rs:69:45 - | -LL | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a - | ------ ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required - | | - | help: add explicit lifetime `'a` to the type of `dest`: `&'a mut T` - -error[E0309]: the parameter type `G` may not live long enough - --> $DIR/missing-lifetimes-in-signature.rs:80:44 - | -LL | fn bak<'a, G, T>(g: G, dest: &'a mut T) -> impl FnOnce() + 'a - | ^^^^^^^^^^^^^^^^^^ ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:85:5: 87:6]` will meet its required lifetime bounds - | -help: consider adding an explicit lifetime bound... - | -LL | G: Get + 'a, - | ++++ - -error: aborting due to 7 previous errors - -Some errors have detailed explanations: E0261, E0309, E0621, E0700. -For more information about an error, try `rustc --explain E0261`. diff --git a/src/test/ui/suggestions/lifetimes/trait-object-nested-in-impl-trait.base.stderr b/src/test/ui/suggestions/lifetimes/trait-object-nested-in-impl-trait.base.stderr new file mode 100644 index 00000000000..0bd7f289340 --- /dev/null +++ b/src/test/ui/suggestions/lifetimes/trait-object-nested-in-impl-trait.base.stderr @@ -0,0 +1,95 @@ +error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement + --> $DIR/trait-object-nested-in-impl-trait.rs:35:31 + | +LL | fn iter(&self) -> impl Iterator> { + | ----- this data with an anonymous lifetime `'_`... +... +LL | remaining: self.0.iter(), + | ------ ^^^^ + | | + | ...is used here... + | +note: ...and is required to live as long as `'static` here + --> $DIR/trait-object-nested-in-impl-trait.rs:31:23 + | +LL | fn iter(&self) -> impl Iterator> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: to declare that the `impl Trait` captures data from argument `self`, you can add an explicit `'_` lifetime bound + | +LL | fn iter(&self) -> impl Iterator> + '_ { + | ++++ +help: to declare that the trait object captures data from argument `self`, you can add an explicit `'_` lifetime bound + | +LL | fn iter(&self) -> impl Iterator> { + | ++++ + +error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement + --> $DIR/trait-object-nested-in-impl-trait.rs:48:31 + | +LL | fn iter(&self) -> impl Iterator> + '_ { + | ----- this data with an anonymous lifetime `'_`... +... +LL | remaining: self.0.iter(), + | ------ ^^^^ + | | + | ...is used here... + | +note: ...and is required to live as long as `'static` here + --> $DIR/trait-object-nested-in-impl-trait.rs:44:23 + | +LL | fn iter(&self) -> impl Iterator> + '_ { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: to declare that the trait object captures data from argument `self`, you can add an explicit `'_` lifetime bound + | +LL | fn iter(&self) -> impl Iterator> + '_ { + | ++++ + +error[E0759]: `self` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement + --> $DIR/trait-object-nested-in-impl-trait.rs:61:31 + | +LL | fn iter<'a>(&'a self) -> impl Iterator> + 'a { + | -------- this data with lifetime `'a`... +... +LL | remaining: self.0.iter(), + | ------ ^^^^ + | | + | ...is used here... + | +note: ...and is required to live as long as `'static` here + --> $DIR/trait-object-nested-in-impl-trait.rs:57:30 + | +LL | fn iter<'a>(&'a self) -> impl Iterator> + 'a { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: to declare that the trait object captures data from argument `self`, you can add an explicit `'a` lifetime bound + | +LL | fn iter<'a>(&'a self) -> impl Iterator> + 'a { + | ++++ + +error[E0759]: `self` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement + --> $DIR/trait-object-nested-in-impl-trait.rs:74:31 + | +LL | fn iter<'a>(&'a self) -> impl Iterator> { + | -------- this data with lifetime `'a`... +... +LL | remaining: self.0.iter(), + | ------ ^^^^ + | | + | ...is used here... + | +note: ...and is required to live as long as `'static` here + --> $DIR/trait-object-nested-in-impl-trait.rs:70:30 + | +LL | fn iter<'a>(&'a self) -> impl Iterator> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: to declare that the `impl Trait` captures data from argument `self`, you can add an explicit `'a` lifetime bound + | +LL | fn iter<'a>(&'a self) -> impl Iterator> + 'a { + | ++++ +help: to declare that the trait object captures data from argument `self`, you can add an explicit `'a` lifetime bound + | +LL | fn iter<'a>(&'a self) -> impl Iterator> { + | ++++ + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0759`. diff --git a/src/test/ui/suggestions/lifetimes/trait-object-nested-in-impl-trait.nll.stderr b/src/test/ui/suggestions/lifetimes/trait-object-nested-in-impl-trait.nll.stderr index 6c65e4f0175..989f18e7182 100644 --- a/src/test/ui/suggestions/lifetimes/trait-object-nested-in-impl-trait.nll.stderr +++ b/src/test/ui/suggestions/lifetimes/trait-object-nested-in-impl-trait.nll.stderr @@ -1,11 +1,13 @@ error: lifetime may not live long enough - --> $DIR/trait-object-nested-in-impl-trait.rs:28:9 + --> $DIR/trait-object-nested-in-impl-trait.rs:32:9 | LL | fn iter(&self) -> impl Iterator> { | - let's call the lifetime of this reference `'1` LL | / Iter { +LL | | LL | | current: None, LL | | remaining: self.0.iter(), +LL | | LL | | } | |_________^ returning this value requires that `'1` must outlive `'static` | @@ -19,13 +21,15 @@ LL | fn iter(&self) -> impl Iterator> { | ++++ error: lifetime may not live long enough - --> $DIR/trait-object-nested-in-impl-trait.rs:39:9 + --> $DIR/trait-object-nested-in-impl-trait.rs:45:9 | LL | fn iter(&self) -> impl Iterator> + '_ { | - let's call the lifetime of this reference `'1` LL | / Iter { +LL | | LL | | current: None, LL | | remaining: self.0.iter(), +LL | | LL | | } | |_________^ returning this value requires that `'1` must outlive `'static` | @@ -35,13 +39,15 @@ LL | fn iter(&self) -> impl Iterator> + '_ { | ++++ error: lifetime may not live long enough - --> $DIR/trait-object-nested-in-impl-trait.rs:50:9 + --> $DIR/trait-object-nested-in-impl-trait.rs:58:9 | LL | fn iter<'a>(&'a self) -> impl Iterator> + 'a { | -- lifetime `'a` defined here LL | / Iter { +LL | | LL | | current: None, LL | | remaining: self.0.iter(), +LL | | LL | | } | |_________^ returning this value requires that `'a` must outlive `'static` | @@ -51,13 +57,15 @@ LL | fn iter<'a>(&'a self) -> impl Iterator> + 'a { | ++++ error: lifetime may not live long enough - --> $DIR/trait-object-nested-in-impl-trait.rs:61:9 + --> $DIR/trait-object-nested-in-impl-trait.rs:71:9 | LL | fn iter<'a>(&'a self) -> impl Iterator> { | -- lifetime `'a` defined here LL | / Iter { +LL | | LL | | current: None, LL | | remaining: self.0.iter(), +LL | | LL | | } | |_________^ returning this value requires that `'a` must outlive `'static` | diff --git a/src/test/ui/suggestions/lifetimes/trait-object-nested-in-impl-trait.rs b/src/test/ui/suggestions/lifetimes/trait-object-nested-in-impl-trait.rs index d8446e58dbb..5d868a58c0f 100644 --- a/src/test/ui/suggestions/lifetimes/trait-object-nested-in-impl-trait.rs +++ b/src/test/ui/suggestions/lifetimes/trait-object-nested-in-impl-trait.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Foo {} impl<'a, T: Foo> Foo for &'a T {} impl Foo for Box {} @@ -26,8 +30,10 @@ struct Bar(Vec>); impl Bar { fn iter(&self) -> impl Iterator> { Iter { + //[nll]~^ ERROR lifetime may not live long enough current: None, - remaining: self.0.iter(), //~ ERROR E0759 + remaining: self.0.iter(), + //[base]~^ ERROR E0759 } } } @@ -37,8 +43,10 @@ struct Baz(Vec>); impl Baz { fn iter(&self) -> impl Iterator> + '_ { Iter { + //[nll]~^ ERROR lifetime may not live long enough current: None, - remaining: self.0.iter(), //~ ERROR E0759 + remaining: self.0.iter(), + //[base]~^ ERROR E0759 } } } @@ -48,8 +56,10 @@ struct Bat(Vec>); impl Bat { fn iter<'a>(&'a self) -> impl Iterator> + 'a { Iter { + //[nll]~^ ERROR lifetime may not live long enough current: None, - remaining: self.0.iter(), //~ ERROR E0759 + remaining: self.0.iter(), + //[base]~^ ERROR E0759 } } } @@ -59,8 +69,10 @@ struct Ban(Vec>); impl Ban { fn iter<'a>(&'a self) -> impl Iterator> { Iter { + //[nll]~^ ERROR lifetime may not live long enough current: None, - remaining: self.0.iter(), //~ ERROR E0759 + remaining: self.0.iter(), + //[base]~^ ERROR E0759 } } } diff --git a/src/test/ui/suggestions/lifetimes/trait-object-nested-in-impl-trait.stderr b/src/test/ui/suggestions/lifetimes/trait-object-nested-in-impl-trait.stderr deleted file mode 100644 index a5b50634c71..00000000000 --- a/src/test/ui/suggestions/lifetimes/trait-object-nested-in-impl-trait.stderr +++ /dev/null @@ -1,95 +0,0 @@ -error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/trait-object-nested-in-impl-trait.rs:30:31 - | -LL | fn iter(&self) -> impl Iterator> { - | ----- this data with an anonymous lifetime `'_`... -... -LL | remaining: self.0.iter(), - | ------ ^^^^ - | | - | ...is used here... - | -note: ...and is required to live as long as `'static` here - --> $DIR/trait-object-nested-in-impl-trait.rs:27:23 - | -LL | fn iter(&self) -> impl Iterator> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: to declare that the `impl Trait` captures data from argument `self`, you can add an explicit `'_` lifetime bound - | -LL | fn iter(&self) -> impl Iterator> + '_ { - | ++++ -help: to declare that the trait object captures data from argument `self`, you can add an explicit `'_` lifetime bound - | -LL | fn iter(&self) -> impl Iterator> { - | ++++ - -error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/trait-object-nested-in-impl-trait.rs:41:31 - | -LL | fn iter(&self) -> impl Iterator> + '_ { - | ----- this data with an anonymous lifetime `'_`... -... -LL | remaining: self.0.iter(), - | ------ ^^^^ - | | - | ...is used here... - | -note: ...and is required to live as long as `'static` here - --> $DIR/trait-object-nested-in-impl-trait.rs:38:23 - | -LL | fn iter(&self) -> impl Iterator> + '_ { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: to declare that the trait object captures data from argument `self`, you can add an explicit `'_` lifetime bound - | -LL | fn iter(&self) -> impl Iterator> + '_ { - | ++++ - -error[E0759]: `self` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/trait-object-nested-in-impl-trait.rs:52:31 - | -LL | fn iter<'a>(&'a self) -> impl Iterator> + 'a { - | -------- this data with lifetime `'a`... -... -LL | remaining: self.0.iter(), - | ------ ^^^^ - | | - | ...is used here... - | -note: ...and is required to live as long as `'static` here - --> $DIR/trait-object-nested-in-impl-trait.rs:49:30 - | -LL | fn iter<'a>(&'a self) -> impl Iterator> + 'a { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: to declare that the trait object captures data from argument `self`, you can add an explicit `'a` lifetime bound - | -LL | fn iter<'a>(&'a self) -> impl Iterator> + 'a { - | ++++ - -error[E0759]: `self` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/trait-object-nested-in-impl-trait.rs:63:31 - | -LL | fn iter<'a>(&'a self) -> impl Iterator> { - | -------- this data with lifetime `'a`... -... -LL | remaining: self.0.iter(), - | ------ ^^^^ - | | - | ...is used here... - | -note: ...and is required to live as long as `'static` here - --> $DIR/trait-object-nested-in-impl-trait.rs:60:30 - | -LL | fn iter<'a>(&'a self) -> impl Iterator> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: to declare that the `impl Trait` captures data from argument `self`, you can add an explicit `'a` lifetime bound - | -LL | fn iter<'a>(&'a self) -> impl Iterator> + 'a { - | ++++ -help: to declare that the trait object captures data from argument `self`, you can add an explicit `'a` lifetime bound - | -LL | fn iter<'a>(&'a self) -> impl Iterator> { - | ++++ - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0759`. diff --git a/src/test/ui/suggestions/suggest-impl-trait-lifetime-nll.fixed b/src/test/ui/suggestions/suggest-impl-trait-lifetime-nll.fixed new file mode 100644 index 00000000000..c363cc2d0e1 --- /dev/null +++ b/src/test/ui/suggestions/suggest-impl-trait-lifetime-nll.fixed @@ -0,0 +1,24 @@ +// FIXME(nll): On NLL stabilization, this should be replace +// `suggest-impl-trait-lifetime.rs`. Compiletest has +// problems with rustfix and revisions. +// ignore-compare-mode-nll +// compile-flags: -Zborrowck=mir + +// run-rustfix + +use std::fmt::Debug; + +fn foo(d: impl Debug + 'static) { +//~^ HELP consider adding an explicit lifetime bound... + bar(d); +//~^ ERROR the parameter type `impl Debug` may not live long enough +//~| NOTE ...so that the type `impl Debug` will meet its required lifetime bounds +} + +fn bar(d: impl Debug + 'static) { + println!("{:?}", d) +} + +fn main() { + foo("hi"); +} diff --git a/src/test/ui/suggestions/suggest-impl-trait-lifetime-nll.rs b/src/test/ui/suggestions/suggest-impl-trait-lifetime-nll.rs new file mode 100644 index 00000000000..dd275f6630b --- /dev/null +++ b/src/test/ui/suggestions/suggest-impl-trait-lifetime-nll.rs @@ -0,0 +1,24 @@ +// FIXME(nll): On NLL stabilization, this should be replace +// `suggest-impl-trait-lifetime.rs`. Compiletest has +// problems with rustfix and revisions. +// ignore-compare-mode-nll +// compile-flags: -Zborrowck=mir + +// run-rustfix + +use std::fmt::Debug; + +fn foo(d: impl Debug) { +//~^ HELP consider adding an explicit lifetime bound... + bar(d); +//~^ ERROR the parameter type `impl Debug` may not live long enough +//~| NOTE ...so that the type `impl Debug` will meet its required lifetime bounds +} + +fn bar(d: impl Debug + 'static) { + println!("{:?}", d) +} + +fn main() { + foo("hi"); +} diff --git a/src/test/ui/suggestions/suggest-impl-trait-lifetime-nll.stderr b/src/test/ui/suggestions/suggest-impl-trait-lifetime-nll.stderr new file mode 100644 index 00000000000..41226fdf9fe --- /dev/null +++ b/src/test/ui/suggestions/suggest-impl-trait-lifetime-nll.stderr @@ -0,0 +1,14 @@ +error[E0310]: the parameter type `impl Debug` may not live long enough + --> $DIR/suggest-impl-trait-lifetime-nll.rs:13:5 + | +LL | bar(d); + | ^^^^^^ ...so that the type `impl Debug` will meet its required lifetime bounds + | +help: consider adding an explicit lifetime bound... + | +LL | fn foo(d: impl Debug + 'static) { + | +++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0310`. diff --git a/src/test/ui/suggestions/suggest-impl-trait-lifetime.fixed b/src/test/ui/suggestions/suggest-impl-trait-lifetime.fixed index 65aab97d3d7..75ff26c0435 100644 --- a/src/test/ui/suggestions/suggest-impl-trait-lifetime.fixed +++ b/src/test/ui/suggestions/suggest-impl-trait-lifetime.fixed @@ -1,3 +1,8 @@ +// FIXME(nll): On NLL stabilization, this should be replaced by +// `suggest-impl-trait-lifetime-nll.rs`. Compiletest has +// problems with rustfix and revisions. +// ignore-compare-mode-nll + // run-rustfix use std::fmt::Debug; diff --git a/src/test/ui/suggestions/suggest-impl-trait-lifetime.nll.stderr b/src/test/ui/suggestions/suggest-impl-trait-lifetime.nll.stderr deleted file mode 100644 index cf912f4aac2..00000000000 --- a/src/test/ui/suggestions/suggest-impl-trait-lifetime.nll.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0310]: the parameter type `impl Debug` may not live long enough - --> $DIR/suggest-impl-trait-lifetime.rs:7:5 - | -LL | bar(d); - | ^^^^^^ ...so that the type `impl Debug` will meet its required lifetime bounds - | -help: consider adding an explicit lifetime bound... - | -LL | fn foo(d: impl Debug + 'static) { - | +++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0310`. diff --git a/src/test/ui/suggestions/suggest-impl-trait-lifetime.rs b/src/test/ui/suggestions/suggest-impl-trait-lifetime.rs index fb1848d130f..b93fe103a4a 100644 --- a/src/test/ui/suggestions/suggest-impl-trait-lifetime.rs +++ b/src/test/ui/suggestions/suggest-impl-trait-lifetime.rs @@ -1,3 +1,8 @@ +// FIXME(nll): On NLL stabilization, this should be replaced by +// `suggest-impl-trait-lifetime-nll.rs`. Compiletest has +// problems with rustfix and revisions. +// ignore-compare-mode-nll + // run-rustfix use std::fmt::Debug; diff --git a/src/test/ui/suggestions/suggest-impl-trait-lifetime.stderr b/src/test/ui/suggestions/suggest-impl-trait-lifetime.stderr index 4a99c3a14d7..85f36ea78aa 100644 --- a/src/test/ui/suggestions/suggest-impl-trait-lifetime.stderr +++ b/src/test/ui/suggestions/suggest-impl-trait-lifetime.stderr @@ -1,11 +1,11 @@ error[E0310]: the parameter type `impl Debug` may not live long enough - --> $DIR/suggest-impl-trait-lifetime.rs:7:5 + --> $DIR/suggest-impl-trait-lifetime.rs:12:5 | LL | bar(d); | ^^^ ...so that the type `impl Debug` will meet its required lifetime bounds... | note: ...that is required by this bound - --> $DIR/suggest-impl-trait-lifetime.rs:12:24 + --> $DIR/suggest-impl-trait-lifetime.rs:17:24 | LL | fn bar(d: impl Debug + 'static) { | ^^^^^^^ -- cgit 1.4.1-3-g733a5