diff options
Diffstat (limited to 'src')
58 files changed, 35 insertions, 1323 deletions
diff --git a/src/test/ui/async-await/generics-and-bounds.rs b/src/test/ui/async-await/generics-and-bounds.rs index 90ab0c01f54..963b19b34a6 100644 --- a/src/test/ui/async-await/generics-and-bounds.rs +++ b/src/test/ui/async-await/generics-and-bounds.rs @@ -2,8 +2,6 @@ // edition:2018 // compile-flags: --crate-type lib -#![feature(in_band_lifetimes)] - use std::future::Future; pub async fn simple_generic<T>() {} @@ -73,10 +71,6 @@ pub fn call_with_ref_block<'a>(f: &'a (impl Foo + 'a)) -> impl Future<Output = ( async move { f.foo() } } -pub fn call_with_ref_block_in_band(f: &'a (impl Foo + 'a)) -> impl Future<Output = ()> + 'a { - async move { f.foo() } -} - pub fn async_block_with_same_generic_params_unifies() { let mut a = call_generic_bound_block(FooType); a = call_generic_bound_block(FooType); @@ -91,9 +85,4 @@ pub fn async_block_with_same_generic_params_unifies() { let f_two = FooType; let mut d = call_with_ref_block(&f_one); d = call_with_ref_block(&f_two); - - let f_one = FooType; - let f_two = FooType; - let mut d = call_with_ref_block_in_band(&f_one); - d = call_with_ref_block_in_band(&f_two); } diff --git a/src/test/ui/error-codes/E0261.stderr b/src/test/ui/error-codes/E0261.stderr index 33d74feead5..0eab2dc0ee0 100644 --- a/src/test/ui/error-codes/E0261.stderr +++ b/src/test/ui/error-codes/E0261.stderr @@ -5,8 +5,6 @@ LL | fn foo(x: &'a str) { } | - ^^ undeclared lifetime | | | help: consider introducing lifetime `'a` here: `<'a>` - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0261]: use of undeclared lifetime name `'a` --> $DIR/E0261.rs:5:9 @@ -15,8 +13,6 @@ LL | struct Foo { | - help: consider introducing lifetime `'a` here: `<'a>` LL | x: &'a str, | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error: aborting due to 2 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.rs b/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.rs deleted file mode 100644 index 0e5f968892f..00000000000 --- a/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.rs +++ /dev/null @@ -1,62 +0,0 @@ -#![allow(warnings)] - -fn foo(x: &'x u8) -> &'x u8 { x } -//~^ ERROR use of undeclared lifetime name -//~^^ ERROR use of undeclared lifetime name - -struct X<'a>(&'a u8); - -impl<'a> X<'a> { - fn inner(&self) -> &'a u8 { - self.0 - } -} - -impl<'a> X<'b> { -//~^ ERROR use of undeclared lifetime name - fn inner_2(&self) -> &'b u8 { - //~^ ERROR use of undeclared lifetime name - self.0 - } -} - -impl X<'b> { -//~^ ERROR use of undeclared lifetime name - fn inner_3(&self) -> &'b u8 { - //~^ ERROR use of undeclared lifetime name - self.0 - } -} - -struct Y<T>(T); - -impl Y<&'a u8> { - //~^ ERROR use of undeclared lifetime name - fn inner(&self) -> &'a u8 { - //~^ ERROR use of undeclared lifetime name - self.0 - } -} - -trait MyTrait<'a> { - fn my_lifetime(&self) -> &'a u8; - fn any_lifetime() -> &'b u8; - //~^ ERROR use of undeclared lifetime name - fn borrowed_lifetime(&'b self) -> &'b u8; - //~^ ERROR use of undeclared lifetime name - //~^^ ERROR use of undeclared lifetime name -} - -impl MyTrait<'a> for Y<&'a u8> { -//~^ ERROR use of undeclared lifetime name -//~^^ ERROR use of undeclared lifetime name - fn my_lifetime(&self) -> &'a u8 { self.0 } - //~^ ERROR use of undeclared lifetime name - fn any_lifetime() -> &'b u8 { &0 } - //~^ ERROR use of undeclared lifetime name - fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 } - //~^ ERROR use of undeclared lifetime name - //~^^ ERROR use of undeclared lifetime name -} - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.stderr b/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.stderr deleted file mode 100644 index 41fb1456f86..00000000000 --- a/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.stderr +++ /dev/null @@ -1,231 +0,0 @@ -error[E0261]: use of undeclared lifetime name `'x` - --> $DIR/feature-gate-in_band_lifetimes.rs:3:12 - | -LL | fn foo(x: &'x u8) -> &'x u8 { x } - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'x` here: `<'x>` - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes - -error[E0261]: use of undeclared lifetime name `'x` - --> $DIR/feature-gate-in_band_lifetimes.rs:3:23 - | -LL | fn foo(x: &'x u8) -> &'x u8 { x } - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'x` here: `<'x>` - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes - -error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:15:12 - | -LL | impl<'a> X<'b> { - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'b` here: `'b,` - -error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:17:27 - | -LL | fn inner_2(&self) -> &'b u8 { - | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes -help: consider introducing lifetime `'b` here - | -LL | impl<'b, 'a> X<'b> { - | +++ -help: consider introducing lifetime `'b` here - | -LL | fn inner_2<'b>(&self) -> &'b u8 { - | ++++ - -error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:23:8 - | -LL | impl X<'b> { - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'b` here: `<'b>` - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes - -error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:25:27 - | -LL | fn inner_3(&self) -> &'b u8 { - | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes -help: consider introducing lifetime `'b` here - | -LL | impl<'b> X<'b> { - | ++++ -help: consider introducing lifetime `'b` here - | -LL | fn inner_3<'b>(&self) -> &'b u8 { - | ++++ - -error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/feature-gate-in_band_lifetimes.rs:33:9 - | -LL | impl Y<&'a u8> { - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'a` here: `<'a>` - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes - -error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/feature-gate-in_band_lifetimes.rs:35:25 - | -LL | fn inner(&self) -> &'a u8 { - | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes -help: consider introducing lifetime `'a` here - | -LL | impl<'a> Y<&'a u8> { - | ++++ -help: consider introducing lifetime `'a` here - | -LL | fn inner<'a>(&self) -> &'a u8 { - | ++++ - -error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/feature-gate-in_band_lifetimes.rs:50:14 - | -LL | impl MyTrait<'a> for Y<&'a u8> { - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'a` here: `<'a>` - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes - -error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/feature-gate-in_band_lifetimes.rs:50:25 - | -LL | impl MyTrait<'a> for Y<&'a u8> { - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'a` here: `<'a>` - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes - -error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/feature-gate-in_band_lifetimes.rs:53:31 - | -LL | fn my_lifetime(&self) -> &'a u8 { self.0 } - | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes -help: consider introducing lifetime `'a` here - | -LL | impl<'a> MyTrait<'a> for Y<&'a u8> { - | ++++ -help: consider introducing lifetime `'a` here - | -LL | fn my_lifetime<'a>(&self) -> &'a u8 { self.0 } - | ++++ - -error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:55:27 - | -LL | fn any_lifetime() -> &'b u8 { &0 } - | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes -help: consider introducing lifetime `'b` here - | -LL | impl<'b> MyTrait<'a> for Y<&'a u8> { - | ++++ -help: consider introducing lifetime `'b` here - | -LL | fn any_lifetime<'b>() -> &'b u8 { &0 } - | ++++ - -error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:57:27 - | -LL | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 } - | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes -help: consider introducing lifetime `'b` here - | -LL | impl<'b> MyTrait<'a> for Y<&'a u8> { - | ++++ -help: consider introducing lifetime `'b` here - | -LL | fn borrowed_lifetime<'b>(&'b self) -> &'b u8 { &*self.0 } - | ++++ - -error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:57:40 - | -LL | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 } - | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes -help: consider introducing lifetime `'b` here - | -LL | impl<'b> MyTrait<'a> for Y<&'a u8> { - | ++++ -help: consider introducing lifetime `'b` here - | -LL | fn borrowed_lifetime<'b>(&'b self) -> &'b u8 { &*self.0 } - | ++++ - -error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:43:27 - | -LL | fn any_lifetime() -> &'b u8; - | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes -help: consider introducing lifetime `'b` here - | -LL | trait MyTrait<'b, 'a> { - | +++ -help: consider introducing lifetime `'b` here - | -LL | fn any_lifetime<'b>() -> &'b u8; - | ++++ - -error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:45:27 - | -LL | fn borrowed_lifetime(&'b self) -> &'b u8; - | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes -help: consider introducing lifetime `'b` here - | -LL | trait MyTrait<'b, 'a> { - | +++ -help: consider introducing lifetime `'b` here - | -LL | fn borrowed_lifetime<'b>(&'b self) -> &'b u8; - | ++++ - -error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:45:40 - | -LL | fn borrowed_lifetime(&'b self) -> &'b u8; - | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes -help: consider introducing lifetime `'b` here - | -LL | trait MyTrait<'b, 'a> { - | +++ -help: consider introducing lifetime `'b` here - | -LL | fn borrowed_lifetime<'b>(&'b self) -> &'b u8; - | ++++ - -error: aborting due to 17 previous errors - -For more information about this error, try `rustc --explain E0261`. diff --git a/src/test/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.stderr b/src/test/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.stderr index ce9df46483d..317897ae70f 100644 --- a/src/test/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.stderr +++ b/src/test/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.stderr @@ -5,8 +5,6 @@ LL | fn _f(arg : Box<dyn for<'a> X<Y<'x> = &'a [u32]>>) {} | - ^^ undeclared lifetime | | | help: consider introducing lifetime `'x` here: `<'x>` - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0582]: binding for associated type `Y` references lifetime `'a`, which does not appear in the trait input types --> $DIR/gat-in-trait-path-undeclared-lifetime.rs:8:33 diff --git a/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr b/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr index adbd47ac16f..bf0ca871503 100644 --- a/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr +++ b/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr @@ -4,7 +4,6 @@ error[E0261]: use of undeclared lifetime name `'b` LL | + Deref<Target = Self::Item<'b>>; | ^^ undeclared lifetime | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes help: consider introducing lifetime `'b` here | LL | trait Iterable<'b> { @@ -20,7 +19,6 @@ error[E0261]: use of undeclared lifetime name `'undeclared` LL | fn iter<'a>(&'a self) -> Self::Iter<'undeclared>; | ^^^^^^^^^^^ undeclared lifetime | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes help: consider introducing lifetime `'undeclared` here | LL | trait Iterable<'undeclared> { diff --git a/src/test/ui/generic-associated-types/issue-67510.stderr b/src/test/ui/generic-associated-types/issue-67510.stderr index 8ed2854ed30..abc02b33e0e 100644 --- a/src/test/ui/generic-associated-types/issue-67510.stderr +++ b/src/test/ui/generic-associated-types/issue-67510.stderr @@ -5,8 +5,6 @@ LL | fn f(x: Box<dyn X<Y<'a>=&'a ()>>) {} | - ^^ undeclared lifetime | | | help: consider introducing lifetime `'a` here: `<'a>` - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0261]: use of undeclared lifetime name `'a` --> $DIR/issue-67510.rs:7:26 @@ -15,8 +13,6 @@ LL | fn f(x: Box<dyn X<Y<'a>=&'a ()>>) {} | - ^^ undeclared lifetime | | | help: consider introducing lifetime `'a` here: `<'a>` - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error: aborting due to 2 previous errors diff --git a/src/test/ui/impl-trait/region-escape-via-bound-contravariant-closure.rs b/src/test/ui/impl-trait/region-escape-via-bound-contravariant-closure.rs index adaa474474f..9f63a8617ba 100644 --- a/src/test/ui/impl-trait/region-escape-via-bound-contravariant-closure.rs +++ b/src/test/ui/impl-trait/region-escape-via-bound-contravariant-closure.rs @@ -8,9 +8,8 @@ // run-pass #![allow(dead_code)] -#![feature(in_band_lifetimes)] -fn foo(x: &'x u32) -> impl Fn() -> &'y u32 +fn foo<'x, 'y>(x: &'x u32) -> impl Fn() -> &'y u32 where 'x: 'y { move || x diff --git a/src/test/ui/impl-trait/region-escape-via-bound-contravariant.rs b/src/test/ui/impl-trait/region-escape-via-bound-contravariant.rs index 204c2ff3041..79319dfe796 100644 --- a/src/test/ui/impl-trait/region-escape-via-bound-contravariant.rs +++ b/src/test/ui/impl-trait/region-escape-via-bound-contravariant.rs @@ -8,13 +8,12 @@ // run-pass #![allow(dead_code)] -#![feature(in_band_lifetimes)] trait Trait<'a> { } -impl Trait<'b> for &'a u32 { } +impl<'a, 'b> Trait<'b> for &'a u32 { } -fn foo(x: &'x u32) -> impl Trait<'y> +fn foo<'x, 'y>(x: &'x u32) -> impl Trait<'y> where 'x: 'y { x diff --git a/src/test/ui/impl-trait/region-escape-via-bound.rs b/src/test/ui/impl-trait/region-escape-via-bound.rs index 29243699e44..e834f96dbbe 100644 --- a/src/test/ui/impl-trait/region-escape-via-bound.rs +++ b/src/test/ui/impl-trait/region-escape-via-bound.rs @@ -4,15 +4,14 @@ // See https://github.com/rust-lang/rust/issues/46541 for more details. #![allow(dead_code)] -#![feature(in_band_lifetimes)] use std::cell::Cell; trait Trait<'a> { } -impl Trait<'b> for Cell<&'a u32> { } +impl<'a, 'b> Trait<'b> for Cell<&'a u32> { } -fn foo(x: Cell<&'x u32>) -> impl Trait<'y> +fn foo<'x, 'y>(x: Cell<&'x u32>) -> impl Trait<'y> //~^ ERROR hidden type for `impl Trait` captures lifetime that does not appear in bounds [E0700] where 'x: 'y { diff --git a/src/test/ui/impl-trait/region-escape-via-bound.stderr b/src/test/ui/impl-trait/region-escape-via-bound.stderr index cf854f67d04..ecec34e0115 100644 --- a/src/test/ui/impl-trait/region-escape-via-bound.stderr +++ b/src/test/ui/impl-trait/region-escape-via-bound.stderr @@ -1,16 +1,15 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds - --> $DIR/region-escape-via-bound.rs:15:29 + --> $DIR/region-escape-via-bound.rs:14:37 | -LL | fn foo(x: Cell<&'x u32>) -> impl Trait<'y> - | ^^^^^^^^^^^^^^ -LL | -LL | where 'x: 'y - | -- hidden type `Cell<&'x u32>` captures the lifetime `'x` as defined here +LL | fn foo<'x, 'y>(x: Cell<&'x u32>) -> impl Trait<'y> + | -- ^^^^^^^^^^^^^^ + | | + | hidden type `Cell<&'x u32>` captures the lifetime `'x` as defined here | help: to declare that the `impl Trait` captures `'x`, you can add an explicit `'x` lifetime bound | -LL | fn foo(x: Cell<&'x u32>) -> impl Trait<'y> + 'x - | ++++ +LL | fn foo<'x, 'y>(x: Cell<&'x u32>) -> impl Trait<'y> + 'x + | ++++ error: aborting due to previous error diff --git a/src/test/ui/in-band-lifetimes/E0687.rs b/src/test/ui/in-band-lifetimes/E0687.rs deleted file mode 100644 index 2e262ddaea3..00000000000 --- a/src/test/ui/in-band-lifetimes/E0687.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![allow(warnings)] -#![feature(in_band_lifetimes)] - -fn foo(x: fn(&'a u32)) {} //~ ERROR must be explicitly - -fn bar(x: &Fn(&'a u32)) {} //~ ERROR must be explicitly - -fn baz(x: fn(&'a u32), y: &'a u32) {} //~ ERROR must be explicitly - -struct Foo<'a> { x: &'a u32 } - -impl Foo<'a> { - fn bar(&self, x: fn(&'a u32)) {} //~ ERROR must be explicitly -} - -fn main() {} diff --git a/src/test/ui/in-band-lifetimes/E0687.stderr b/src/test/ui/in-band-lifetimes/E0687.stderr deleted file mode 100644 index 7aea2f22046..00000000000 --- a/src/test/ui/in-band-lifetimes/E0687.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders - --> $DIR/E0687.rs:4:15 - | -LL | fn foo(x: fn(&'a u32)) {} - | ^^ in-band lifetime definition - -error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders - --> $DIR/E0687.rs:6:16 - | -LL | fn bar(x: &Fn(&'a u32)) {} - | ^^ in-band lifetime definition - -error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders - --> $DIR/E0687.rs:8:15 - | -LL | fn baz(x: fn(&'a u32), y: &'a u32) {} - | ^^ in-band lifetime definition - -error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders - --> $DIR/E0687.rs:13:26 - | -LL | fn bar(&self, x: fn(&'a u32)) {} - | ^^ in-band lifetime definition - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0687`. diff --git a/src/test/ui/in-band-lifetimes/E0687_where.rs b/src/test/ui/in-band-lifetimes/E0687_where.rs deleted file mode 100644 index 6cf8053287d..00000000000 --- a/src/test/ui/in-band-lifetimes/E0687_where.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![allow(warnings)] -#![feature(in_band_lifetimes)] - -fn bar<F>(x: &F) where F: Fn(&'a u32) {} //~ ERROR must be explicitly - -fn baz(x: &impl Fn(&'a u32)) {} //~ ERROR must be explicitly - -fn main() {} diff --git a/src/test/ui/in-band-lifetimes/E0687_where.stderr b/src/test/ui/in-band-lifetimes/E0687_where.stderr deleted file mode 100644 index af0f9665f5d..00000000000 --- a/src/test/ui/in-band-lifetimes/E0687_where.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders - --> $DIR/E0687_where.rs:4:31 - | -LL | fn bar<F>(x: &F) where F: Fn(&'a u32) {} - | ^^ in-band lifetime definition - -error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders - --> $DIR/E0687_where.rs:6:21 - | -LL | fn baz(x: &impl Fn(&'a u32)) {} - | ^^ in-band lifetime definition - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0687`. diff --git a/src/test/ui/in-band-lifetimes/E0688.rs b/src/test/ui/in-band-lifetimes/E0688.rs deleted file mode 100644 index a4e1f01c178..00000000000 --- a/src/test/ui/in-band-lifetimes/E0688.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![allow(warnings)] -#![feature(in_band_lifetimes)] - -fn foo<'a>(x: &'a u32, y: &'b u32) {} //~ ERROR cannot mix - -struct Foo<'a> { x: &'a u32 } - -impl Foo<'a> { - fn bar<'b>(x: &'a u32, y: &'b u32, z: &'c u32) {} //~ ERROR cannot mix -} - -impl<'b> Foo<'a> { //~ ERROR cannot mix - fn baz() {} -} - -fn main() {} diff --git a/src/test/ui/in-band-lifetimes/E0688.stderr b/src/test/ui/in-band-lifetimes/E0688.stderr deleted file mode 100644 index afefcd9fc2c..00000000000 --- a/src/test/ui/in-band-lifetimes/E0688.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0688]: cannot mix in-band and explicit lifetime definitions - --> $DIR/E0688.rs:4:28 - | -LL | fn foo<'a>(x: &'a u32, y: &'b u32) {} - | -- ^^ in-band lifetime definition here - | | - | explicit lifetime definition here - -error[E0688]: cannot mix in-band and explicit lifetime definitions - --> $DIR/E0688.rs:9:44 - | -LL | fn bar<'b>(x: &'a u32, y: &'b u32, z: &'c u32) {} - | -- ^^ in-band lifetime definition here - | | - | explicit lifetime definition here - -error[E0688]: cannot mix in-band and explicit lifetime definitions - --> $DIR/E0688.rs:12:14 - | -LL | impl<'b> Foo<'a> { - | -- ^^ in-band lifetime definition here - | | - | explicit lifetime definition here - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0688`. diff --git a/src/test/ui/in-band-lifetimes/elided-lifetimes.fixed b/src/test/ui/in-band-lifetimes/elided-lifetimes.fixed deleted file mode 100644 index 87a79b88137..00000000000 --- a/src/test/ui/in-band-lifetimes/elided-lifetimes.fixed +++ /dev/null @@ -1,119 +0,0 @@ -// run-rustfix -// edition:2018 - -#![allow(unused)] -#![deny(elided_lifetimes_in_paths)] -//~^ NOTE the lint level is defined here - -use std::cell::{Ref, RefCell}; - -struct Foo<'a> { - x: &'a u32, -} - -fn foo(x: &Foo<'_>) { - //~^ ERROR hidden lifetime parameters in types are deprecated - //~| NOTE expected named lifetime parameter - //~| HELP consider using the `'_` lifetime -} - -fn bar(x: &Foo<'_>) {} - -struct Wrapped<'a>(&'a str); - -struct WrappedWithBow<'a> { - gift: &'a str, -} - -struct MatchedSet<'a, 'b> { - one: &'a str, - another: &'b str, -} - -fn wrap_gift(gift: &str) -> Wrapped<'_> { - //~^ ERROR hidden lifetime parameters in types are deprecated - //~| NOTE expected named lifetime parameter - //~| HELP consider using the `'_` lifetime - Wrapped(gift) -} - -fn wrap_gift_with_bow(gift: &str) -> WrappedWithBow<'_> { - //~^ ERROR hidden lifetime parameters in types are deprecated - //~| NOTE expected named lifetime parameter - //~| HELP consider using the `'_` lifetime - WrappedWithBow { gift } -} - -fn inspect_matched_set(set: MatchedSet<'_, '_>) { - //~^ ERROR hidden lifetime parameters in types are deprecated - //~| NOTE expected 2 lifetime parameters - //~| HELP consider using the `'_` lifetime - println!("{} {}", set.one, set.another); -} - -// Verify that the lint does not fire, because the added `'_` wouldn't be resolved correctly. -fn match_sets() -> MatchedSet<'static, 'static> { - //~^ ERROR missing lifetime specifiers - //~| NOTE expected 2 lifetime parameters - //~| HELP this function's return type contains a borrowed value - //~| HELP consider using the `'static` lifetime - MatchedSet { one: "one", another: "another" } -} - -macro_rules! autowrapper { - ($type_name:ident, $fn_name:ident, $lt:lifetime) => { - struct $type_name<$lt> { - gift: &$lt str - } - - fn $fn_name(gift: &str) -> $type_name<'_> { - //~^ ERROR hidden lifetime parameters in types are deprecated - //~| NOTE expected named lifetime parameter - //~| HELP consider using the `'_` lifetime - //~| ERROR hidden lifetime parameters in types are deprecated - //~| NOTE expected named lifetime parameter - //~| HELP consider using the `'_` lifetime - $type_name { gift } - } - } -} - -autowrapper!(Autowrapped, autowrap_gift, 'a); -//~^ NOTE in this expansion of autowrapper! -//~| NOTE in this expansion of autowrapper! - -// Verify that rustfix does not try to apply the fix twice. -autowrapper!(AutowrappedAgain, autowrap_gift_again, 'a); -//~^ NOTE in this expansion of autowrapper! -//~| NOTE in this expansion of autowrapper! - -macro_rules! anytuple_ref_ty { - ($($types:ty),*) => { - Ref<'_, ($($types),*)> - //~^ ERROR hidden lifetime parameters in types are deprecated - //~| NOTE expected named lifetime parameter - //~| HELP consider using the `'_` lifetime - } -} - -#[allow(elided_lifetimes_in_paths)] -mod blah { - struct Thing<'a>(&'a i32); - struct Bar<T>(T); - - fn foo(b: Bar<Thing>) {} -} - -fn main() { - let honesty = RefCell::new((4, 'e')); - let loyalty: Ref<'_, (u32, char)> = honesty.borrow(); - //~^ ERROR hidden lifetime parameters in types are deprecated - //~| NOTE expected named lifetime parameter - //~| HELP consider using the `'_` lifetime - let generosity = Ref::map(loyalty, |t| &t.0); - - let laughter = RefCell::new((true, "magic")); - let yellow: anytuple_ref_ty!(bool, &str) = laughter.borrow(); - //~^ NOTE in this expansion of anytuple_ref_ty! - //~| NOTE in this expansion of anytuple_ref_ty! -} diff --git a/src/test/ui/in-band-lifetimes/elided-lifetimes.rs b/src/test/ui/in-band-lifetimes/elided-lifetimes.rs deleted file mode 100644 index 28323a22427..00000000000 --- a/src/test/ui/in-band-lifetimes/elided-lifetimes.rs +++ /dev/null @@ -1,119 +0,0 @@ -// run-rustfix -// edition:2018 - -#![allow(unused)] -#![deny(elided_lifetimes_in_paths)] -//~^ NOTE the lint level is defined here - -use std::cell::{Ref, RefCell}; - -struct Foo<'a> { - x: &'a u32, -} - -fn foo(x: &Foo) { - //~^ ERROR hidden lifetime parameters in types are deprecated - //~| NOTE expected named lifetime parameter - //~| HELP consider using the `'_` lifetime -} - -fn bar(x: &Foo<'_>) {} - -struct Wrapped<'a>(&'a str); - -struct WrappedWithBow<'a> { - gift: &'a str, -} - -struct MatchedSet<'a, 'b> { - one: &'a str, - another: &'b str, -} - -fn wrap_gift(gift: &str) -> Wrapped { - //~^ ERROR hidden lifetime parameters in types are deprecated - //~| NOTE expected named lifetime parameter - //~| HELP consider using the `'_` lifetime - Wrapped(gift) -} - -fn wrap_gift_with_bow(gift: &str) -> WrappedWithBow { - //~^ ERROR hidden lifetime parameters in types are deprecated - //~| NOTE expected named lifetime parameter - //~| HELP consider using the `'_` lifetime - WrappedWithBow { gift } -} - -fn inspect_matched_set(set: MatchedSet) { - //~^ ERROR hidden lifetime parameters in types are deprecated - //~| NOTE expected 2 lifetime parameters - //~| HELP consider using the `'_` lifetime - println!("{} {}", set.one, set.another); -} - -// Verify that the lint does not fire, because the added `'_` wouldn't be resolved correctly. -fn match_sets() -> MatchedSet { - //~^ ERROR missing lifetime specifiers - //~| NOTE expected 2 lifetime parameters - //~| HELP this function's return type contains a borrowed value - //~| HELP consider using the `'static` lifetime - MatchedSet { one: "one", another: "another" } -} - -macro_rules! autowrapper { - ($type_name:ident, $fn_name:ident, $lt:lifetime) => { - struct $type_name<$lt> { - gift: &$lt str - } - - fn $fn_name(gift: &str) -> $type_name { - //~^ ERROR hidden lifetime parameters in types are deprecated - //~| NOTE expected named lifetime parameter - //~| HELP consider using the `'_` lifetime - //~| ERROR hidden lifetime parameters in types are deprecated - //~| NOTE expected named lifetime parameter - //~| HELP consider using the `'_` lifetime - $type_name { gift } - } - } -} - -autowrapper!(Autowrapped, autowrap_gift, 'a); -//~^ NOTE in this expansion of autowrapper! -//~| NOTE in this expansion of autowrapper! - -// Verify that rustfix does not try to apply the fix twice. -autowrapper!(AutowrappedAgain, autowrap_gift_again, 'a); -//~^ NOTE in this expansion of autowrapper! -//~| NOTE in this expansion of autowrapper! - -macro_rules! anytuple_ref_ty { - ($($types:ty),*) => { - Ref<($($types),*)> - //~^ ERROR hidden lifetime parameters in types are deprecated - //~| NOTE expected named lifetime parameter - //~| HELP consider using the `'_` lifetime - } -} - -#[allow(elided_lifetimes_in_paths)] -mod blah { - struct Thing<'a>(&'a i32); - struct Bar<T>(T); - - fn foo(b: Bar<Thing>) {} -} - -fn main() { - let honesty = RefCell::new((4, 'e')); - let loyalty: Ref<(u32, char)> = honesty.borrow(); - //~^ ERROR hidden lifetime parameters in types are deprecated - //~| NOTE expected named lifetime parameter - //~| HELP consider using the `'_` lifetime - let generosity = Ref::map(loyalty, |t| &t.0); - - let laughter = RefCell::new((true, "magic")); - let yellow: anytuple_ref_ty!(bool, &str) = laughter.borrow(); - //~^ NOTE in this expansion of anytuple_ref_ty! - //~| NOTE in this expansion of anytuple_ref_ty! -} diff --git a/src/test/ui/in-band-lifetimes/elided-lifetimes.stderr b/src/test/ui/in-band-lifetimes/elided-lifetimes.stderr deleted file mode 100644 index 2e65461b321..00000000000 --- a/src/test/ui/in-band-lifetimes/elided-lifetimes.stderr +++ /dev/null @@ -1,120 +0,0 @@ -error: hidden lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:14:12 - | -LL | fn foo(x: &Foo) { - | ^^^ expected named lifetime parameter - | -note: the lint level is defined here - --> $DIR/elided-lifetimes.rs:5:9 - | -LL | #![deny(elided_lifetimes_in_paths)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ -help: consider using the `'_` lifetime - | -LL | fn foo(x: &Foo<'_>) { - | ~~~~~~~ - -error: hidden lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:33:29 - | -LL | fn wrap_gift(gift: &str) -> Wrapped { - | ^^^^^^^ expected named lifetime parameter - | -help: consider using the `'_` lifetime - | -LL | fn wrap_gift(gift: &str) -> Wrapped<'_> { - | ~~~~~~~~~~~ - -error: hidden lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:40:38 - | -LL | fn wrap_gift_with_bow(gift: &str) -> WrappedWithBow { - | ^^^^^^^^^^^^^^ expected named lifetime parameter - | -help: consider using the `'_` lifetime - | -LL | fn wrap_gift_with_bow(gift: &str) -> WrappedWithBow<'_> { - | ~~~~~~~~~~~~~~~~~~ - -error: hidden lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:47:29 - | -LL | fn inspect_matched_set(set: MatchedSet) { - | ^^^^^^^^^^ expected 2 lifetime parameters - | -help: consider using the `'_` lifetime - | -LL | fn inspect_matched_set(set: MatchedSet<'_, '_>) { - | ~~~~~~~~~~~~~~~~~~ - -error[E0106]: missing lifetime specifiers - --> $DIR/elided-lifetimes.rs:55:20 - | -LL | fn match_sets() -> MatchedSet { - | ^^^^^^^^^^ expected 2 lifetime parameters - | - = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from -help: consider using the `'static` lifetime - | -LL | fn match_sets() -> MatchedSet<'static, 'static> { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -error: hidden lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:69:36 - | -LL | fn $fn_name(gift: &str) -> $type_name { - | ^^^^^^^^^^ expected named lifetime parameter -... -LL | autowrapper!(Autowrapped, autowrap_gift, 'a); - | -------------------------------------------- in this macro invocation - | - = note: this error originates in the macro `autowrapper` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider using the `'_` lifetime - | -LL | fn $fn_name(gift: &str) -> $type_name<'_> { - | ~~~~~~~~~~~~~~ - -error: hidden lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:69:36 - | -LL | fn $fn_name(gift: &str) -> $type_name { - | ^^^^^^^^^^ expected named lifetime parameter -... -LL | autowrapper!(AutowrappedAgain, autowrap_gift_again, 'a); - | ------------------------------------------------------- in this macro invocation - | - = note: this error originates in the macro `autowrapper` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider using the `'_` lifetime - | -LL | fn $fn_name(gift: &str) -> $type_name<'_> { - | ~~~~~~~~~~~~~~ - -error: hidden lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:109:22 - | -LL | let loyalty: Ref<(u32, char)> = honesty.borrow(); - | ^ expected named lifetime parameter - | -help: consider using the `'_` lifetime - | -LL | let loyalty: Ref<'_, (u32, char)> = honesty.borrow(); - | +++ - -error: hidden lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:92:13 - | -LL | Ref<($($types),*)> - | ^ expected named lifetime parameter -... -LL | let yellow: anytuple_ref_ty!(bool, &str) = laughter.borrow(); - | ---------------------------- in this macro invocation - | - = note: this error originates in the macro `anytuple_ref_ty` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider using the `'_` lifetime - | -LL | Ref<'_, ($($types),*)> - | +++ - -error: aborting due to 9 previous errors - -For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/in-band-lifetimes/in-band-lifetimes.rs b/src/test/ui/in-band-lifetimes/in-band-lifetimes.rs deleted file mode 100644 index 9b2e1fe83c1..00000000000 --- a/src/test/ui/in-band-lifetimes/in-band-lifetimes.rs +++ /dev/null @@ -1,96 +0,0 @@ -// run-pass - -#![allow(warnings)] -#![feature(in_band_lifetimes)] - -fn foo(x: &'x u8) -> &'x u8 { x } -fn foo2(x: &'a u8, y: &u8) -> &'a u8 { x } - -fn check_in_band_can_be_late_bound() { - let _: for<'x> fn(&'x u8, &u8) -> &'x u8 = foo2; -} - -struct ForInherentNoParams; - -impl ForInherentNoParams { - fn foo(x: &'a u32, y: &u32) -> &'a u32 { x } -} - -struct X<'a>(&'a u8); - -impl<'a> X<'a> { - fn inner(&self) -> &'a u8 { - self.0 - } - - fn same_lifetime_as_parameter(&mut self, x: &'a u8) { - self.0 = x; - } -} - -impl X<'b> { - fn inner_2(&self) -> &'b u8 { - self.0 - } - - fn reference_already_introduced_in_band_from_method_with_explicit_binders<'a>( - &'b self, x: &'a u32 - ) {} -} - -struct Y<T>(T); - -impl Y<&'a u8> { - fn inner(&self) -> &'a u8 { - self.0 - } -} - -trait MyTrait<'a> { - fn my_lifetime(&self) -> &'a u8; - fn any_lifetime() -> &'b u8; - fn borrowed_lifetime(&'b self) -> &'b u8; - fn default_impl(&self, x: &'b u32, y: &u32) -> &'b u32 { x } - fn in_band_def_explicit_impl(&self, x: &'b u8); -} - -impl MyTrait<'a> for Y<&'a u8> { - fn my_lifetime(&self) -> &'a u8 { self.0 } - fn any_lifetime() -> &'b u8 { &0 } - fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 } - fn in_band_def_explicit_impl<'b>(&self, x: &'b u8) {} -} - -fn test_hrtb_defined_lifetime_where<F>(_: F) where for<'a> F: Fn(&'a u8) {} -fn test_hrtb_defined_lifetime_polytraitref<F>(_: F) where F: for<'a> Fn(&'a u8) {} - -fn reference_in_band_from_locals(x: &'test u32) -> &'test u32 { - let y: &'test u32 = x; - y -} - -fn in_generics_in_band<T: MyTrait<'a>>(x: &T) {} -fn where_clause_in_band<T>(x: &T) where T: MyTrait<'a> {} -fn impl_trait_in_band(x: &impl MyTrait<'a>) {} - -// Tests around using in-band lifetimes within existential traits. - -trait FunkyTrait<'a> { } -impl<'a, T> FunkyTrait<'a> for T { } -fn ret_pos_impl_trait_in_band_outlives(x: &'a u32) -> impl ::std::fmt::Debug + 'a { - x -} -fn ret_pos_impl_trait_in_band_param(x: &'a u32) -> impl FunkyTrait<'a> { - x -} -fn ret_pos_impl_trait_in_band_param_static(x: &'a u32) -> impl FunkyTrait<'static> + 'a { - x -} -fn ret_pos_impl_trait_in_band_param_outlives(x: &'a u32) -> impl FunkyTrait<'a> + 'a { - x -} -fn ret_pos_impl_trait_in_band_higher_ranked(x: &'a u32) -> impl for<'b> FunkyTrait<'b> + 'a { - x -} - -fn main() {} diff --git a/src/test/ui/in-band-lifetimes/issue-61124-anon-lifetime-in-struct-declaration.rs b/src/test/ui/in-band-lifetimes/issue-61124-anon-lifetime-in-struct-declaration.rs deleted file mode 100644 index cf08cb7eeac..00000000000 --- a/src/test/ui/in-band-lifetimes/issue-61124-anon-lifetime-in-struct-declaration.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![deny(elided_lifetimes_in_paths)] - -// Previously, the elided-lifetimes-in-path lint would fire, but we don't want -// that, because `'_` isn't legal in struct declarations. - -struct Betrayal<'a> { x: &'a u8 } - -struct Heartbreak(Betrayal); //~ ERROR missing lifetime specifier - -fn main() {} diff --git a/src/test/ui/in-band-lifetimes/issue-61124-anon-lifetime-in-struct-declaration.stderr b/src/test/ui/in-band-lifetimes/issue-61124-anon-lifetime-in-struct-declaration.stderr deleted file mode 100644 index 20369a543b3..00000000000 --- a/src/test/ui/in-band-lifetimes/issue-61124-anon-lifetime-in-struct-declaration.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0106]: missing lifetime specifier - --> $DIR/issue-61124-anon-lifetime-in-struct-declaration.rs:8:19 - | -LL | struct Heartbreak(Betrayal); - | ^^^^^^^^ expected named lifetime parameter - | -help: consider introducing a named lifetime parameter - | -LL | struct Heartbreak<'a>(Betrayal<'a>); - | ++++ ~~~~~~~~~~~~ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/in-band-lifetimes/mismatched.nll.stderr b/src/test/ui/in-band-lifetimes/mismatched.nll.stderr deleted file mode 100644 index db028e63a82..00000000000 --- a/src/test/ui/in-band-lifetimes/mismatched.nll.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error[E0621]: explicit lifetime required in the type of `y` - --> $DIR/mismatched.rs:4:42 - | -LL | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } - | ---- ^ lifetime `'a` required - | | - | help: add explicit lifetime `'a` to the type of `y`: `&'a u32` - -error: lifetime may not live long enough - --> $DIR/mismatched.rs:6:46 - | -LL | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y } - | -- -- ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` - | | | - | | lifetime `'b` defined here - | lifetime `'a` defined here - | - = help: consider adding the following bound: `'b: 'a` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0621`. diff --git a/src/test/ui/in-band-lifetimes/mismatched.rs b/src/test/ui/in-band-lifetimes/mismatched.rs deleted file mode 100644 index 11c41eae954..00000000000 --- a/src/test/ui/in-band-lifetimes/mismatched.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![allow(warnings)] -#![feature(in_band_lifetimes)] - -fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } //~ ERROR explicit lifetime required - -fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y } //~ ERROR lifetime mismatch - -fn main() {} diff --git a/src/test/ui/in-band-lifetimes/mismatched.stderr b/src/test/ui/in-band-lifetimes/mismatched.stderr deleted file mode 100644 index db72c206971..00000000000 --- a/src/test/ui/in-band-lifetimes/mismatched.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0621]: explicit lifetime required in the type of `y` - --> $DIR/mismatched.rs:4:42 - | -LL | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } - | ---- ^ lifetime `'a` required - | | - | help: add explicit lifetime `'a` to the type of `y`: `&'a u32` - -error[E0623]: lifetime mismatch - --> $DIR/mismatched.rs:6:46 - | -LL | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y } - | ------- ------- ^ ...but data from `y` is returned here - | | - | this parameter and the return type are declared with different lifetimes... - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0621, E0623. -For more information about an error, try `rustc --explain E0621`. diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait.rs b/src/test/ui/in-band-lifetimes/mismatched_trait.rs deleted file mode 100644 index 221f4fc271b..00000000000 --- a/src/test/ui/in-band-lifetimes/mismatched_trait.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![allow(warnings)] -#![feature(in_band_lifetimes)] - -trait Get { - fn baz(&self, x: &'a u32, y: &u32) -> &'a u32 { - y //~ ERROR explicit lifetime required - } -} - -fn main() {} diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait.stderr deleted file mode 100644 index ac66daa21c7..00000000000 --- a/src/test/ui/in-band-lifetimes/mismatched_trait.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0621]: explicit lifetime required in the type of `y` - --> $DIR/mismatched_trait.rs:6:9 - | -LL | fn baz(&self, x: &'a u32, y: &u32) -> &'a u32 { - | ---- help: add explicit lifetime `'a` to the type of `y`: `&'a u32` -LL | y - | ^ lifetime `'a` required - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0621`. diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs deleted file mode 100644 index 1b524ec3833..00000000000 --- a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs +++ /dev/null @@ -1,14 +0,0 @@ -use std::ops::Deref; -trait Trait {} - -struct Struct; - -impl Deref for Struct { - type Target = dyn Trait; - fn deref(&self) -> &dyn Trait { - //~^ ERROR `impl` item signature doesn't match `trait` item signature - unimplemented!(); - } -} - -fn main() {} diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr deleted file mode 100644 index 0546b6b51b2..00000000000 --- a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error: `impl` item signature doesn't match `trait` item signature - --> $DIR/mismatched_trait_impl-2.rs:8:5 - | -LL | fn deref(&self) -> &dyn Trait { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Struct) -> &'1 (dyn Trait + '1)` - | - ::: $SRC_DIR/core/src/ops/deref.rs:LL:COL - | -LL | fn deref(&self) -> &Self::Target; - | --------------------------------- expected `fn(&'1 Struct) -> &'1 (dyn Trait + 'static)` - | - = note: expected `fn(&'1 Struct) -> &'1 (dyn Trait + 'static)` - found `fn(&'1 Struct) -> &'1 (dyn Trait + '1)` - = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` - = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output - -error: aborting due to previous error - diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl.nll.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait_impl.nll.stderr deleted file mode 100644 index c7a90c57add..00000000000 --- a/src/test/ui/in-band-lifetimes/mismatched_trait_impl.nll.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error: `impl` item signature doesn't match `trait` item signature - --> $DIR/mismatched_trait_impl.rs:9:5 - | -LL | fn foo(&self, x: &'a u32, y: &u32) -> &'a u32; - | ---------------------------------------------- expected `fn(&'1 i32, &'a u32, &'2 u32) -> &'a u32` -... -LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 i32, &'2 u32, &'3 u32) -> &'3 u32` - | - = note: expected `fn(&'1 i32, &'a u32, &'2 u32) -> &'a u32` - found `fn(&'1 i32, &'2 u32, &'3 u32) -> &'3 u32` - = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` - = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output - -error: aborting due to previous error - diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl.rs b/src/test/ui/in-band-lifetimes/mismatched_trait_impl.rs deleted file mode 100644 index b9e02e967c1..00000000000 --- a/src/test/ui/in-band-lifetimes/mismatched_trait_impl.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![allow(warnings)] -#![feature(in_band_lifetimes)] - -trait Get { - fn foo(&self, x: &'a u32, y: &u32) -> &'a u32; -} - -impl Get for i32 { - fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR `impl` item signature doesn't match - x //~ ERROR lifetime mismatch - } -} - -fn main() {} diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait_impl.stderr deleted file mode 100644 index 84e5339122e..00000000000 --- a/src/test/ui/in-band-lifetimes/mismatched_trait_impl.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error: `impl` item signature doesn't match `trait` item signature - --> $DIR/mismatched_trait_impl.rs:9:5 - | -LL | fn foo(&self, x: &'a u32, y: &u32) -> &'a u32; - | ---------------------------------------------- expected `fn(&'1 i32, &'a u32, &'2 u32) -> &'a u32` -... -LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 i32, &'2 u32, &'3 u32) -> &'3 u32` - | - = note: expected `fn(&'1 i32, &'a u32, &'2 u32) -> &'a u32` - found `fn(&'1 i32, &'2 u32, &'3 u32) -> &'3 u32` - = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` - = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output - -error[E0623]: lifetime mismatch - --> $DIR/mismatched_trait_impl.rs:10:9 - | -LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { - | ---- ------- - | | - | this parameter and the return type are declared with different lifetimes... -LL | x - | ^ ...but data from `x` is returned here - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/in-band-lifetimes/mut_while_borrow.rs b/src/test/ui/in-band-lifetimes/mut_while_borrow.rs deleted file mode 100644 index 97e8ed0d281..00000000000 --- a/src/test/ui/in-band-lifetimes/mut_while_borrow.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![allow(warnings)] -#![feature(in_band_lifetimes)] - -fn foo(x: &'a u32) -> &'a u32 { x } - -fn main() { - let mut p = 3; - let r = foo(&p); - p += 1; //~ ERROR cannot assign to `p` because it is borrowed - println!("{}", r); -} diff --git a/src/test/ui/in-band-lifetimes/mut_while_borrow.stderr b/src/test/ui/in-band-lifetimes/mut_while_borrow.stderr deleted file mode 100644 index f96ff9dd4e6..00000000000 --- a/src/test/ui/in-band-lifetimes/mut_while_borrow.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0506]: cannot assign to `p` because it is borrowed - --> $DIR/mut_while_borrow.rs:9:5 - | -LL | let r = foo(&p); - | -- borrow of `p` occurs here -LL | p += 1; - | ^^^^^^ assignment to borrowed `p` occurs here -LL | println!("{}", r); - | - borrow later used here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0506`. diff --git a/src/test/ui/in-band-lifetimes/nested-items.rs b/src/test/ui/in-band-lifetimes/nested-items.rs deleted file mode 100644 index 7de20712fba..00000000000 --- a/src/test/ui/in-band-lifetimes/nested-items.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Test that the `'a` from the impl doesn't -// prevent us from creating a `'a` parameter -// on the `blah` function. -// -// check-pass - -#![feature(in_band_lifetimes)] - -struct Foo<'a> { - x: &'a u32 - -} - -impl Foo<'a> { - fn method(&self) { - fn blah(f: Foo<'a>) { } - } -} - -fn main() { } diff --git a/src/test/ui/in-band-lifetimes/no_in_band_in_struct.rs b/src/test/ui/in-band-lifetimes/no_in_band_in_struct.rs deleted file mode 100644 index 9b0c0cda772..00000000000 --- a/src/test/ui/in-band-lifetimes/no_in_band_in_struct.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![allow(warnings)] -#![feature(in_band_lifetimes)] - -struct Foo { - x: &'test u32, //~ ERROR undeclared lifetime -} - -enum Bar { - Baz(&'test u32), //~ ERROR undeclared lifetime -} - -fn main() {} diff --git a/src/test/ui/in-band-lifetimes/no_in_band_in_struct.stderr b/src/test/ui/in-band-lifetimes/no_in_band_in_struct.stderr deleted file mode 100644 index fe656f7af7e..00000000000 --- a/src/test/ui/in-band-lifetimes/no_in_band_in_struct.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0261]: use of undeclared lifetime name `'test` - --> $DIR/no_in_band_in_struct.rs:5:9 - | -LL | struct Foo { - | - help: consider introducing lifetime `'test` here: `<'test>` -LL | x: &'test u32, - | ^^^^^ undeclared lifetime - -error[E0261]: use of undeclared lifetime name `'test` - --> $DIR/no_in_band_in_struct.rs:9:10 - | -LL | enum Bar { - | - help: consider introducing lifetime `'test` here: `<'test>` -LL | Baz(&'test u32), - | ^^^^^ undeclared lifetime - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0261`. diff --git a/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.rs b/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.rs deleted file mode 100644 index c1c40afdbab..00000000000 --- a/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![allow(warnings)] -#![feature(in_band_lifetimes)] - -fn foo(x: &u32) { - let y: &'test u32 = x; //~ ERROR use of undeclared lifetime -} - -fn foo2(x: &u32) {} -fn bar() { - let y: fn(&'test u32) = foo2; //~ ERROR use of undeclared lifetime -} - -fn main() {} diff --git a/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr b/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr deleted file mode 100644 index 5f0de61e69d..00000000000 --- a/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0261]: use of undeclared lifetime name `'test` - --> $DIR/no_introducing_in_band_in_locals.rs:5:13 - | -LL | fn foo(x: &u32) { - | - help: consider introducing lifetime `'test` here: `<'test>` -LL | let y: &'test u32 = x; - | ^^^^^ undeclared lifetime - -error[E0261]: use of undeclared lifetime name `'test` - --> $DIR/no_introducing_in_band_in_locals.rs:10:16 - | -LL | let y: fn(&'test u32) = foo2; - | ^^^^^ undeclared lifetime - | - = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html -help: consider introducing lifetime `'test` here - | -LL | fn bar<'test>() { - | +++++++ -help: consider making the type lifetime-generic with a new `'test` lifetime - | -LL | let y: for<'test> fn(&'test u32) = foo2; - | ++++++++++ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0261`. diff --git a/src/test/ui/in-band-lifetimes/missing-lifetime-in-alias.rs b/src/test/ui/lifetimes/missing-lifetime-in-alias.rs index 800f03302ed..af7b6412780 100644 --- a/src/test/ui/in-band-lifetimes/missing-lifetime-in-alias.rs +++ b/src/test/ui/lifetimes/missing-lifetime-in-alias.rs @@ -1,5 +1,4 @@ #![feature(generic_associated_types)] -#![allow(unused)] trait Trait<'a> { type Foo; diff --git a/src/test/ui/in-band-lifetimes/missing-lifetime-in-alias.stderr b/src/test/ui/lifetimes/missing-lifetime-in-alias.stderr index f1b951fc826..b16b792aefe 100644 --- a/src/test/ui/in-band-lifetimes/missing-lifetime-in-alias.stderr +++ b/src/test/ui/lifetimes/missing-lifetime-in-alias.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/missing-lifetime-in-alias.rs:23:24 + --> $DIR/missing-lifetime-in-alias.rs:22:24 | LL | type B<'a> = <A<'a> as Trait>::Foo; | ^^^^^ expected named lifetime parameter @@ -10,25 +10,25 @@ LL | type B<'a> = <A<'a> as Trait<'a>>::Foo; | ~~~~~~~~~ error[E0106]: missing lifetime specifier - --> $DIR/missing-lifetime-in-alias.rs:27:28 + --> $DIR/missing-lifetime-in-alias.rs:26:28 | LL | type C<'a, 'b> = <A<'a> as Trait>::Bar; | ^^^^^ expected named lifetime parameter | note: these named lifetimes are available to use - --> $DIR/missing-lifetime-in-alias.rs:27:8 + --> $DIR/missing-lifetime-in-alias.rs:26:8 | LL | type C<'a, 'b> = <A<'a> as Trait>::Bar; | ^^ ^^ error[E0107]: missing generics for associated type `Trait::Bar` - --> $DIR/missing-lifetime-in-alias.rs:27:36 + --> $DIR/missing-lifetime-in-alias.rs:26:36 | LL | type C<'a, 'b> = <A<'a> as Trait>::Bar; | ^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'b` - --> $DIR/missing-lifetime-in-alias.rs:7:10 + --> $DIR/missing-lifetime-in-alias.rs:6:10 | LL | type Bar<'b> | ^^^ -- diff --git a/src/test/ui/lifetimes/nested.rs b/src/test/ui/lifetimes/nested.rs new file mode 100644 index 00000000000..f3f1f2016f2 --- /dev/null +++ b/src/test/ui/lifetimes/nested.rs @@ -0,0 +1,7 @@ +// check-pass + +fn method<'a>(_i: &'a i32) { + fn inner<'a>(_j: &'a f32) {} +} + +fn main() {} diff --git a/src/test/ui/in-band-lifetimes/shadow.rs b/src/test/ui/lifetimes/shadow.rs index 27b5d57488c..e2124887e0f 100644 --- a/src/test/ui/in-band-lifetimes/shadow.rs +++ b/src/test/ui/lifetimes/shadow.rs @@ -1,9 +1,6 @@ -#![allow(warnings)] -#![feature(in_band_lifetimes)] - struct Foo<T>(T); -impl Foo<&'s u8> { +impl<'s> Foo<&'s u8> { fn bar<'s>(&self, x: &'s u8) {} //~ ERROR shadows a lifetime name fn baz(x: for<'s> fn(&'s u32)) {} //~ ERROR shadows a lifetime name } diff --git a/src/test/ui/in-band-lifetimes/shadow.stderr b/src/test/ui/lifetimes/shadow.stderr index c7a6f3ac3ad..b834e90d8d0 100644 --- a/src/test/ui/in-band-lifetimes/shadow.stderr +++ b/src/test/ui/lifetimes/shadow.stderr @@ -1,16 +1,16 @@ error[E0496]: lifetime name `'s` shadows a lifetime name that is already in scope - --> $DIR/shadow.rs:7:12 + --> $DIR/shadow.rs:4:12 | -LL | impl Foo<&'s u8> { - | -- first declared here +LL | impl<'s> Foo<&'s u8> { + | -- first declared here LL | fn bar<'s>(&self, x: &'s u8) {} | ^^ lifetime `'s` already in scope error[E0496]: lifetime name `'s` shadows a lifetime name that is already in scope - --> $DIR/shadow.rs:8:19 + --> $DIR/shadow.rs:5:19 | -LL | impl Foo<&'s u8> { - | -- first declared here +LL | impl<'s> Foo<&'s u8> { + | -- first declared here LL | fn bar<'s>(&self, x: &'s u8) {} LL | fn baz(x: for<'s> fn(&'s u32)) {} | ^^ lifetime `'s` already in scope diff --git a/src/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.stderr b/src/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.stderr index a2086895234..cb459f31cd2 100644 --- a/src/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.stderr +++ b/src/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.stderr @@ -5,8 +5,6 @@ LL | struct Test { | - help: consider introducing lifetime `'b` here: `<'b>` LL | a: &'b str, | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0261]: use of undeclared lifetime name `'b` --> $DIR/undeclared-lifetime-used-in-debug-macro-issue-70152.rs:3:9 @@ -15,8 +13,6 @@ LL | struct Test { | - help: consider introducing lifetime `'b` here: `<'b>` LL | a: &'b str, | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0261]: use of undeclared lifetime name `'b` --> $DIR/undeclared-lifetime-used-in-debug-macro-issue-70152.rs:13:13 @@ -24,7 +20,6 @@ error[E0261]: use of undeclared lifetime name `'b` LL | fn foo(&'b self) {} | ^^ undeclared lifetime | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes help: consider introducing lifetime `'b` here | LL | impl<'b> T for Test { diff --git a/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr b/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr index 93c0384fcc2..c9f235c4f7d 100644 --- a/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr +++ b/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr @@ -5,8 +5,6 @@ LL | fn main() { | - help: consider introducing lifetime `'a` here: `<'a>` LL | 0.clone::<'a>(); | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error: aborting due to previous error diff --git a/src/test/ui/nll/issue-52742.nll.stderr b/src/test/ui/nll/issue-52742.nll.stderr index e8b7b3333eb..0f6d6cd4fa1 100644 --- a/src/test/ui/nll/issue-52742.nll.stderr +++ b/src/test/ui/nll/issue-52742.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/issue-52742.rs:14:9 + --> $DIR/issue-52742.rs:12:9 | LL | fn take_bar(&mut self, b: Bar<'_>) { | --------- -- let's call this `'1` diff --git a/src/test/ui/nll/issue-52742.rs b/src/test/ui/nll/issue-52742.rs index db9ddfff285..d3e201b8ae8 100644 --- a/src/test/ui/nll/issue-52742.rs +++ b/src/test/ui/nll/issue-52742.rs @@ -1,5 +1,3 @@ -#![feature(in_band_lifetimes)] - struct Foo<'a, 'b> { x: &'a u32, y: &'b u32, diff --git a/src/test/ui/nll/issue-52742.stderr b/src/test/ui/nll/issue-52742.stderr index 3f8481219a9..67bac14b6e4 100644 --- a/src/test/ui/nll/issue-52742.stderr +++ b/src/test/ui/nll/issue-52742.stderr @@ -1,16 +1,16 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/issue-52742.rs:14:18 + --> $DIR/issue-52742.rs:12:18 | LL | self.y = b.z | ^^^ | note: ...the reference is valid for the lifetime `'_` as defined here... - --> $DIR/issue-52742.rs:12:10 + --> $DIR/issue-52742.rs:10:10 | LL | impl Foo<'_, '_> { | ^^ note: ...but the borrowed content is only valid for the anonymous lifetime defined here - --> $DIR/issue-52742.rs:13:31 + --> $DIR/issue-52742.rs:11:31 | LL | fn take_bar(&mut self, b: Bar<'_>) { | ^^^^^^^ diff --git a/src/test/ui/regions/regions-in-enums.stderr b/src/test/ui/regions/regions-in-enums.stderr index d56c1fbd119..66537653291 100644 --- a/src/test/ui/regions/regions-in-enums.stderr +++ b/src/test/ui/regions/regions-in-enums.stderr @@ -5,8 +5,6 @@ LL | enum No0 { | - help: consider introducing lifetime `'foo` here: `<'foo>` LL | X5(&'foo usize) | ^^^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-in-enums.rs:17:9 @@ -15,8 +13,6 @@ LL | enum No1 { | - help: consider introducing lifetime `'a` here: `<'a>` LL | X6(&'a usize) | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/regions-in-structs.stderr b/src/test/ui/regions/regions-in-structs.stderr index 2750149d097..5dfdc2ee93b 100644 --- a/src/test/ui/regions/regions-in-structs.stderr +++ b/src/test/ui/regions/regions-in-structs.stderr @@ -5,8 +5,6 @@ LL | struct StructDecl { | - help: consider introducing lifetime `'a` here: `<'a>` LL | a: &'a isize, | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-in-structs.rs:11:9 @@ -16,8 +14,6 @@ LL | struct StructDecl { LL | a: &'a isize, LL | b: &'a isize, | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/regions-name-undeclared.stderr b/src/test/ui/regions/regions-name-undeclared.stderr index 250752c9b9e..4399263f716 100644 --- a/src/test/ui/regions/regions-name-undeclared.stderr +++ b/src/test/ui/regions/regions-name-undeclared.stderr @@ -5,8 +5,6 @@ LL | enum E { | - help: consider introducing lifetime `'a` here: `<'a>` LL | E1(&'a isize) | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-name-undeclared.rs:31:13 @@ -15,8 +13,6 @@ LL | struct S { | - help: consider introducing lifetime `'a` here: `<'a>` LL | f: &'a isize | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0261]: use of undeclared lifetime name `'b` --> $DIR/regions-name-undeclared.rs:16:24 @@ -24,7 +20,6 @@ error[E0261]: use of undeclared lifetime name `'b` LL | fn m4(&self, arg: &'b isize) { } | ^^ undeclared lifetime | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes help: consider introducing lifetime `'b` here | LL | impl<'b, 'a> Foo<'a> { @@ -40,7 +35,6 @@ error[E0261]: use of undeclared lifetime name `'b` LL | fn m5(&'b self) { } | ^^ undeclared lifetime | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes help: consider introducing lifetime `'b` here | LL | impl<'b, 'a> Foo<'a> { @@ -56,7 +50,6 @@ error[E0261]: use of undeclared lifetime name `'b` LL | fn m6(&self, arg: Foo<'b>) { } | ^^ undeclared lifetime | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes help: consider introducing lifetime `'b` here | LL | impl<'b, 'a> Foo<'a> { @@ -73,8 +66,6 @@ LL | type X = Option<&'a isize>; | - ^^ undeclared lifetime | | | help: consider introducing lifetime `'a` here: `<'a>` - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-name-undeclared.rs:33:14 @@ -83,8 +74,6 @@ LL | fn f(a: &'a isize) { } | - ^^ undeclared lifetime | | | help: consider introducing lifetime `'a` here: `<'a>` - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-name-undeclared.rs:41:17 @@ -93,8 +82,6 @@ LL | fn fn_types(a: &'a isize, | - ^^ undeclared lifetime | | | help: consider introducing lifetime `'a` here: `<'a>` - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0261]: use of undeclared lifetime name `'b` --> $DIR/regions-name-undeclared.rs:43:36 @@ -103,7 +90,6 @@ LL | ... &'b isize, | ^^ undeclared lifetime | = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes help: consider introducing lifetime `'b` here | LL | fn fn_types<'b>(a: &'a isize, @@ -120,7 +106,6 @@ LL | ... &'b isize)>, | ^^ undeclared lifetime | = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes help: consider introducing lifetime `'b` here | LL | fn fn_types<'b>(a: &'a isize, @@ -138,8 +123,6 @@ LL | fn fn_types(a: &'a isize, ... LL | c: &'a isize) | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-name-undeclared.rs:53:31 @@ -147,7 +130,6 @@ error[E0261]: use of undeclared lifetime name `'a` LL | async fn buggy(&self) -> &'a str { | ^^ undeclared lifetime | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes help: consider introducing lifetime `'a` here | LL | impl<'a> Bug { diff --git a/src/test/ui/regions/regions-undeclared.stderr b/src/test/ui/regions/regions-undeclared.stderr index f3cae184ccd..6bfde5524ac 100644 --- a/src/test/ui/regions/regions-undeclared.stderr +++ b/src/test/ui/regions/regions-undeclared.stderr @@ -11,8 +11,6 @@ LL | enum EnumDecl { | - help: consider introducing lifetime `'a` here: `<'a>` LL | Foo(&'a isize), | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-undeclared.rs:5:10 @@ -22,8 +20,6 @@ LL | enum EnumDecl { LL | Foo(&'a isize), LL | Bar(&'a isize), | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-undeclared.rs:8:15 @@ -32,8 +28,6 @@ LL | fn fnDecl(x: &'a isize, | - ^^ undeclared lifetime | | | help: consider introducing lifetime `'a` here: `<'a>` - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-undeclared.rs:9:15 @@ -42,8 +36,6 @@ LL | fn fnDecl(x: &'a isize, | - help: consider introducing lifetime `'a` here: `<'a>` LL | y: &'a isize) | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error: aborting due to 5 previous errors diff --git a/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.fixed b/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.fixed deleted file mode 100644 index 6bc07afccbf..00000000000 --- a/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.fixed +++ /dev/null @@ -1,18 +0,0 @@ -// run-rustfix - -#![feature(in_band_lifetimes)] -#![deny(single_use_lifetimes)] -#![allow(dead_code)] -#![allow(unused_variables)] - -// Test that we DO warn when lifetime name is used only -// once in a fn argument, even with in band lifetimes. - -fn a(x: &u32, y: &u32) { - //~^ ERROR `'a` only used once - //~| ERROR `'b` only used once - //~| HELP elide the single-use lifetime - //~| HELP elide the single-use lifetime -} - -fn main() { } diff --git a/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.rs b/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.rs deleted file mode 100644 index 22c6a5a9d38..00000000000 --- a/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.rs +++ /dev/null @@ -1,18 +0,0 @@ -// run-rustfix - -#![feature(in_band_lifetimes)] -#![deny(single_use_lifetimes)] -#![allow(dead_code)] -#![allow(unused_variables)] - -// Test that we DO warn when lifetime name is used only -// once in a fn argument, even with in band lifetimes. - -fn a(x: &'a u32, y: &'b u32) { - //~^ ERROR `'a` only used once - //~| ERROR `'b` only used once - //~| HELP elide the single-use lifetime - //~| HELP elide the single-use lifetime -} - -fn main() { } diff --git a/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.stderr b/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.stderr deleted file mode 100644 index b251e8a438a..00000000000 --- a/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: lifetime parameter `'a` only used once - --> $DIR/one-use-in-fn-argument-in-band.rs:11:10 - | -LL | fn a(x: &'a u32, y: &'b u32) { - | ^^- - | | - | this lifetime is only used here - | help: elide the single-use lifetime - | -note: the lint level is defined here - --> $DIR/one-use-in-fn-argument-in-band.rs:4:9 - | -LL | #![deny(single_use_lifetimes)] - | ^^^^^^^^^^^^^^^^^^^^ - -error: lifetime parameter `'b` only used once - --> $DIR/one-use-in-fn-argument-in-band.rs:11:22 - | -LL | fn a(x: &'a u32, y: &'b u32) { - | ^^- - | | - | this lifetime is only used here - | help: elide the single-use lifetime - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/where-clauses/where-lifetime-resolution.stderr b/src/test/ui/where-clauses/where-lifetime-resolution.stderr index a704fea2828..6c52664154b 100644 --- a/src/test/ui/where-clauses/where-lifetime-resolution.stderr +++ b/src/test/ui/where-clauses/where-lifetime-resolution.stderr @@ -6,8 +6,6 @@ LL | fn f() where LL | for<'a> dyn Trait1<'a>: Trait1<'a>, // OK LL | (dyn for<'a> Trait1<'a>): Trait1<'a>, | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0261]: use of undeclared lifetime name `'b` --> $DIR/where-lifetime-resolution.rs:8:52 @@ -17,8 +15,6 @@ LL | fn f() where ... LL | for<'a> dyn for<'b> Trait2<'a, 'b>: Trait2<'a, 'b>, | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error: aborting due to 2 previous errors |
