Closed
Description
rust-analyzer version: ad6810e 2022-06-06 stable
rustc version: rustc 1.62.0-nightly (a5ad0d29a 2022-05-12)
fn main() {
//attempt to expand below macro
println!("test");
}
mod text_io {
#[macro_export]
macro_rules! println {
($($arg:tt)*) => {{
std::println!("called test_macro in text_io.");
std::println!($($arg)*);
}}
}
}
Result when expanding macro recursively on line 3
It should expand macro exported by text_io module. but it expands println macro from standard library. I think rust analyzer confuse macro exported by text_io module with macro from standard library because they have same name.
output of command 'cargo expand'
#![feature(prelude_import)]
#[prelude_import]
use std::prelude::rust_2021::*;
#[macro_use]
extern crate std;
fn main() {
{
{
::std::io::_print(::core::fmt::Arguments::new_v1(
&["called test_macro in text_io.\n"],
&[],
));
};
{
::std::io::_print(::core::fmt::Arguments::new_v1(&["test\n"], &[]));
};
};
}
recursive expansion of line 3 should look like below
{
{
::std::io::_print(::core::fmt::Arguments::new_v1(
&["called test_macro in text_io.\n"],
&[],
));
};
{
::std::io::_print(::core::fmt::Arguments::new_v1(&["test\n"], &[]));
};
};