Skip to content

ref snippet shadowed by ref keyword in macro #20263

@wmstack

Description

@wmstack

rust-analyzer version: 0.3.2539-standalone

rustc version: rustc 1.90.0-nightly (a84ab0c 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:

Image

After writing the whole keyword:

Image

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions