diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-04-21 15:23:07 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-04-21 15:23:07 -0700 |
| commit | 37a1f2e3acc75e8a3d0fd47bb345b2cd880b2937 (patch) | |
| tree | 0e9af466fc2c1f4185b87f29ffe71a86ad5bcaa9 /src/libsyntax/ext/tt | |
| parent | 957cb422a98585568558ad88ec5a0841c43961ae (diff) | |
| parent | 19c8d701743922a709a4eb6554f562996b7baa27 (diff) | |
| download | rust-37a1f2e3acc75e8a3d0fd47bb345b2cd880b2937.tar.gz rust-37a1f2e3acc75e8a3d0fd47bb345b2cd880b2937.zip | |
rollup merge of #24487: erickt/syntax
This removes the usage of `#[feature(into_cow, slice_patterns, box_syntax, box_patterns, quote, unsafe_destructor)]` from being used in libsyntax. My main desire for this is that it brings me one step closer to letting [syntex](https://github.com/erickt/rust-syntex) compile with stable rust. Hopefully this doesn't inconvenience rust development.
Diffstat (limited to 'src/libsyntax/ext/tt')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/transcribe.rs | 4 |
3 files changed, 12 insertions, 12 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 58df4038403..5521c68e75c 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -165,7 +165,7 @@ pub fn initial_matcher_pos(ms: Rc<Vec<TokenTree>>, sep: Option<Token>, lo: ByteP -> Box<MatcherPos> { let match_idx_hi = count_names(&ms[..]); let matches: Vec<_> = (0..match_idx_hi).map(|_| Vec::new()).collect(); - box MatcherPos { + Box::new(MatcherPos { stack: vec![], top_elts: TtSeq(ms), sep: sep, @@ -176,7 +176,7 @@ pub fn initial_matcher_pos(ms: Rc<Vec<TokenTree>>, sep: Option<Token>, lo: ByteP match_cur: 0, match_hi: match_idx_hi, sp_lo: lo - } + }) } /// NamedMatch is a pattern-match result for a single token::MATCH_NONTERMINAL: @@ -396,7 +396,7 @@ pub fn parse(sess: &ParseSess, let matches: Vec<_> = (0..ei.matches.len()) .map(|_| Vec::new()).collect(); let ei_t = ei; - cur_eis.push(box MatcherPos { + cur_eis.push(Box::new(MatcherPos { stack: vec![], sep: seq.separator.clone(), idx: 0, @@ -407,7 +407,7 @@ pub fn parse(sess: &ParseSess, up: Some(ei_t), sp_lo: sp.lo, top_elts: Tt(TtSequence(sp, seq)), - }); + })); } TtToken(_, MatchNt(..)) => { // Built-in nonterminals never start with these tokens, @@ -533,7 +533,7 @@ pub fn parse_nt(p: &mut Parser, sp: Span, name: &str) -> Nonterminal { "ty" => token::NtTy(p.parse_ty()), // this could be handled like a token, since it is one "ident" => match p.token { - token::Ident(sn,b) => { panictry!(p.bump()); token::NtIdent(box sn,b) } + token::Ident(sn,b) => { panictry!(p.bump()); token::NtIdent(Box::new(sn),b) } _ => { let token_str = pprust::token_to_string(&p.token); panic!(p.fatal(&format!("expected ident, found {}", @@ -541,7 +541,7 @@ pub fn parse_nt(p: &mut Parser, sp: Span, name: &str) -> Nonterminal { } }, "path" => { - token::NtPath(box panictry!(p.parse_path(LifetimeAndTypesWithoutColons))) + token::NtPath(Box::new(panictry!(p.parse_path(LifetimeAndTypesWithoutColons)))) } "meta" => token::NtMeta(p.parse_meta_item()), _ => { diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 730da6cc594..27a00290ee0 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -192,7 +192,7 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt, panictry!(p.check_unknown_macro_variable()); // Let the context choose how to interpret the result. // Weird, but useful for X-macros. - return box ParserAnyMacro { + return Box::new(ParserAnyMacro { parser: RefCell::new(p), // Pass along the original expansion site and the name of the macro @@ -200,7 +200,7 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt, // macro leaves unparsed tokens. site_span: sp, macro_ident: name - } + }) } Failure(sp, ref msg) => if sp.lo >= best_fail_spot.lo { best_fail_spot = sp; @@ -281,12 +281,12 @@ pub fn compile<'cx>(cx: &'cx mut ExtCtxt, _ => cx.span_bug(def.span, "wrong-structured rhs") }; - let exp: Box<_> = box MacroRulesMacroExpander { + let exp: Box<_> = Box::new(MacroRulesMacroExpander { name: def.ident, imported_from: def.imported_from, lhses: lhses, rhses: rhses, - }; + }); NormalTT(exp, Some(def.span), def.allow_internal_unstable) } diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index e39b46a2d3e..368a9f0c27e 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -294,9 +294,9 @@ 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(box sn, b)) => { + MatchedNonterminal(NtIdent(ref sn, b)) => { r.cur_span = sp; - r.cur_tok = token::Ident(sn, b); + r.cur_tok = token::Ident(**sn, b); return ret_val; } MatchedNonterminal(ref other_whole_nt) => { |
