Add test to check unused_lifetimes don't duplicate "parameter is never used" error

This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-03-09 18:24:45 +00:00
parent b054da8155
commit ff1459a370
No known key found for this signature in database
GPG key ID: 95DDEBD74A1DC2C0
2 changed files with 20 additions and 0 deletions

View file

@ -0,0 +1,9 @@
// Check that `unused_lifetimes` lint doesn't duplicate a "parameter is never used" error.
// Fixed in <https://github.com/rust-lang/rust/pull/96833>.
// Issue: <https://github.com/rust-lang/rust/issues/72587>.
#![warn(unused_lifetimes)]
struct Foo<'a>;
//~^ ERROR parameter `'a` is never used
fn main() {}

View file

@ -0,0 +1,11 @@
error[E0392]: lifetime parameter `'a` is never used
--> $DIR/dedup.rs:6:12
|
LL | struct Foo<'a>;
| ^^ unused lifetime parameter
|
= help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0392`.