rust-lang / rust-lang/rust-analyzer
Quick fix to declare an unresolved lifetime
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
With inband lifetimes going away (https://github.com/rust-lang/rust/issues/44524), I believe we should just fix the ergonomics at the ide layer.
Typing fn foo(&'a str) should emit an error for unresolved 'a, and a quick fix to declare a lifetime: fn foo<'a>(&'a str).
See how NoSuchField diagnostics is treated, which has a similar flow with a fix: https://github.com/rust-analyzer/rust-analyzer/search?q=NoSuchField.
@Veykril I believe you did name resolution for lifetimes, could you add a code link for where it is happening?
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 tracing the NoSuchField diagnostic flow in rust-analyzer and the lifetime name-resolution code requested in the issue. Confirm how an unresolved 'a reaches the diagnostic layer, then compare the quick-fix outcome with the stated fn foo<'a>(&'a str) form and add coverage alongside the existing diagnostic tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100