rust-lang / rust-lang/rust-analyzer
"Rename" for references in HRTB
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
It seems like rust-analyzer doesn't support renaming lifetimes within a higher-ranked trait bound.
Example code: (from https://doc.rust-lang.org/nomicon/hrtb.html)
struct Closure<F> {
data: (u8, u16),
func: F,
}
impl<F> Closure<F>
where
for<'a> F: Fn(&'a (u8, u16)) -> &'a u8,
{
fn call<'x>(&'x self) -> &'x u8 {
(self.func)(&self.data)
}
}
Going to 'x and pressing F2 in VSCode shows a renaming dialog. However, trying to rename 'a doesn't work (Request failed: No references found at position in the trace).
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 with the minimal higher-ranked trait bound example in the issue and reproduce the failed rename of 'a in VSCode. Trace rust-analyzer's rename and reference-resolution handling for lifetime parameters, then verify that renaming 'a updates all of its references without regressing the working 'x case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100