I have the following trivial procedural macro in one crate (it was more than this, but I distilled it to be as simple as possible while still causing the issue to occur)
#[proc_macro]
pub fn the_macro(input: TokenStream) -> TokenStream {
input
}
and the following test code in another crate:
use set_macro::the_macro;
fn main() {
let asdf = "zzz";
let qqq = "aaa";
println!("blah {}", the_macro!(asdf, qqq));
}
But running it gives me this:
error: macro expansion ignores token `,` and any following
--> src/main.rs:7:52
|
7 | println!("blah {}", the_macro!(asdf, qqq));
My understanding is that this can happen if for some reason the macro stops prior to processing a token, but in this case I'm literally just hot passing the input straight to the return value. Fwiw this works just fine if I only pass in one token, ie the_macro!(asdf)
I did try cargo expand
, and it appears that the output of the macro is indeed just 'asdf'.
What might be going on here?