]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #9740 : alexcrichton/rust/concat, r=cmr
authorbors <bors@rust-lang.org>
Fri, 1 Nov 2013 00:51:26 +0000 (17:51 -0700)
committerbors <bors@rust-lang.org>
Fri, 1 Nov 2013 00:51:26 +0000 (17:51 -0700)
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.


Trivial merge