Skip to content

Incorrect macro coercion behavior #14429

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
Intege-rs opened this issue Mar 28, 2023 · 1 comment
Closed

Incorrect macro coercion behavior #14429

Intege-rs opened this issue Mar 28, 2023 · 1 comment
Labels
A-macro macro expansion C-bug Category: bug

Comments

@Intege-rs
Copy link

rust-analyzer version: rust-analyzer version: 0.3.1451-standalone (b99d5eb 2023-03-26)

rustc version: rustc 1.68.0-nightly (ad8ae0504 2022-12-29)

relevant settings:

Macro expansion handles coercion differently than rustc

originally discovered in Intellij-rust, same bug exists in Rust-Analyzer
intellij-rust/intellij-rust#10300

macro_rules! __ide_check_2 {
    (1) => { 0u32 /* IDE */};
    ($number:literal) => { "RustC" }
}

macro_rules! __ide_check_1 {
    ($number:literal) => {
        __ide_check_2!($number)
    }
}

macro_rules! ide_check {
    () => {__ide_check_1!(1)}
}

pub fn main() {
    let a = ide_check!();
    println!("{}", a);
}
@Intege-rs Intege-rs added the C-bug Category: bug label Mar 28, 2023
@Veykril Veykril added the A-macro macro expansion label Mar 29, 2023
@lowr
Copy link
Contributor

lowr commented Mar 29, 2023

Thanks for the report, this is a known issue that we don't know how to handle properly yet. Closing as a duplicate of #12603.

@lowr lowr closed this as not planned Won't fix, can't repro, duplicate, stale Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macro macro expansion C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

3 participants