diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/single-use-lifetime | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/single-use-lifetime')
26 files changed, 0 insertions, 591 deletions
diff --git a/src/test/ui/single-use-lifetime/derive-eq.rs b/src/test/ui/single-use-lifetime/derive-eq.rs deleted file mode 100644 index e5bdfc55d..000000000 --- a/src/test/ui/single-use-lifetime/derive-eq.rs +++ /dev/null @@ -1,11 +0,0 @@ -// check-pass - -#![deny(single_use_lifetimes)] - -#[derive(PartialEq, Eq)] -struct Foo<'a, T> { - /// a reference to the underlying secret data that will be derefed - pub data: &'a mut T, -} - -fn main() {} diff --git a/src/test/ui/single-use-lifetime/fn-types.rs b/src/test/ui/single-use-lifetime/fn-types.rs deleted file mode 100644 index 018535f64..000000000 --- a/src/test/ui/single-use-lifetime/fn-types.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![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. - -struct Foo { - a: for<'a> fn(&'a u32), //~ ERROR `'a` only used once - b: for<'a> fn(&'a u32, &'a u32), // OK, used twice. - c: for<'a> fn(&'a u32) -> &'a u32, // OK, used twice. - d: for<'a> fn() -> &'a u32, // OK, used only in return type. - //~^ ERROR return type references lifetime `'a`, which is not constrained by the fn input types -} - -fn main() { } diff --git a/src/test/ui/single-use-lifetime/fn-types.stderr b/src/test/ui/single-use-lifetime/fn-types.stderr deleted file mode 100644 index 55959def4..000000000 --- a/src/test/ui/single-use-lifetime/fn-types.stderr +++ /dev/null @@ -1,28 +0,0 @@ -error: lifetime parameter `'a` only used once - --> $DIR/fn-types.rs:9:10 - | -LL | a: for<'a> fn(&'a u32), - | ^^ -- ...is used only here - | | - | this lifetime... - | -note: the lint level is defined here - --> $DIR/fn-types.rs:1:9 - | -LL | #![deny(single_use_lifetimes)] - | ^^^^^^^^^^^^^^^^^^^^ -help: elide the single-use lifetime - | -LL - a: for<'a> fn(&'a u32), -LL + a: fn(&u32), - | - -error[E0581]: return type references lifetime `'a`, which is not constrained by the fn input types - --> $DIR/fn-types.rs:12:22 - | -LL | d: for<'a> fn() -> &'a u32, // OK, used only in return type. - | ^^^^^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0581`. diff --git a/src/test/ui/single-use-lifetime/one-use-in-fn-argument.rs b/src/test/ui/single-use-lifetime/one-use-in-fn-argument.rs deleted file mode 100644 index 7919ef820..000000000 --- a/src/test/ui/single-use-lifetime/one-use-in-fn-argument.rs +++ /dev/null @@ -1,33 +0,0 @@ -#![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. - -fn a<'a>(x: &'a u32) { //~ ERROR `'a` only used once - //~^ HELP elide the single-use lifetime -} - -struct Single<'a> { x: &'a u32 } -struct Double<'a, 'b> { f: &'a &'b u32 } - -fn center<'m>(_: Single<'m>) {} //~ ERROR `'m` only used once -//~^ HELP elide the single-use lifetime -fn left<'x, 'y>(foo: Double<'x, 'y>) -> &'x u32 { foo.f } //~ ERROR `'y` only used once -//~^ HELP elide the single-use lifetime -fn right<'x, 'y>(foo: Double<'x, 'y>) -> &'y u32 { foo.f } //~ ERROR `'x` only used once -//~^ HELP elide the single-use lifetime - -pub trait Tfv<'a> {} - -// Do NOT lint in an HRTB. -pub fn g<T: for<'a> Tfv<'a>>() {} - -// Do NOT lint for trait bounds. -pub fn h<'a, S>(_: S) -where - S: Tfv<'a>, -{} - -fn main() {} diff --git a/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr b/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr deleted file mode 100644 index 93f16f5ba..000000000 --- a/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr +++ /dev/null @@ -1,59 +0,0 @@ -error: lifetime parameter `'a` only used once - --> $DIR/one-use-in-fn-argument.rs:8:6 - | -LL | fn a<'a>(x: &'a u32) { - | ^^ -- ...is used only here - | | - | this lifetime... - | -note: the lint level is defined here - --> $DIR/one-use-in-fn-argument.rs:1:9 - | -LL | #![deny(single_use_lifetimes)] - | ^^^^^^^^^^^^^^^^^^^^ -help: elide the single-use lifetime - | -LL - fn a<'a>(x: &'a u32) { -LL + fn a(x: &u32) { - | - -error: lifetime parameter `'m` only used once - --> $DIR/one-use-in-fn-argument.rs:15:11 - | -LL | fn center<'m>(_: Single<'m>) {} - | ^^ -- ...is used only here - | | - | this lifetime... - | -help: elide the single-use lifetime - | -LL - fn center<'m>(_: Single<'m>) {} -LL + fn center(_: Single<'_>) {} - | - -error: lifetime parameter `'y` only used once - --> $DIR/one-use-in-fn-argument.rs:17:13 - | -LL | fn left<'x, 'y>(foo: Double<'x, 'y>) -> &'x u32 { foo.f } - | ^^ this lifetime... -- ...is used only here - | -help: elide the single-use lifetime - | -LL - fn left<'x, 'y>(foo: Double<'x, 'y>) -> &'x u32 { foo.f } -LL + fn left<'x>(foo: Double<'x, '_>) -> &'x u32 { foo.f } - | - -error: lifetime parameter `'x` only used once - --> $DIR/one-use-in-fn-argument.rs:19:10 - | -LL | fn right<'x, 'y>(foo: Double<'x, 'y>) -> &'y u32 { foo.f } - | ^^ this lifetime... -- ...is used only here - | -help: elide the single-use lifetime - | -LL - fn right<'x, 'y>(foo: Double<'x, 'y>) -> &'y u32 { foo.f } -LL + fn right<'y>(foo: Double<'_, 'y>) -> &'y u32 { foo.f } - | - -error: aborting due to 4 previous errors - diff --git a/src/test/ui/single-use-lifetime/one-use-in-fn-return.rs b/src/test/ui/single-use-lifetime/one-use-in-fn-return.rs deleted file mode 100644 index 1ade01eed..000000000 --- a/src/test/ui/single-use-lifetime/one-use-in-fn-return.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Test that we DO NOT warn when lifetime name is used only -// once in a fn return type -- using `'_` is not legal there, -// as it must refer back to an argument. -// -// (Normally, using `'static` would be preferred, but there are -// times when that is not what you want.) - -// check-pass - -#![deny(single_use_lifetimes)] - -// OK: used only in return type -fn b<'a>() -> &'a u32 { - &22 -} - -pub trait Tfv<'a> {} -impl Tfv<'_> for () {} - -// Do NOT lint if used in return type. -pub fn i<'a>() -> impl Tfv<'a> {} - -fn main() {} diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.rs b/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.rs deleted file mode 100644 index 64f1c9118..000000000 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.rs +++ /dev/null @@ -1,22 +0,0 @@ -#![deny(single_use_lifetimes)] -#![allow(dead_code)] -#![allow(unused_variables)] - -// Test that we DO warn for a lifetime used only once in an impl, and that we -// don't warn for the anonymous lifetime. - -struct Foo<'f> { - data: &'f u32 -} - -impl<'f> Foo<'f> { //~ ERROR `'f` only used once - fn inherent_a(&self) { - } -} - -impl Foo<'_> { - fn inherent_b(&self) {} -} - - -fn main() { } diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr b/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr deleted file mode 100644 index 94129560f..000000000 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error: lifetime parameter `'f` only used once - --> $DIR/one-use-in-inherent-impl-header.rs:12:6 - | -LL | impl<'f> Foo<'f> { - | ^^ -- ...is used only here - | | - | this lifetime... - | -note: the lint level is defined here - --> $DIR/one-use-in-inherent-impl-header.rs:1:9 - | -LL | #![deny(single_use_lifetimes)] - | ^^^^^^^^^^^^^^^^^^^^ -help: elide the single-use lifetime - | -LL - impl<'f> Foo<'f> { -LL + impl Foo<'_> { - | - -error: aborting due to previous error - diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.rs b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.rs deleted file mode 100644 index eecd715ef..000000000 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.rs +++ /dev/null @@ -1,18 +0,0 @@ -#![deny(single_use_lifetimes)] -#![allow(dead_code)] -#![allow(unused_variables)] - -// Test that we DO warn for a lifetime used only once in an inherent method. - -struct Foo<'f> { - data: &'f u32 -} - -impl<'f> Foo<'f> { //~ ERROR `'f` only used once - //~^ HELP elide the single-use lifetime - fn inherent_a<'a>(&self, data: &'a u32) { //~ ERROR `'a` only used once - //~^ HELP elide the single-use lifetime - } -} - -fn main() { } diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr deleted file mode 100644 index 39507785b..000000000 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error: lifetime parameter `'f` only used once - --> $DIR/one-use-in-inherent-method-argument.rs:11:6 - | -LL | impl<'f> Foo<'f> { - | ^^ -- ...is used only here - | | - | this lifetime... - | -note: the lint level is defined here - --> $DIR/one-use-in-inherent-method-argument.rs:1:9 - | -LL | #![deny(single_use_lifetimes)] - | ^^^^^^^^^^^^^^^^^^^^ -help: elide the single-use lifetime - | -LL - impl<'f> Foo<'f> { -LL + impl Foo<'_> { - | - -error: lifetime parameter `'a` only used once - --> $DIR/one-use-in-inherent-method-argument.rs:13:19 - | -LL | fn inherent_a<'a>(&self, data: &'a u32) { - | ^^ -- ...is used only here - | | - | this lifetime... - | -help: elide the single-use lifetime - | -LL - fn inherent_a<'a>(&self, data: &'a u32) { -LL + fn inherent_a(&self, data: &u32) { - | - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.rs b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.rs deleted file mode 100644 index c5938f4a1..000000000 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.rs +++ /dev/null @@ -1,18 +0,0 @@ -#![deny(single_use_lifetimes)] -#![allow(dead_code)] -#![allow(unused_variables)] - -// Test that we DO NOT warn for a lifetime used just once in a return type, -// where that return type is in an inherent method. - -struct Foo<'f> { - data: &'f u32 -} - -impl<'f> Foo<'f> { //~ ERROR `'f` only used once - fn inherent_a<'a>(&self) -> &'a u32 { // OK for 'a - &22 - } -} - -fn main() { } diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr deleted file mode 100644 index 69578fe2f..000000000 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error: lifetime parameter `'f` only used once - --> $DIR/one-use-in-inherent-method-return.rs:12:6 - | -LL | impl<'f> Foo<'f> { - | ^^ -- ...is used only here - | | - | this lifetime... - | -note: the lint level is defined here - --> $DIR/one-use-in-inherent-method-return.rs:1:9 - | -LL | #![deny(single_use_lifetimes)] - | ^^^^^^^^^^^^^^^^^^^^ -help: elide the single-use lifetime - | -LL - impl<'f> Foo<'f> { -LL + impl Foo<'_> { - | - -error: aborting due to previous error - diff --git a/src/test/ui/single-use-lifetime/one-use-in-struct.rs b/src/test/ui/single-use-lifetime/one-use-in-struct.rs deleted file mode 100644 index 9cad942e7..000000000 --- a/src/test/ui/single-use-lifetime/one-use-in-struct.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Test that we do not warn for named lifetimes in structs, -// even when they are only used once (since to not use a named -// lifetime is illegal!) -// -// check-pass - -// Use forbid to verify that `automatically_derived` is handled correctly. -#![forbid(single_use_lifetimes)] -#![allow(dead_code)] -#![allow(unused_variables)] - -struct Foo<'f> { - data: &'f u32, -} - -enum Bar<'f> { - Data(&'f u32), -} - -trait Baz<'f> {} - -// `Derive`d impls shouldn't trigger a warning, either (Issue #53738). -#[derive(Debug)] -struct Quux<'a> { - priors: &'a u32, -} - -fn main() {} diff --git a/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.rs b/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.rs deleted file mode 100644 index 1848fc91c..000000000 --- a/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Test that we DO warn for a lifetime on an impl used only in `&self` -// in a trait method. - -#![deny(single_use_lifetimes)] -#![allow(dead_code)] -#![allow(unused_variables)] - -struct Foo<'f> { - data: &'f u32 -} - -impl<'f> Iterator for Foo<'f> { - type Item = &'f u32; - - fn next<'g>(&'g mut self) -> Option<Self::Item> { //~ ERROR `'g` only used once - //~^ HELP elide the single-use lifetime - None - } -} - -trait Bar<'a> { - // But we should not warn here. - fn bar(x: Foo<'a>); -} - -fn main() {} diff --git a/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr b/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr deleted file mode 100644 index 1a6e8310d..000000000 --- a/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error: lifetime parameter `'g` only used once - --> $DIR/one-use-in-trait-method-argument.rs:15:13 - | -LL | fn next<'g>(&'g mut self) -> Option<Self::Item> { - | ^^ -- ...is used only here - | | - | this lifetime... - | -note: the lint level is defined here - --> $DIR/one-use-in-trait-method-argument.rs:4:9 - | -LL | #![deny(single_use_lifetimes)] - | ^^^^^^^^^^^^^^^^^^^^ -help: elide the single-use lifetime - | -LL - fn next<'g>(&'g mut self) -> Option<Self::Item> { -LL + fn next(&mut self) -> Option<Self::Item> { - | - -error: aborting due to previous error - diff --git a/src/test/ui/single-use-lifetime/two-uses-in-fn-argument-and-return.rs b/src/test/ui/single-use-lifetime/two-uses-in-fn-argument-and-return.rs deleted file mode 100644 index f80f3f63c..000000000 --- a/src/test/ui/single-use-lifetime/two-uses-in-fn-argument-and-return.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Test that we DO NOT warn when lifetime name is used in -// both the argument and return. -// -// check-pass - -#![deny(single_use_lifetimes)] -#![allow(dead_code)] -#![allow(unused_variables)] - -// OK: used twice -fn c<'a>(x: &'a u32) -> &'a u32 { - &22 -} - -fn main() {} diff --git a/src/test/ui/single-use-lifetime/two-uses-in-fn-arguments.rs b/src/test/ui/single-use-lifetime/two-uses-in-fn-arguments.rs deleted file mode 100644 index 51724ebf8..000000000 --- a/src/test/ui/single-use-lifetime/two-uses-in-fn-arguments.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Test that we DO NOT warn when lifetime name is used multiple -// arguments, or more than once in a single argument. -// -// check-pass - -#![deny(single_use_lifetimes)] -#![allow(dead_code)] -#![allow(unused_variables)] - -// OK: used twice -fn c<'a>(x: &'a u32, y: &'a u32) {} - -// OK: used twice -fn d<'a>(x: (&'a u32, &'a u32)) {} - -fn main() {} diff --git a/src/test/ui/single-use-lifetime/two-uses-in-inherent-impl-header.rs b/src/test/ui/single-use-lifetime/two-uses-in-inherent-impl-header.rs deleted file mode 100644 index 125a395db..000000000 --- a/src/test/ui/single-use-lifetime/two-uses-in-inherent-impl-header.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Test that we DO NOT warn for a lifetime used twice in an impl. -// -// check-pass - -#![deny(single_use_lifetimes)] -#![allow(dead_code)] -#![allow(unused_variables)] - -struct Foo<'f> { - data: &'f u32, -} - -impl<'f> Foo<'f> { - fn inherent_a(&self, data: &'f u32) {} -} - -fn main() {} diff --git a/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.rs b/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.rs deleted file mode 100644 index 06ab6cdbf..000000000 --- a/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Test that we DO NOT warn for a lifetime used twice in an impl method and -// header. - -#![deny(single_use_lifetimes)] -#![allow(dead_code)] -#![allow(unused_variables)] - -struct Foo<'f> { - data: &'f u32 -} - -impl<'f> Foo<'f> { //~ ERROR `'f` only used once - fn inherent_a<'a>(&self, data: &'a u32) -> &'a u32{ - data - } -} - -fn main() { } diff --git a/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr b/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr deleted file mode 100644 index 4794566ea..000000000 --- a/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error: lifetime parameter `'f` only used once - --> $DIR/two-uses-in-inherent-method-argument-and-return.rs:12:6 - | -LL | impl<'f> Foo<'f> { - | ^^ -- ...is used only here - | | - | this lifetime... - | -note: the lint level is defined here - --> $DIR/two-uses-in-inherent-method-argument-and-return.rs:4:9 - | -LL | #![deny(single_use_lifetimes)] - | ^^^^^^^^^^^^^^^^^^^^ -help: elide the single-use lifetime - | -LL - impl<'f> Foo<'f> { -LL + impl Foo<'_> { - | - -error: aborting due to previous error - diff --git a/src/test/ui/single-use-lifetime/two-uses-in-trait-impl.rs b/src/test/ui/single-use-lifetime/two-uses-in-trait-impl.rs deleted file mode 100644 index 16431a39f..000000000 --- a/src/test/ui/single-use-lifetime/two-uses-in-trait-impl.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Test that we DO NOT warn for a lifetime on an impl used in both -// header and in an associated type. -// -// check-pass - -#![deny(single_use_lifetimes)] -#![allow(dead_code)] -#![allow(unused_variables)] - -struct Foo<'f> { - data: &'f u32, -} - -impl<'f> Iterator for Foo<'f> { - type Item = &'f u32; - - fn next(&mut self) -> Option<Self::Item> { - None - } -} - -fn main() {} diff --git a/src/test/ui/single-use-lifetime/zero-uses-in-fn.fixed b/src/test/ui/single-use-lifetime/zero-uses-in-fn.fixed deleted file mode 100644 index 0f26a975a..000000000 --- a/src/test/ui/single-use-lifetime/zero-uses-in-fn.fixed +++ /dev/null @@ -1,24 +0,0 @@ -// run-rustfix - -// Test that we DO warn when lifetime name is not used at all. - -#![deny(unused_lifetimes)] -#![allow(dead_code, unused_variables)] - -fn september() {} -//~^ ERROR lifetime parameter `'a` never used -//~| HELP elide the unused lifetime - -fn october<'b, T>(s: &'b T) -> &'b T { - //~^ ERROR lifetime parameter `'a` never used - //~| HELP elide the unused lifetime - s -} - -fn november<'a>(s: &'a str) -> &'a str { - //~^ ERROR lifetime parameter `'b` never used - //~| HELP elide the unused lifetime - s -} - -fn main() {} diff --git a/src/test/ui/single-use-lifetime/zero-uses-in-fn.rs b/src/test/ui/single-use-lifetime/zero-uses-in-fn.rs deleted file mode 100644 index 7f9504fe5..000000000 --- a/src/test/ui/single-use-lifetime/zero-uses-in-fn.rs +++ /dev/null @@ -1,24 +0,0 @@ -// run-rustfix - -// Test that we DO warn when lifetime name is not used at all. - -#![deny(unused_lifetimes)] -#![allow(dead_code, unused_variables)] - -fn september<'a>() {} -//~^ ERROR lifetime parameter `'a` never used -//~| HELP elide the unused lifetime - -fn october<'a, 'b, T>(s: &'b T) -> &'b T { - //~^ ERROR lifetime parameter `'a` never used - //~| HELP elide the unused lifetime - s -} - -fn november<'a, 'b>(s: &'a str) -> &'a str { - //~^ ERROR lifetime parameter `'b` never used - //~| HELP elide the unused lifetime - s -} - -fn main() {} diff --git a/src/test/ui/single-use-lifetime/zero-uses-in-fn.stderr b/src/test/ui/single-use-lifetime/zero-uses-in-fn.stderr deleted file mode 100644 index 59c0164e3..000000000 --- a/src/test/ui/single-use-lifetime/zero-uses-in-fn.stderr +++ /dev/null @@ -1,30 +0,0 @@ -error: lifetime parameter `'a` never used - --> $DIR/zero-uses-in-fn.rs:8:14 - | -LL | fn september<'a>() {} - | -^^- help: elide the unused lifetime - | -note: the lint level is defined here - --> $DIR/zero-uses-in-fn.rs:5:9 - | -LL | #![deny(unused_lifetimes)] - | ^^^^^^^^^^^^^^^^ - -error: lifetime parameter `'a` never used - --> $DIR/zero-uses-in-fn.rs:12:12 - | -LL | fn october<'a, 'b, T>(s: &'b T) -> &'b T { - | ^^-- - | | - | help: elide the unused lifetime - -error: lifetime parameter `'b` never used - --> $DIR/zero-uses-in-fn.rs:18:17 - | -LL | fn november<'a, 'b>(s: &'a str) -> &'a str { - | --^^ - | | - | help: elide the unused lifetime - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/single-use-lifetime/zero-uses-in-impl.rs b/src/test/ui/single-use-lifetime/zero-uses-in-impl.rs deleted file mode 100644 index 54803e1d2..000000000 --- a/src/test/ui/single-use-lifetime/zero-uses-in-impl.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Test that we DO warn when lifetime name is not used at all. - -#![deny(unused_lifetimes)] -#![allow(dead_code, unused_variables)] - -struct Foo {} - -impl<'a> Foo {} //~ ERROR `'a` never used - -fn main() {} diff --git a/src/test/ui/single-use-lifetime/zero-uses-in-impl.stderr b/src/test/ui/single-use-lifetime/zero-uses-in-impl.stderr deleted file mode 100644 index b6e42d3e7..000000000 --- a/src/test/ui/single-use-lifetime/zero-uses-in-impl.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: lifetime parameter `'a` never used - --> $DIR/zero-uses-in-impl.rs:8:6 - | -LL | impl<'a> Foo {} - | -^^- help: elide the unused lifetime - | -note: the lint level is defined here - --> $DIR/zero-uses-in-impl.rs:3:9 - | -LL | #![deny(unused_lifetimes)] - | ^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - |