rust-lang / rust-lang/rust-analyzer

Rename should affect references in doc comments

Open
#18,703 4 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

/// See [`bar`].
fn foo() {}

/// I am bar.
fn bar() {}

Hovering the reference to bar in the doc comment shows its description, as expected.

When I rename bar (its definition after the fn keyword), the reference to it in foo's doc comment is not changed, so it refers to a non-existent item now.

Would it be possible for renaming to affect doc comments as well?

I am using rust-analyzer with the default nvim-lspconfig configuration. I'm on rust-analyzer 1.83.0 (90b35a6 2024-11-26).

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 reproducing the reported Rust snippet in rust-analyzer and confirm that renaming bar leaves [bar] unchanged in foo's doc comment. Then trace the rename handling for doc-comment references. Done means the rename updates that reference and preserves its link to the renamed item, with regression coverage added in the relevant test area.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.