Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tests/ui/single-use-lifetime/dedup.rs
Original file line number Diff line number Diff line change
@@ -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() {}
11 changes: 11 additions & 0 deletions tests/ui/single-use-lifetime/dedup.stderr
Original file line number Diff line number Diff line change
@@ -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`.
Loading