diff options
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/ext/source_util.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 4 |
3 files changed, 6 insertions, 7 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index fd8e9dbfa67..dcac134329c 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -20,6 +20,7 @@ use parse::token; use std::cell::RefCell; use std::hashmap::HashMap; use std::option::Option; +use std::rc::Rc; use std::to_str::ToStr; use extra::serialize::{Encodable, Decodable, Encoder, Decoder}; @@ -724,7 +725,7 @@ pub type Lit = Spanned<Lit_>; #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] pub enum Lit_ { LitStr(InternedString, StrStyle), - LitBinary(@[u8]), + LitBinary(Rc<~[u8]>), LitChar(u32), LitInt(i64, IntTy), LitUint(u64, UintTy), diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index 44f3bb379f6..f3f947ec00d 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -22,6 +22,7 @@ use print::pprust; use std::io; use std::io::File; +use std::rc::Rc; use std::str; // These macros all relate to the file system; they either return @@ -135,8 +136,6 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) pub fn expand_include_bin(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> base::MacResult { - use std::at_vec; - let file = match get_single_str_from_tts(cx, sp, tts, "include_bin!") { Some(f) => f, None => return MacResult::dummy_expr() @@ -148,8 +147,7 @@ pub fn expand_include_bin(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) return MacResult::dummy_expr(); } Ok(bytes) => { - let bytes = at_vec::to_managed_move(bytes); - base::MRExpr(cx.expr_lit(sp, ast::LitBinary(bytes))) + base::MRExpr(cx.expr_lit(sp, ast::LitBinary(Rc::new(bytes)))) } } } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 2e20560b9ca..bdef5e093f2 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -2212,10 +2212,10 @@ pub fn print_literal(s: &mut State, lit: &ast::Lit) { ast::LitBool(val) => { if val { word(&mut s.s, "true"); } else { word(&mut s.s, "false"); } } - ast::LitBinary(arr) => { + ast::LitBinary(ref arr) => { ibox(s, indent_unit); word(&mut s.s, "["); - commasep_cmnt(s, Inconsistent, arr, |s, u| word(&mut s.s, format!("{}", *u)), + commasep_cmnt(s, Inconsistent, *arr.borrow(), |s, u| word(&mut s.s, format!("{}", *u)), |_| lit.span); word(&mut s.s, "]"); end(s); |
