about summary refs log tree commit diff
path: root/src/libsyntax/ext/concat.rs
AgeCommit message (Collapse)AuthorLines
2014-06-17Add a b'x' byte literal of type u8.Simon Sapin-0/+1
2014-05-24core: rename strbuf::StrBuf to string::StringRicho Healey-2/+2
[breaking-change]
2014-05-22libstd: Remove all uses of `~str` from `libstd`Patrick Walton-1/+1
2014-05-22libstd: Remove `~str` from all `libstd` modules except `fmt` and `str`.Patrick Walton-3/+3
2014-05-06librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, exceptPatrick Walton-1/+2
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box<Type>`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change]
2014-05-02syntax: store char literals/tokens as `char`s rather than u32s.Huon Wilson-2/+1
Clearly storing them as `char` is semantically nicer, but this also fixes a bug whereby `quote_expr!(cx, 'a')` wasn't working, because the code created by quotation was not matching the actual AST definitions.
2014-04-16syntax: unify all MacResult's into a single trait.Huon Wilson-3/+3
There's now one unified way to return things from a macro, instead of being able to choose the `AnyMacro` trait or the `MRItem`/`MRExpr` variants of the `MacResult` enum. This does simplify the logic handling the expansions, but the biggest value of this is it makes macros in (for example) type position easier to implement, as there's this single thing to modify. By my measurements (using `-Z time-passes` on libstd and librustc etc.), this appears to have little-to-no impact on expansion speed. There are presumably larger costs than the small number of extra allocations and virtual calls this adds (notably, all `macro_rules!`-defined macros have not changed in behaviour, since they had to use the `AnyMacro` trait anyway).
2014-04-10libstd: Implement `StrBuf`, a new string buffer type like `Vec`, andPatrick Walton-4/+7
port all code over to use it.
2014-03-02Expand string literals and exprs inside of macrosSteven Fackler-1/+0
A couple of syntax extensions manually expanded expressions, but it wasn't done universally, most noticably inside of asm!(). There's also a bit of random cleanup.
2014-02-18Avoid returning original macro if expansion fails.Douglas Young-1/+1
Closes #11692. Instead of returning the original expression, a dummy expression (with identical span) is returned. This prevents infinite loops of failed expansions as well as odd double error messages in certain situations.
2014-02-02libsyntax: Make float literals not use `@str`Patrick Walton-4/+3
2014-02-02libsyntax: De-`@str` literal strings in the ASTPatrick Walton-3/+6
2014-01-18syntax::ext: replace span_fatal with span_err in many places.Huon Wilson-1/+4
This means that compilation continues for longer, and so we can see more errors per compile. This is mildly more user-friendly because it stops users having to run rustc n times to see n macro errors: just run it once to see all of them.
2014-01-09libsyntax: Renamed types, traits and enum variants to CamelCase.Eduard Burtescu-11/+9
2013-12-29Start passing around &mut ExtCtxtSteven Fackler-1/+1
2013-12-28Stop using @ExtCtxtSteven Fackler-1/+1
2013-11-28Register new snapshotsAlex Crichton-1/+1
2013-10-31Implement a concat!() format extensionAlex Crichton-0/+58
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.