about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-05-03 10:56:57 -0700
committerbors <bors@rust-lang.org>2014-05-03 10:56:57 -0700
commit0c691df8acaf10aa3721476e5d7fafcee11b0aaa (patch)
tree7aca9144c64039fea0aff444e13870b4be40fae7 /src/libsyntax
parentbca9647cd34c78a1c7c2409fbb2c31cb2c8194d7 (diff)
parenta5be12ce7e88c1d28de1c98215991127d1e765f0 (diff)
downloadrust-0c691df8acaf10aa3721476e5d7fafcee11b0aaa.tar.gz
rust-0c691df8acaf10aa3721476e5d7fafcee11b0aaa.zip
auto merge of #13773 : brson/rust/boxxy, r=alexcrichton
`box` is the way you allocate in future-rust.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/diagnostic.rs6
-rw-r--r--src/libsyntax/ext/base.rs12
-rw-r--r--src/libsyntax/ext/deriving/decodable.rs11
-rw-r--r--src/libsyntax/ext/deriving/encodable.rs12
-rw-r--r--src/libsyntax/ext/deriving/hash.rs4
-rw-r--r--src/libsyntax/ext/deriving/primitive.rs4
-rw-r--r--src/libsyntax/ext/deriving/rand.rs2
-rw-r--r--src/libsyntax/ext/deriving/show.rs2
-rw-r--r--src/libsyntax/ext/deriving/ty.rs2
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs10
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs8
-rw-r--r--src/libsyntax/parse/lexer.rs4
-rw-r--r--src/libsyntax/parse/mod.rs4
-rw-r--r--src/libsyntax/parse/parser.rs2
-rw-r--r--src/libsyntax/print/pprust.rs2
15 files changed, 43 insertions, 42 deletions
diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs
index 4d487689c67..f09072e0bc6 100644
--- a/src/libsyntax/diagnostic.rs
+++ b/src/libsyntax/diagnostic.rs
@@ -177,7 +177,7 @@ pub fn mk_span_handler(handler: Handler, cm: codemap::CodeMap) -> SpanHandler {
 }
 
 pub fn default_handler() -> Handler {
-    mk_handler(~EmitterWriter::stderr())
+    mk_handler(box EmitterWriter::stderr())
 }
 
 pub fn mk_handler(e: ~Emitter:Send) -> Handler {
@@ -262,11 +262,11 @@ impl EmitterWriter {
         if stderr.get_ref().isatty() {
             let dst = match term::Terminal::new(stderr.unwrap()) {
                 Ok(t) => Terminal(t),
-                Err(..) => Raw(~io::stderr()),
+                Err(..) => Raw(box io::stderr()),
             };
             EmitterWriter { dst: dst }
         } else {
-            EmitterWriter { dst: Raw(~stderr) }
+            EmitterWriter { dst: Raw(box stderr) }
         }
     }
 
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index 34c4f77bc43..cee6216b23f 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -131,7 +131,7 @@ pub struct MacExpr {
 }
 impl MacExpr {
     pub fn new(e: @ast::Expr) -> ~MacResult {
-        ~MacExpr { e: e } as ~MacResult
+        box MacExpr { e: e } as ~MacResult
     }
 }
 impl MacResult for MacExpr {
@@ -145,7 +145,7 @@ pub struct MacItem {
 }
 impl MacItem {
     pub fn new(i: @ast::Item) -> ~MacResult {
-        ~MacItem { i: i } as ~MacResult
+        box MacItem { i: i } as ~MacResult
     }
 }
 impl MacResult for MacItem {
@@ -174,7 +174,7 @@ impl DummyResult {
     /// Use this as a return value after hitting any errors and
     /// calling `span_err`.
     pub fn any(sp: Span) -> ~MacResult {
-        ~DummyResult { expr_only: false, span: sp } as ~MacResult
+        box DummyResult { expr_only: false, span: sp } as ~MacResult
     }
 
     /// Create a default MacResult that can only be an expression.
@@ -183,7 +183,7 @@ impl DummyResult {
     /// if an error is encountered internally, the user will recieve
     /// an error that they also used it in the wrong place.
     pub fn expr(sp: Span) -> ~MacResult {
-        ~DummyResult { expr_only: true, span: sp } as ~MacResult
+        box DummyResult { expr_only: true, span: sp } as ~MacResult
     }
 
     /// A plain dummy expression.
@@ -262,7 +262,7 @@ pub type RenameList = Vec<(ast::Ident, Name)>;
 pub fn syntax_expander_table() -> SyntaxEnv {
     // utility function to simplify creating NormalTT syntax extensions
     fn builtin_normal_expander(f: MacroExpanderFn) -> SyntaxExtension {
-        NormalTT(~BasicMacroExpander {
+        NormalTT(box BasicMacroExpander {
                 expander: f,
                 span: None,
             },
@@ -271,7 +271,7 @@ pub fn syntax_expander_table() -> SyntaxEnv {
 
     let mut syntax_expanders = SyntaxEnv::new();
     syntax_expanders.insert(intern("macro_rules"),
-                            IdentTT(~BasicIdentMacroExpander {
+                            IdentTT(box BasicIdentMacroExpander {
                                 expander: ext::tt::macro_rules::add_new_extension,
                                 span: None,
                             },
diff --git a/src/libsyntax/ext/deriving/decodable.rs b/src/libsyntax/ext/deriving/decodable.rs
index 062f198425b..2447535f1f3 100644
--- a/src/libsyntax/ext/deriving/decodable.rs
+++ b/src/libsyntax/ext/deriving/decodable.rs
@@ -31,14 +31,14 @@ pub fn expand_deriving_decodable(cx: &mut ExtCtxt,
         span: span,
         attributes: Vec::new(),
         path: Path::new_(vec!("serialize", "Decodable"), None,
-                         vec!(~Literal(Path::new_local("__D")),
-                              ~Literal(Path::new_local("__E"))), true),
+                         vec!(box Literal(Path::new_local("__D")),
+                              box Literal(Path::new_local("__E"))), true),
         additional_bounds: Vec::new(),
         generics: LifetimeBounds {
             lifetimes: Vec::new(),
             bounds: vec!(("__D", ast::StaticSize, vec!(Path::new_(
                             vec!("serialize", "Decoder"), None,
-                            vec!(~Literal(Path::new_local("__E"))), true))),
+                            vec!(box Literal(Path::new_local("__E"))), true))),
                          ("__E", ast::StaticSize, vec!()))
         },
         methods: vec!(
@@ -46,10 +46,11 @@ pub fn expand_deriving_decodable(cx: &mut ExtCtxt,
                 name: "decode",
                 generics: LifetimeBounds::empty(),
                 explicit_self: None,
-                args: vec!(Ptr(~Literal(Path::new_local("__D")),
+                args: vec!(Ptr(box Literal(Path::new_local("__D")),
                             Borrowed(None, MutMutable))),
                 ret_ty: Literal(Path::new_(vec!("std", "result", "Result"), None,
-                                          vec!(~Self, ~Literal(Path::new_local("__E"))), true)),
+                                          vec!(box Self,
+                                               box Literal(Path::new_local("__E"))), true)),
                 attributes: Vec::new(),
                 const_nonmatching: true,
                 combine_substructure: combine_substructure(|a, b, c| {
diff --git a/src/libsyntax/ext/deriving/encodable.rs b/src/libsyntax/ext/deriving/encodable.rs
index ec3d4e0078b..75b051b2f10 100644
--- a/src/libsyntax/ext/deriving/encodable.rs
+++ b/src/libsyntax/ext/deriving/encodable.rs
@@ -99,14 +99,14 @@ pub fn expand_deriving_encodable(cx: &mut ExtCtxt,
         span: span,
         attributes: Vec::new(),
         path: Path::new_(vec!("serialize", "Encodable"), None,
-                         vec!(~Literal(Path::new_local("__S")),
-                              ~Literal(Path::new_local("__E"))), true),
+                         vec!(box Literal(Path::new_local("__S")),
+                              box Literal(Path::new_local("__E"))), true),
         additional_bounds: Vec::new(),
         generics: LifetimeBounds {
             lifetimes: Vec::new(),
             bounds: vec!(("__S", ast::StaticSize, vec!(Path::new_(
                             vec!("serialize", "Encoder"), None,
-                            vec!(~Literal(Path::new_local("__E"))), true))),
+                            vec!(box Literal(Path::new_local("__E"))), true))),
                          ("__E", ast::StaticSize, vec!()))
         },
         methods: vec!(
@@ -114,12 +114,12 @@ pub fn expand_deriving_encodable(cx: &mut ExtCtxt,
                 name: "encode",
                 generics: LifetimeBounds::empty(),
                 explicit_self: borrowed_explicit_self(),
-                args: vec!(Ptr(~Literal(Path::new_local("__S")),
+                args: vec!(Ptr(box Literal(Path::new_local("__S")),
                             Borrowed(None, MutMutable))),
                 ret_ty: Literal(Path::new_(vec!("std", "result", "Result"),
                                            None,
-                                           vec!(~Tuple(Vec::new()),
-                                                ~Literal(Path::new_local("__E"))),
+                                           vec!(box Tuple(Vec::new()),
+                                                box Literal(Path::new_local("__E"))),
                                            true)),
                 attributes: Vec::new(),
                 const_nonmatching: true,
diff --git a/src/libsyntax/ext/deriving/hash.rs b/src/libsyntax/ext/deriving/hash.rs
index d367ae61e0b..8ce98a04e28 100644
--- a/src/libsyntax/ext/deriving/hash.rs
+++ b/src/libsyntax/ext/deriving/hash.rs
@@ -24,7 +24,7 @@ pub fn expand_deriving_hash(cx: &mut ExtCtxt,
 
     let (path, generics, args) = if cx.ecfg.deriving_hash_type_parameter {
         (Path::new_(vec!("std", "hash", "Hash"), None,
-                    vec!(~Literal(Path::new_local("__S"))), true),
+                    vec!(box Literal(Path::new_local("__S"))), true),
          LifetimeBounds {
              lifetimes: Vec::new(),
              bounds: vec!(("__S", ast::StaticSize, vec!(Path::new(vec!("std", "io", "Writer"))))),
@@ -48,7 +48,7 @@ pub fn expand_deriving_hash(cx: &mut ExtCtxt,
                 name: "hash",
                 generics: LifetimeBounds::empty(),
                 explicit_self: borrowed_explicit_self(),
-                args: vec!(Ptr(~Literal(args), Borrowed(None, MutMutable))),
+                args: vec!(Ptr(box Literal(args), Borrowed(None, MutMutable))),
                 ret_ty: nil_ty(),
                 attributes: attrs,
                 const_nonmatching: false,
diff --git a/src/libsyntax/ext/deriving/primitive.rs b/src/libsyntax/ext/deriving/primitive.rs
index 9978a2edce9..5066a395b41 100644
--- a/src/libsyntax/ext/deriving/primitive.rs
+++ b/src/libsyntax/ext/deriving/primitive.rs
@@ -38,7 +38,7 @@ pub fn expand_deriving_from_primitive(cx: &mut ExtCtxt,
                     Literal(Path::new(vec!("i64")))),
                 ret_ty: Literal(Path::new_(vec!("std", "option", "Option"),
                                            None,
-                                           vec!(~Self),
+                                           vec!(box Self),
                                            true)),
                 // #[inline] liable to cause code-bloat
                 attributes: attrs.clone(),
@@ -55,7 +55,7 @@ pub fn expand_deriving_from_primitive(cx: &mut ExtCtxt,
                     Literal(Path::new(vec!("u64")))),
                 ret_ty: Literal(Path::new_(vec!("std", "option", "Option"),
                                            None,
-                                           vec!(~Self),
+                                           vec!(box Self),
                                            true)),
                 // #[inline] liable to cause code-bloat
                 attributes: attrs,
diff --git a/src/libsyntax/ext/deriving/rand.rs b/src/libsyntax/ext/deriving/rand.rs
index 23877dd29ea..397b99925c8 100644
--- a/src/libsyntax/ext/deriving/rand.rs
+++ b/src/libsyntax/ext/deriving/rand.rs
@@ -37,7 +37,7 @@ pub fn expand_deriving_rand(cx: &mut ExtCtxt,
                 },
                 explicit_self: None,
                 args: vec!(
-                    Ptr(~Literal(Path::new_local("R")),
+                    Ptr(box Literal(Path::new_local("R")),
                         Borrowed(None, ast::MutMutable))
                 ),
                 ret_ty: Self,
diff --git a/src/libsyntax/ext/deriving/show.rs b/src/libsyntax/ext/deriving/show.rs
index b9725361538..aeaf53a1939 100644
--- a/src/libsyntax/ext/deriving/show.rs
+++ b/src/libsyntax/ext/deriving/show.rs
@@ -26,7 +26,7 @@ pub fn expand_deriving_show(cx: &mut ExtCtxt,
                             item: @Item,
                             push: |@Item|) {
     // &mut ::std::fmt::Formatter
-    let fmtr = Ptr(~Literal(Path::new(vec!("std", "fmt", "Formatter"))),
+    let fmtr = Ptr(box Literal(Path::new(vec!("std", "fmt", "Formatter"))),
                    Borrowed(None, ast::MutMutable));
 
     let trait_def = TraitDef {
diff --git a/src/libsyntax/ext/deriving/ty.rs b/src/libsyntax/ext/deriving/ty.rs
index 6e3327b4039..769bbe2fc4e 100644
--- a/src/libsyntax/ext/deriving/ty.rs
+++ b/src/libsyntax/ext/deriving/ty.rs
@@ -101,7 +101,7 @@ pub fn borrowed_explicit_self<'r>() -> Option<Option<PtrTy<'r>>> {
 }
 
 pub fn borrowed_self<'r>() -> Ty<'r> {
-    borrowed(~Self)
+    borrowed(box Self)
 }
 
 pub fn nil_ty() -> Ty<'static> {
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index 8143f2aceeb..4c426bef12e 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -134,7 +134,7 @@ pub fn initial_matcher_pos(ms: Vec<Matcher> , sep: Option<Token>, lo: BytePos)
         }
     }
     let matches = Vec::from_fn(count_names(ms.as_slice()), |_i| Vec::new());
-    ~MatcherPos {
+    box MatcherPos {
         elts: ms,
         sep: sep,
         idx: 0u,
@@ -334,7 +334,7 @@ pub fn parse(sess: &ParseSess,
 
                     let matches = Vec::from_elem(ei.matches.len(), Vec::new());
                     let ei_t = ei;
-                    cur_eis.push(~MatcherPos {
+                    cur_eis.push(box MatcherPos {
                         elts: (*matchers).clone(),
                         sep: (*sep).clone(),
                         idx: 0u,
@@ -396,7 +396,7 @@ pub fn parse(sess: &ParseSess,
                 }
                 rdr.next_token();
             } else /* bb_eis.len() == 1 */ {
-                let mut rust_parser = Parser(sess, cfg.clone(), ~rdr.clone());
+                let mut rust_parser = Parser(sess, cfg.clone(), box rdr.clone());
 
                 let mut ei = bb_eis.pop().unwrap();
                 match ei.elts.get(ei.idx).node {
@@ -433,14 +433,14 @@ pub fn parse_nt(p: &mut Parser, name: &str) -> Nonterminal {
       "ty" => token::NtTy(p.parse_ty(false /* no need to disambiguate*/)),
       // this could be handled like a token, since it is one
       "ident" => match p.token {
-        token::IDENT(sn,b) => { p.bump(); token::NtIdent(~sn,b) }
+        token::IDENT(sn,b) => { p.bump(); token::NtIdent(box sn,b) }
         _ => {
             let token_str = token::to_str(&p.token);
             p.fatal("expected ident, found ".to_owned() + token_str)
         }
       },
       "path" => {
-        token::NtPath(~p.parse_path(LifetimeAndTypesWithoutColons).path)
+        token::NtPath(box p.parse_path(LifetimeAndTypesWithoutColons).path)
       }
       "meta" => token::NtMeta(p.parse_meta_item()),
       "tt" => {
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index 78ea37587f0..ab0266cedaa 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -166,10 +166,10 @@ fn generic_extension(cx: &ExtCtxt,
                 let trncbr = new_tt_reader(&cx.parse_sess().span_diagnostic,
                                            Some(named_matches),
                                            rhs);
-                let p = Parser(cx.parse_sess(), cx.cfg(), ~trncbr);
+                let p = Parser(cx.parse_sess(), cx.cfg(), box trncbr);
                 // Let the context choose how to interpret the result.
                 // Weird, but useful for X-macros.
-                return ~ParserAnyMacro {
+                return box ParserAnyMacro {
                     parser: RefCell::new(p),
                 } as ~MacResult
               }
@@ -239,13 +239,13 @@ pub fn add_new_extension(cx: &mut ExtCtxt,
         _ => cx.span_bug(sp, "wrong-structured rhs")
     };
 
-    let exp = ~MacroRulesMacroExpander {
+    let exp = box MacroRulesMacroExpander {
         name: name,
         lhses: lhses,
         rhses: rhses,
     };
 
-    ~MacroRulesDefiner {
+    box MacroRulesDefiner {
         def: RefCell::new(Some(MacroDef {
             name: token::get_ident(name).to_str(),
             ext: NormalTT(exp, Some(sp))
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs
index c1f6e21f923..43535205601 100644
--- a/src/libsyntax/parse/lexer.rs
+++ b/src/libsyntax/parse/lexer.rs
@@ -1020,8 +1020,8 @@ mod test {
     use std::io::util;
 
     fn mk_sh() -> diagnostic::SpanHandler {
-        let emitter = diagnostic::EmitterWriter::new(~util::NullWriter);
-        let handler = diagnostic::mk_handler(~emitter);
+        let emitter = diagnostic::EmitterWriter::new(box util::NullWriter);
+        let handler = diagnostic::mk_handler(box emitter);
         diagnostic::mk_span_handler(handler, CodeMap::new())
     }
 
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index 0d3ae3b5cb8..dec6e6dd374 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -247,7 +247,7 @@ pub fn filemap_to_tts(sess: &ParseSess, filemap: Rc<FileMap>)
     // parsing tt's probably shouldn't require a parser at all.
     let cfg = Vec::new();
     let srdr = lexer::new_string_reader(&sess.span_diagnostic, filemap);
-    let mut p1 = Parser(sess, cfg, ~srdr);
+    let mut p1 = Parser(sess, cfg, box srdr);
     p1.parse_all_token_trees()
 }
 
@@ -256,7 +256,7 @@ pub fn tts_to_parser<'a>(sess: &'a ParseSess,
                          tts: Vec<ast::TokenTree>,
                          cfg: ast::CrateConfig) -> Parser<'a> {
     let trdr = lexer::new_tt_reader(&sess.span_diagnostic, None, tts);
-    Parser(sess, cfg, ~trdr)
+    Parser(sess, cfg, box trdr)
 }
 
 // abort if necessary
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 5d8443b64d5..6989ceb0d79 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -751,7 +751,7 @@ impl<'a> Parser<'a> {
         self.last_span = self.span;
         // Stash token for error recovery (sometimes; clone is not necessarily cheap).
         self.last_token = if is_ident_or_path(&self.token) {
-            Some(~self.token.clone())
+            Some(box self.token.clone())
         } else {
             None
         };
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index afb66ab8317..f5fe92c3e67 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -132,7 +132,7 @@ pub fn print_crate<'a>(cm: &'a CodeMap,
 }
 
 pub fn to_str(f: |&mut State| -> IoResult<()>) -> ~str {
-    let mut s = rust_printer(~MemWriter::new());
+    let mut s = rust_printer(box MemWriter::new());
     f(&mut s).unwrap();
     eof(&mut s.s).unwrap();
     unsafe {