Can macros not extend interpolated token trees?

Why this :

macro_rules! a_macro { ($($a:tt)+) => ($($a)+); } fn main() { let x:u32 = 1; let y:u32 = a_macro!(-x); } 

cannot 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 
+5
source share
1 answer

Why: it has not yet been implemented. This is a known limitation (since Rust 1.0). tt arguments for macros are useful , but they should always be redirected to macros when used.

+5
source

All Articles