You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fnmain(){//attempt to expand below macroprintln!("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]externcrate std;fnmain(){{{::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"],&[]));};};
The text was updated successfully, but these errors were encountered:
hasunwoo
changed the title
Rust analyzer expands wrong macro when running recursive expansion of macro.
Rust analyzer expands wrong macro when running recursive expansion.
Jun 11, 2022
rust-analyzer version: ad6810e 2022-06-06 stable
rustc version: rustc 1.62.0-nightly (a5ad0d29a 2022-05-12)
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'
recursive expansion of line 3 should look like below
The text was updated successfully, but these errors were encountered: