Skip to content

Wrong information when macros have the same name #13821

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
QDelta opened this issue Dec 22, 2022 · 0 comments · Fixed by #14781
Closed

Wrong information when macros have the same name #13821

QDelta opened this issue Dec 22, 2022 · 0 comments · Fixed by #14781
Labels
A-macro macro expansion A-nameres name, path and module resolution C-bug Category: bug S-actionable Someone could pick this issue up and work on it right now

Comments

@QDelta
Copy link

QDelta commented Dec 22, 2022

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.

@lnicola lnicola added A-macro macro expansion S-actionable Someone could pick this issue up and work on it right now A-nameres name, path and module resolution C-bug Category: bug labels Dec 22, 2022
@bors bors closed this as completed in 9b33874 May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macro macro expansion A-nameres name, path and module resolution C-bug Category: bug S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants