From 090040bf4037a094e50b03d79e4baf5cd89c912b Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Mon, 5 May 2014 18:56:44 -0700 Subject: 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` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change] --- src/libsyntax/ext/tt/macro_parser.rs | 4 ++-- src/libsyntax/ext/tt/macro_rules.rs | 10 +++++----- src/libsyntax/ext/tt/transcribe.rs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/libsyntax/ext/tt') 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 , // maybe should be <'>? Need to understand regions. sep: Option, idx: uint, - up: Option<~MatcherPos>, + up: Option>, matches: Vec>>, 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 , sep: Option, lo: BytePos) - -> ~MatcherPos { + -> Box { 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 { generic_extension(cx, sp, self.name, @@ -121,7 +121,7 @@ fn generic_extension(cx: &ExtCtxt, arg: &[ast::TokenTree], lhses: &[Rc], rhses: &[Rc]) - -> ~MacResult { + -> Box { 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 } 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 ) - -> ~base::MacResult { + -> Box { // 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 } 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; -- cgit 1.4.1-3-g733a5