Closed
Description
The following code:
#![warn(unused_lifetimes)]
struct Foo<'a>;
fn main() {}
gives the following output:
arning: lifetime parameter `'a` never used
--> unused_lifetime.rs:2:12
|
2 | struct Foo<'a>;
| -^^- help: elide the unused lifetime
|
note: the lint level is defined here
--> unused_lifetime.rs:1:9
|
1 | #![warn(unused_lifetimes)]
| ^^^^^^^^^^^^^^^^
error[E0392]: parameter `'a` is never used
--> unused_lifetime.rs:2:12
|
2 | struct Foo<'a>;
| ^^ unused parameter
|
= help: consider removing `'a`, referring to it in a field, or using a marker such as `std::marker::PhantomData`
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0392`.
The "unused lifetimes" warning is redundant - not using a lifetime parameter is a hard error, so the warning gives no additional information.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Lifetimes / regionsArea: Lints (warnings about flaws in source code) such as unused_mut.Category: This is a bug.Diagnostics: Too much output caused by a single piece of incorrect code.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.Relevant to the compiler team, which will review and decide on the PR/issue.