about summary refs log tree commit diff
path: root/src/libsyntax/ext/base.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-05-05 18:56:44 -0700
committerPatrick Walton <pcwalton@mimiga.net>2014-05-06 23:12:54 -0700
commit090040bf4037a094e50b03d79e4baf5cd89c912b (patch)
tree27fa91d623889d59260d3db167abdfa8c4288849 /src/libsyntax/ext/base.rs
parent24f6f26e633e50b5b59f9d0f6cca0b1e49e215d9 (diff)
downloadrust-090040bf4037a094e50b03d79e4baf5cd89c912b.tar.gz
rust-090040bf4037a094e50b03d79e4baf5cd89c912b.zip
librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, except
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]
Diffstat (limited to 'src/libsyntax/ext/base.rs')
-rw-r--r--src/libsyntax/ext/base.rs32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index cee6216b23f..01ec4c84b68 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -50,19 +50,19 @@ pub trait MacroExpander {
               ecx: &mut ExtCtxt,
               span: Span,
               token_tree: &[ast::TokenTree])
-              -> ~MacResult;
+              -> Box<MacResult>;
 }
 
 pub type MacroExpanderFn =
     fn(ecx: &mut ExtCtxt, span: codemap::Span, token_tree: &[ast::TokenTree])
-       -> ~MacResult;
+       -> Box<MacResult>;
 
 impl MacroExpander for BasicMacroExpander {
     fn expand(&self,
               ecx: &mut ExtCtxt,
               span: Span,
               token_tree: &[ast::TokenTree])
-              -> ~MacResult {
+              -> Box<MacResult> {
         (self.expander)(ecx, span, token_tree)
     }
 }
@@ -78,7 +78,7 @@ pub trait IdentMacroExpander {
               sp: Span,
               ident: ast::Ident,
               token_tree: Vec<ast::TokenTree> )
-              -> ~MacResult;
+              -> Box<MacResult>;
 }
 
 impl IdentMacroExpander for BasicIdentMacroExpander {
@@ -87,13 +87,13 @@ impl IdentMacroExpander for BasicIdentMacroExpander {
               sp: Span,
               ident: ast::Ident,
               token_tree: Vec<ast::TokenTree> )
-              -> ~MacResult {
+              -> Box<MacResult> {
         (self.expander)(cx, sp, ident, token_tree)
     }
 }
 
 pub type IdentMacroExpanderFn =
-    fn(&mut ExtCtxt, Span, ast::Ident, Vec<ast::TokenTree> ) -> ~MacResult;
+    fn(&mut ExtCtxt, Span, ast::Ident, Vec<ast::TokenTree>) -> Box<MacResult>;
 
 pub type MacroCrateRegistrationFun =
     fn(|ast::Name, SyntaxExtension|);
@@ -130,8 +130,8 @@ pub struct MacExpr {
     e: @ast::Expr
 }
 impl MacExpr {
-    pub fn new(e: @ast::Expr) -> ~MacResult {
-        box MacExpr { e: e } as ~MacResult
+    pub fn new(e: @ast::Expr) -> Box<MacResult> {
+        box MacExpr { e: e } as Box<MacResult>
     }
 }
 impl MacResult for MacExpr {
@@ -144,8 +144,8 @@ pub struct MacItem {
     i: @ast::Item
 }
 impl MacItem {
-    pub fn new(i: @ast::Item) -> ~MacResult {
-        box MacItem { i: i } as ~MacResult
+    pub fn new(i: @ast::Item) -> Box<MacResult> {
+        box MacItem { i: i } as Box<MacResult>
     }
 }
 impl MacResult for MacItem {
@@ -173,8 +173,8 @@ impl DummyResult {
     ///
     /// Use this as a return value after hitting any errors and
     /// calling `span_err`.
-    pub fn any(sp: Span) -> ~MacResult {
-        box DummyResult { expr_only: false, span: sp } as ~MacResult
+    pub fn any(sp: Span) -> Box<MacResult> {
+        box DummyResult { expr_only: false, span: sp } as Box<MacResult>
     }
 
     /// Create a default MacResult that can only be an expression.
@@ -182,8 +182,8 @@ impl DummyResult {
     /// Use this for macros that must expand to an expression, so even
     /// 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 {
-        box DummyResult { expr_only: true, span: sp } as ~MacResult
+    pub fn expr(sp: Span) -> Box<MacResult> {
+        box DummyResult { expr_only: true, span: sp } as Box<MacResult>
     }
 
     /// A plain dummy expression.
@@ -229,13 +229,13 @@ pub enum SyntaxExtension {
     /// A normal, function-like syntax extension.
     ///
     /// `bytes!` is a `NormalTT`.
-    NormalTT(~MacroExpander:'static, Option<Span>),
+    NormalTT(Box<MacroExpander:'static>, Option<Span>),
 
     /// A function-like syntax extension that has an extra ident before
     /// the block.
     ///
     /// `macro_rules!` is an `IdentTT`.
-    IdentTT(~IdentMacroExpander:'static, Option<Span>),
+    IdentTT(Box<IdentMacroExpander:'static>, Option<Span>),
 }
 
 pub struct BlockInfo {