Closed
Description
macro_rules! passthru {
($($t:tt)*) => { format_args!("{}", $($t)*) }
}
fn main() {
passthru!({
macro_rules! foo {
($name:expr) => { concat!("hello ", $name) }
}
foo!("rust")
});
}
fails with a nonsense "unknown macro variable name
". It works if the macro has no captures or if it's defined outside. And you can normally define a macro in an expression.
Somehow related to the format_args!
expansion, but it doesn't occur without the intermediate passthru!
macro (which represents println!
, print!
, or format!
). And I can't see the expansion because it doesn't get that far.