Suggest unused lifetime parameters
Open
Nobody has claimed this yet.
A-lifetimes
A-lints
C-feature-request
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
type Foo<'a> = ();
fn foo<'a>() -> Foo<'a> { () }
fn main() {
foo();
}
Current output
Success
Desired output
warning: lifetime parameter `'a` is never used
--> src/main.rs:1:10
|
1 | type Foo<'a> = ();
| ^^
|
= note: `#[warn(dead_code)]` on by default
warning: lifetime parameter `'a` is never used
--> src/main.rs:3:8
|
3 | fn foo<'a>() -> Foo<'a> { () }
| ^^
Rationale and extra context
No response
Other cases
No response
Anything else?
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by compiling the Rust snippet from the issue and compare the current output with the requested warnings for both unused lifetime parameters. Trace the compiler's unused-parameter diagnostics and related tests, then add coverage showing warnings for the type alias and function cases. Done means the example emits the expected warnings without changing valid lifetime behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100