Why does this:
macro_rules! a_macro {
($($a:tt)+) => ($($a)+);
}
fn main() {
let x:u32 = 1;
let y:u32 = a_macro!(-x);
}
fail to compile with
<anon>:2:23: 2:25 error: unexpected token: `an interpolated tt`
<anon>:2 ($($a:tt)+) => ($($a)+);
^~
playpen: application terminated with error code 101
The why is: it's not implemented yet. This is a known limitation (as of Rust 1.0). tt
arguments to macros are useful, but they must always be forwarded to macros when used.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With