Skip to content

Macro import with same name as private module uses module syntax highlighting #19421

Open
@SyntaxHighlightingFiend

Description

Concrete case: When importing the ensure macro from anyhow, the syntax highlighting of the ensure token at the use declaration will be that of a module instead of a macro.

A module ensure does exist in anyhow, but it's private and cannot be imported, so this should be unambiguous.

rust-analyzer version: 0.3.2345-standalone (b0632f7 2025-03-16)

rustc version: rustc 1.85.0 (4d91de4e4 2025-02-17)

editor or extension: VSCode, extension version 0.3.2345

code snippet to reproduce:

use anyhow::ensure;

fn main() -> anyhow::Result<()> {
    ensure!(1 > 0, "oops");
    Ok(())
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-highlighting(semantic) token highlightingC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions