rust-lang / rust-lang/rust-analyzer
`ref` snippet shadowed by `ref` keyword in macro
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
rust-analyzer version: 0.3.2539-standalone
rustc version: rustc 1.90.0-nightly (a84ab0ce6 2025-07-06)
editor or extension: Vscode, Rust Analyzer
relevant settings: N/A
code snippet to reproduce:
use std::convert::identity;
fn main() {
let num = 42;
println!("{}", identity(num.re))
}
Rust Analyzer Suggestions:
After writing the whole keyword:
This issue is kind of difficult to reproduce, as everything works as expected in e.g. the dbg! macro, outside of a macro, or when removing the outer identity function. I am not sure exactly what triggers it, but this combination of a println! and the identity function is enough to trigger it.
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
Reproduce the snippet in rust-analyzer using VS Code, comparing the println! case with dbg!, code outside a macro, and the version without the outer identity function. Trace the completion behavior for ref in the macro context; done means the ref snippet is no longer incorrectly shadowed or suggested as the ref keyword.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100