diff options
| author | bors <bors@rust-lang.org> | 2014-06-18 02:06:37 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-06-18 02:06:37 +0000 |
| commit | d6736a1440d42f6af967a8a20ab8d73522112b72 (patch) | |
| tree | 2a92204127cf1512a60c81ecbb5700288d8f1b92 /src/libsyntax/ext | |
| parent | 5c81a186e9d835ca66865bd9807524b805a06d8d (diff) | |
| parent | 3744d828513092d1ed64c4c6f8cd2536f7a5ff0d (diff) | |
| download | rust-d6736a1440d42f6af967a8a20ab8d73522112b72.tar.gz rust-d6736a1440d42f6af967a8a20ab8d73522112b72.zip | |
auto merge of #14880 : SimonSapin/rust/byte-literals, r=alexcrichton
See #14646 (tracking issue) and rust-lang/rfcs#69. This does not close the tracking issue, as the `bytes!()` macro still needs to be removed. It will be later, after a snapshot is made with the changes in this PR, so that the new syntax can be used when bootstrapping the compiler.
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/concat.rs | 1 | ||||
| -rw-r--r-- | src/libsyntax/ext/quote.rs | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/libsyntax/ext/concat.rs b/src/libsyntax/ext/concat.rs index 83f45ca9f16..670e38327d6 100644 --- a/src/libsyntax/ext/concat.rs +++ b/src/libsyntax/ext/concat.rs @@ -47,6 +47,7 @@ pub fn expand_syntax_ext(cx: &mut base::ExtCtxt, ast::LitBool(b) => { accumulator.push_str(format!("{}", b).as_slice()); } + ast::LitByte(..) | ast::LitBinary(..) => { cx.span_err(e.span, "cannot concatenate a binary literal"); } diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 6514d8fa418..407715ab4da 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -436,6 +436,12 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> Gc<ast::Expr> { vec!(mk_binop(cx, sp, binop))); } + LIT_BYTE(i) => { + let e_byte = cx.expr_lit(sp, ast::LitByte(i)); + + return cx.expr_call(sp, mk_token_path(cx, sp, "LIT_BYTE"), vec!(e_byte)); + } + LIT_CHAR(i) => { let e_char = cx.expr_lit(sp, ast::LitChar(i)); |
