Implement a concat!() format extension
This extension can be used to concatenate string literals at compile time. C has this useful ability when placing string literals lexically next to one another, but this needs to be handled at the syntax extension level to recursively expand macros. The major use case for this is something like: macro_rules! mylog( ($fmt:expr $($arg:tt)*) => { error2!(concat!(file!(), ":", line!(), " - ", $fmt) $($arg)*); }) Where the mylog macro will automatically prepend the filename/line number to the beginning of every log message.
Showing
src/libsyntax/ext/concat.rs
0 → 100644
src/test/compile-fail/concat.rs
0 → 100644
src/test/run-pass/concat.rs
0 → 100644
想要评论请 注册 或 登录