rust-lang / rust-lang/rust-analyzer

Feature request: lifetime range visualizations

Open
#12,640 1 comment 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-feature S-unactionable
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

Showing a lifetime's range in code would be great for lifetime related debugging and for education. A simple way to show this is that when mouse hovering a lifetime marker 'a or a variable, with a range of code highlighted.

I was trying to do something like this but I realized there's no way to get a lifetime info anywhere. I think it's now internal to rustc. I checked rust-analyzer, RLS, rls-analysis and none of them seems to be able to provide such info.

I asked in rust internals forum and they said it's not possible now, and I shall check back later when the stable MIR project is ready.

Before that, is it possible for rust-analyzer to implement the lifetime analysis (and/or borrow checking) so that we can start on our end?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the rust-analyzer issue context, the linked Rust Internals discussion, and the stable MIR project status to determine whether lifetime information is available. Done would require a concrete implementation path for exposing lifetime ranges or a documented conclusion that the prerequisite compiler information is unavailable.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, data-visualization, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.