diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-05-05 18:56:44 -0700 | 
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-05-06 23:12:54 -0700 | 
| commit | 090040bf4037a094e50b03d79e4baf5cd89c912b (patch) | |
| tree | 27fa91d623889d59260d3db167abdfa8c4288849 /src/libsyntax/ext | |
| parent | 24f6f26e633e50b5b59f9d0f6cca0b1e49e215d9 (diff) | |
| download | rust-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')
| -rw-r--r-- | src/libsyntax/ext/asm.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/ext/base.rs | 32 | ||||
| -rw-r--r-- | src/libsyntax/ext/bytes.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/cfg.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/concat.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/ext/concat_idents.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/generic.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/ty.rs | 11 | ||||
| -rw-r--r-- | src/libsyntax/ext/env.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/ext/fmt.rs | 7 | ||||
| -rw-r--r-- | src/libsyntax/ext/format.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/log_syntax.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/quote.rs | 18 | ||||
| -rw-r--r-- | src/libsyntax/ext/source_util.rs | 17 | ||||
| -rw-r--r-- | src/libsyntax/ext/trace_macros.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/transcribe.rs | 2 | 
19 files changed, 73 insertions, 63 deletions
diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs index 9b362f8d942..b9c8be290ca 100644 --- a/src/libsyntax/ext/asm.rs +++ b/src/libsyntax/ext/asm.rs @@ -20,6 +20,7 @@ use parse; use parse::token::InternedString; use parse::token; + enum State { Asm, Outputs, @@ -45,7 +46,7 @@ impl State { static OPTIONS: &'static [&'static str] = &["volatile", "alignstack", "intel"]; pub fn expand_asm(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) - -> ~base::MacResult { + -> Box<base::MacResult> { let mut p = parse::new_parser_from_tts(cx.parse_sess(), cx.cfg(), tts.iter() 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 { diff --git a/src/libsyntax/ext/bytes.rs b/src/libsyntax/ext/bytes.rs index c6349d616ec..06b50e37cbd 100644 --- a/src/libsyntax/ext/bytes.rs +++ b/src/libsyntax/ext/bytes.rs @@ -16,7 +16,9 @@ use ext::base::*; use ext::base; use ext::build::AstBuilder; -pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> ~base::MacResult { + +pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) + -> Box<base::MacResult> { // Gather all argument expressions let exprs = match get_exprs_from_tts(cx, sp, tts) { None => return DummyResult::expr(sp), diff --git a/src/libsyntax/ext/cfg.rs b/src/libsyntax/ext/cfg.rs index 8cd899738bf..3e74b2680e0 100644 --- a/src/libsyntax/ext/cfg.rs +++ b/src/libsyntax/ext/cfg.rs @@ -26,7 +26,9 @@ use parse::token::InternedString; use parse::token; use parse; -pub fn expand_cfg(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> ~base::MacResult { + +pub fn expand_cfg(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) + -> Box<base::MacResult> { let mut p = parse::new_parser_from_tts(cx.parse_sess(), cx.cfg(), tts.iter() diff --git a/src/libsyntax/ext/concat.rs b/src/libsyntax/ext/concat.rs index fe7fa636e7d..7c6c9892002 100644 --- a/src/libsyntax/ext/concat.rs +++ b/src/libsyntax/ext/concat.rs @@ -18,7 +18,8 @@ use std::strbuf::StrBuf; pub fn expand_syntax_ext(cx: &mut base::ExtCtxt, sp: codemap::Span, - tts: &[ast::TokenTree]) -> ~base::MacResult { + tts: &[ast::TokenTree]) + -> Box<base::MacResult> { let es = match base::get_exprs_from_tts(cx, sp, tts) { Some(e) => e, None => return base::DummyResult::expr(sp) diff --git a/src/libsyntax/ext/concat_idents.rs b/src/libsyntax/ext/concat_idents.rs index 9513c15c3d0..0e168e7b33b 100644 --- a/src/libsyntax/ext/concat_idents.rs +++ b/src/libsyntax/ext/concat_idents.rs @@ -19,7 +19,7 @@ use parse::token::{str_to_ident}; use std::strbuf::StrBuf; pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) - -> ~base::MacResult { + -> Box<base::MacResult> { let mut res_str = StrBuf::new(); for (i, e) in tts.iter().enumerate() { if i & 1 == 1 { diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs index bf886e51885..a3f9eaee892 100644 --- a/src/libsyntax/ext/deriving/generic.rs +++ b/src/libsyntax/ext/deriving/generic.rs @@ -571,7 +571,7 @@ impl<'a> MethodDef<'a> { Self if nonstatic => { self_args.push(arg_expr); } - Ptr(~Self, _) if nonstatic => { + Ptr(box Self, _) if nonstatic => { self_args.push(cx.expr_deref(trait_.span, arg_expr)) } _ => { diff --git a/src/libsyntax/ext/deriving/ty.rs b/src/libsyntax/ext/deriving/ty.rs index 769bbe2fc4e..602245b4c47 100644 --- a/src/libsyntax/ext/deriving/ty.rs +++ b/src/libsyntax/ext/deriving/ty.rs @@ -20,6 +20,7 @@ use ext::build::AstBuilder; use codemap::{Span,respan}; use owned_slice::OwnedSlice; + /// The types of pointers pub enum PtrTy<'a> { Send, // ~ @@ -31,7 +32,7 @@ pub enum PtrTy<'a> { pub struct Path<'a> { pub path: Vec<&'a str> , pub lifetime: Option<&'a str>, - pub params: Vec<~Ty<'a>> , + pub params: Vec<Box<Ty<'a>>>, pub global: bool, } @@ -44,7 +45,7 @@ impl<'a> Path<'a> { } pub fn new_<'r>(path: Vec<&'r str> , lifetime: Option<&'r str>, - params: Vec<~Ty<'r>> , + params: Vec<Box<Ty<'r>>>, global: bool) -> Path<'r> { Path { @@ -80,8 +81,8 @@ impl<'a> Path<'a> { /// A type. Supports pointers (except for *), Self, and literals pub enum Ty<'a> { Self, - // &/~/@ Ty - Ptr(~Ty<'a>, PtrTy<'a>), + // &/Box/@ Ty + Ptr(Box<Ty<'a>>, PtrTy<'a>), // mod::mod::Type<[lifetime], [Params...]>, including a plain type // parameter, and things like `int` Literal(Path<'a>), @@ -92,7 +93,7 @@ pub enum Ty<'a> { pub fn borrowed_ptrty<'r>() -> PtrTy<'r> { Borrowed(None, ast::MutImmutable) } -pub fn borrowed<'r>(ty: ~Ty<'r>) -> Ty<'r> { +pub fn borrowed<'r>(ty: Box<Ty<'r>>) -> Ty<'r> { Ptr(ty, borrowed_ptrty()) } diff --git a/src/libsyntax/ext/env.rs b/src/libsyntax/ext/env.rs index 7229f5c1df9..ea3fef352be 100644 --- a/src/libsyntax/ext/env.rs +++ b/src/libsyntax/ext/env.rs @@ -24,7 +24,7 @@ use parse::token; use std::os; pub fn expand_option_env(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) - -> ~base::MacResult { + -> Box<base::MacResult> { let var = match get_single_str_from_tts(cx, sp, tts, "option_env!") { None => return DummyResult::expr(sp), Some(v) => v @@ -60,7 +60,7 @@ pub fn expand_option_env(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) } pub fn expand_env(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) - -> ~base::MacResult { + -> Box<base::MacResult> { let exprs = match get_exprs_from_tts(cx, sp, tts) { Some(ref exprs) if exprs.len() == 0 => { cx.span_err(sp, "env! takes 1 or 2 arguments"); diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 734d07ccb8f..0dc62728e5c 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1100,12 +1100,6 @@ mod test { } } - //fn fake_print_crate(krate: &ast::Crate) { - // let mut out = ~std::io::stderr() as ~std::io::Writer; - // let mut s = pprust::rust_printer(out, get_ident_interner()); - // pprust::print_crate_(&mut s, krate); - //} - fn expand_crate_str(crate_str: ~str) -> ast::Crate { let ps = parse::new_parse_sess(); let crate_ast = string_to_parser(&ps, crate_str).parse_crate_mod(); diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs index 41c74ce9ae5..0907541eee0 100644 --- a/src/libsyntax/ext/fmt.rs +++ b/src/libsyntax/ext/fmt.rs @@ -15,8 +15,11 @@ use codemap::Span; use ext::base; use ext::build::AstBuilder; -pub fn expand_syntax_ext(ecx: &mut base::ExtCtxt, sp: Span, - _tts: &[ast::TokenTree]) -> ~base::MacResult { + +pub fn expand_syntax_ext(ecx: &mut base::ExtCtxt, + sp: Span, + _tts: &[ast::TokenTree]) + -> Box<base::MacResult> { ecx.span_err(sp, "`fmt!` is deprecated, use `format!` instead"); ecx.parse_sess.span_diagnostic.span_note(sp, "see http://static.rust-lang.org/doc/master/std/fmt/index.html \ diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index 0d856fb689d..fc3136996ae 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -805,7 +805,7 @@ impl<'a, 'b> Context<'a, 'b> { } pub fn expand_args(ecx: &mut ExtCtxt, sp: Span, - tts: &[ast::TokenTree]) -> ~base::MacResult { + tts: &[ast::TokenTree]) -> Box<base::MacResult> { match parse_args(ecx, sp, tts) { (extra, Some((efmt, args, order, names))) => { diff --git a/src/libsyntax/ext/log_syntax.rs b/src/libsyntax/ext/log_syntax.rs index 666bc486fbf..486d060da77 100644 --- a/src/libsyntax/ext/log_syntax.rs +++ b/src/libsyntax/ext/log_syntax.rs @@ -18,7 +18,7 @@ use std::rc::Rc; pub fn expand_syntax_ext(cx: &mut base::ExtCtxt, sp: codemap::Span, tt: &[ast::TokenTree]) - -> ~base::MacResult { + -> Box<base::MacResult> { cx.print_backtrace(); println!("{}", print::pprust::tt_to_str(&ast::TTDelim( diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index fc7f7722354..4d8be9bab76 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -17,6 +17,7 @@ use parse::token::*; use parse::token; use parse; + /** * * Quasiquoting works via token trees. @@ -312,7 +313,8 @@ pub mod rt { pub fn expand_quote_tokens(cx: &mut ExtCtxt, sp: Span, - tts: &[ast::TokenTree]) -> ~base::MacResult { + tts: &[ast::TokenTree]) + -> Box<base::MacResult> { let (cx_expr, expr) = expand_tts(cx, sp, tts); let expanded = expand_wrapper(cx, sp, cx_expr, expr); base::MacExpr::new(expanded) @@ -320,14 +322,15 @@ pub fn expand_quote_tokens(cx: &mut ExtCtxt, pub fn expand_quote_expr(cx: &mut ExtCtxt, sp: Span, - tts: &[ast::TokenTree]) -> ~base::MacResult { + tts: &[ast::TokenTree]) -> Box<base::MacResult> { let expanded = expand_parse_call(cx, sp, "parse_expr", Vec::new(), tts); base::MacExpr::new(expanded) } pub fn expand_quote_item(cx: &mut ExtCtxt, sp: Span, - tts: &[ast::TokenTree]) -> ~base::MacResult { + tts: &[ast::TokenTree]) + -> Box<base::MacResult> { let e_attrs = cx.expr_vec_ng(sp); let expanded = expand_parse_call(cx, sp, "parse_item", vec!(e_attrs), tts); @@ -336,7 +339,8 @@ pub fn expand_quote_item(cx: &mut ExtCtxt, pub fn expand_quote_pat(cx: &mut ExtCtxt, sp: Span, - tts: &[ast::TokenTree]) -> ~base::MacResult { + tts: &[ast::TokenTree]) + -> Box<base::MacResult> { let e_refutable = cx.expr_lit(sp, ast::LitBool(true)); let expanded = expand_parse_call(cx, sp, "parse_pat", vec!(e_refutable), tts); @@ -345,7 +349,8 @@ pub fn expand_quote_pat(cx: &mut ExtCtxt, pub fn expand_quote_ty(cx: &mut ExtCtxt, sp: Span, - tts: &[ast::TokenTree]) -> ~base::MacResult { + tts: &[ast::TokenTree]) + -> Box<base::MacResult> { let e_param_colons = cx.expr_lit(sp, ast::LitBool(false)); let expanded = expand_parse_call(cx, sp, "parse_ty", vec!(e_param_colons), tts); @@ -354,7 +359,8 @@ pub fn expand_quote_ty(cx: &mut ExtCtxt, pub fn expand_quote_stmt(cx: &mut ExtCtxt, sp: Span, - tts: &[ast::TokenTree]) -> ~base::MacResult { + tts: &[ast::TokenTree]) + -> Box<base::MacResult> { let e_attrs = cx.expr_vec_ng(sp); let expanded = expand_parse_call(cx, sp, "parse_stmt", vec!(e_attrs), tts); diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index 7f1d8172255..e221ab80d7b 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -29,7 +29,7 @@ use std::str; /* line!(): expands to the current line number */ pub fn expand_line(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) - -> ~base::MacResult { + -> Box<base::MacResult> { base::check_zero_tts(cx, sp, tts, "line!"); let topmost = topmost_expn_info(cx.backtrace().unwrap()); @@ -40,7 +40,7 @@ pub fn expand_line(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) /* col!(): expands to the current column number */ pub fn expand_col(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) - -> ~base::MacResult { + -> Box<base::MacResult> { base::check_zero_tts(cx, sp, tts, "col!"); let topmost = topmost_expn_info(cx.backtrace().unwrap()); @@ -52,7 +52,7 @@ pub fn expand_col(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) /* The filemap (`loc.file`) contains a bunch more information we could spit * out if we wanted. */ pub fn expand_file(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) - -> ~base::MacResult { + -> Box<base::MacResult> { base::check_zero_tts(cx, sp, tts, "file!"); let topmost = topmost_expn_info(cx.backtrace().unwrap()); @@ -62,13 +62,13 @@ pub fn expand_file(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) } pub fn expand_stringify(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) - -> ~base::MacResult { + -> Box<base::MacResult> { let s = pprust::tts_to_str(tts); base::MacExpr::new(cx.expr_str(sp, token::intern_and_get_ident(s))) } pub fn expand_mod(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) - -> ~base::MacResult { + -> Box<base::MacResult> { base::check_zero_tts(cx, sp, tts, "module_path!"); let string = cx.mod_path() .iter() @@ -82,7 +82,7 @@ pub fn expand_mod(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) // This is generally a bad idea because it's going to behave // unhygienically. pub fn expand_include(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) - -> ~base::MacResult { + -> Box<base::MacResult> { let file = match get_single_str_from_tts(cx, sp, tts, "include!") { Some(f) => f, None => return DummyResult::expr(sp), @@ -100,7 +100,7 @@ pub fn expand_include(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) // include_str! : read the given file, insert it as a literal string expr pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) - -> ~base::MacResult { + -> Box<base::MacResult> { let file = match get_single_str_from_tts(cx, sp, tts, "include_str!") { Some(f) => f, None => return DummyResult::expr(sp) @@ -131,8 +131,7 @@ 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 -{ + -> Box<base::MacResult> { let file = match get_single_str_from_tts(cx, sp, tts, "include_bin!") { Some(f) => f, None => return DummyResult::expr(sp) diff --git a/src/libsyntax/ext/trace_macros.rs b/src/libsyntax/ext/trace_macros.rs index d428251604c..77324632664 100644 --- a/src/libsyntax/ext/trace_macros.rs +++ b/src/libsyntax/ext/trace_macros.rs @@ -14,10 +14,11 @@ use ext::base::ExtCtxt; use ext::base; use parse::token::{keywords, is_keyword}; + pub fn expand_trace_macros(cx: &mut ExtCtxt, sp: Span, tt: &[ast::TokenTree]) - -> ~base::MacResult { + -> Box<base::MacResult> { match tt { [ast::TTTok(_, ref tok)] if is_keyword(keywords::True, tok) => { cx.set_trace_macros(true); diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 4c426bef12e..ee3ff0c389e 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -102,7 +102,7 @@ pub struct MatcherPos { elts: Vec<ast::Matcher> , // maybe should be <'>? Need to understand regions. sep: Option<Token>, idx: uint, - up: Option<~MatcherPos>, + up: Option<Box<MatcherPos>>, matches: Vec<Vec<Rc<NamedMatch>>>, match_lo: uint, match_hi: uint, sp_lo: BytePos, @@ -120,7 +120,7 @@ pub fn count_names(ms: &[Matcher]) -> uint { } pub fn initial_matcher_pos(ms: Vec<Matcher> , sep: Option<Token>, lo: BytePos) - -> ~MatcherPos { + -> Box<MatcherPos> { let mut match_idx_hi = 0u; for elt in ms.iter() { match elt.node { diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index ab0266cedaa..5a02acdae1c 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -95,7 +95,7 @@ impl MacroExpander for MacroRulesMacroExpander { cx: &mut ExtCtxt, sp: Span, arg: &[ast::TokenTree]) - -> ~MacResult { + -> Box<MacResult> { generic_extension(cx, sp, self.name, @@ -121,7 +121,7 @@ fn generic_extension(cx: &ExtCtxt, arg: &[ast::TokenTree], lhses: &[Rc<NamedMatch>], rhses: &[Rc<NamedMatch>]) - -> ~MacResult { + -> Box<MacResult> { if cx.trace_macros() { println!("{}! \\{ {} \\}", token::get_ident(name), @@ -171,7 +171,7 @@ fn generic_extension(cx: &ExtCtxt, // Weird, but useful for X-macros. return box ParserAnyMacro { parser: RefCell::new(p), - } as ~MacResult + } as Box<MacResult> } Failure(sp, ref msg) => if sp.lo >= best_fail_spot.lo { best_fail_spot = sp; @@ -193,7 +193,7 @@ pub fn add_new_extension(cx: &mut ExtCtxt, sp: Span, name: Ident, arg: Vec<ast::TokenTree> ) - -> ~base::MacResult { + -> Box<base::MacResult> { // these spans won't matter, anyways fn ms(m: Matcher_) -> Matcher { Spanned { @@ -250,5 +250,5 @@ pub fn add_new_extension(cx: &mut ExtCtxt, name: token::get_ident(name).to_str(), ext: NormalTT(exp, Some(sp)) })) - } as ~MacResult + } as Box<MacResult> } diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index 8fa4857cab0..f6bee033553 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -254,7 +254,7 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan { /* sidestep the interpolation tricks for ident because (a) idents can be in lots of places, so it'd be a pain (b) we actually can, since it's a token. */ - MatchedNonterminal(NtIdent(~sn,b)) => { + MatchedNonterminal(NtIdent(box sn, b)) => { r.cur_span = sp; r.cur_tok = IDENT(sn,b); return ret_val;  | 
