Skip to content

Wrong information when macros have the same name #13821

Closed
@QDelta

Description

@QDelta

rust-analyzer version: 0.3.1325-standalone (9ed1829 2022-12-17)

rustc version: 1.66.0 (69f9c33d7 2022-12-12)

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTUP_HOME or CARGO_HOME)

A reproducible example:

Cargo.toml:

[package]
name = "example"
version = "0.1.0"
edition = "2021"

[dependencies]

lib.rs:

#[macro_export]
macro_rules! vec {
    () => { 1 };
}

main.rs:

use example::vec;

fn main() {
    println!("{}", vec!());
}

When editing main.rs, rust-analyzer seems to interpret vec! in println! as the vec! in the standard library (hover).

The same bug happens when using macros from another crate, like the column! in iced, but not when the macro is defined in the same file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macromacro expansionA-nameresname, path and module resolutionC-bugCategory: bugS-actionableSomeone could pick this issue up and work on it right now

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions