Open
Description
The following snippet does not expand the macro foo!
correctly:
fn main() {}
macro_rules! foo {
($a:vis ($b:ident)) => {
pub const X: &str = stringify!($b);
};
}
foo!(
pub (bar)
);
Instead of expanding to
pub const X: &str = "bar"
it expands to
pub const X: &str = "$ b"
It seems that rust-analyzer
puts a space between the $
and the b
before substituting the macro variables, resulting in a wrong expansion. rustc
handles this expansion correctly.
rust-analyzer version: rust-analyzer version: 0.3.1641-standalone (144526c 2023-08-28) [I have also tried rust-analyzer version: 0.4.1644-standalone (3213344 2023-08-30)]
rustc version: rustc 1.74.0-nightly (84a9f4c6e 2023-08-29)