syntax: remove #![feature(box_syntax, box_patterns)]
This commit is contained in:
parent
7397bdc9c5
commit
a4541b02a3
19 changed files with 44 additions and 46 deletions
|
@ -262,10 +262,10 @@ macro_rules! make_MacEager {
|
|||
impl MacEager {
|
||||
$(
|
||||
pub fn $fld(v: $t) -> Box<MacResult> {
|
||||
box MacEager {
|
||||
Box::new(MacEager {
|
||||
$fld: Some(v),
|
||||
..Default::default()
|
||||
}
|
||||
})
|
||||
}
|
||||
)*
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ impl DummyResult {
|
|||
/// Use this as a return value after hitting any errors and
|
||||
/// calling `span_err`.
|
||||
pub fn any(sp: Span) -> Box<MacResult+'static> {
|
||||
box DummyResult { expr_only: false, span: sp }
|
||||
Box::new(DummyResult { expr_only: false, span: sp })
|
||||
}
|
||||
|
||||
/// Create a default MacResult that can only be an expression.
|
||||
|
@ -340,7 +340,7 @@ impl DummyResult {
|
|||
/// if an error is encountered internally, the user will receive
|
||||
/// an error that they also used it in the wrong place.
|
||||
pub fn expr(sp: Span) -> Box<MacResult+'static> {
|
||||
box DummyResult { expr_only: true, span: sp }
|
||||
Box::new(DummyResult { expr_only: true, span: sp })
|
||||
}
|
||||
|
||||
/// A plain dummy expression.
|
||||
|
|
|
@ -47,7 +47,7 @@ pub fn expand_deriving_partial_ord(cx: &mut ExtCtxt,
|
|||
let ordering_ty = Literal(path_std!(cx, core::cmp::Ordering));
|
||||
let ret_ty = Literal(Path::new_(pathvec_std!(cx, core::option::Option),
|
||||
None,
|
||||
vec![box ordering_ty],
|
||||
vec![Box::new(ordering_ty)],
|
||||
true));
|
||||
|
||||
let inline = cx.meta_word(span, InternedString::new("inline"));
|
||||
|
|
|
@ -68,14 +68,14 @@ fn expand_deriving_decodable_imp(cx: &mut ExtCtxt,
|
|||
vec!(), true))))
|
||||
},
|
||||
explicit_self: None,
|
||||
args: vec!(Ptr(box Literal(Path::new_local("__D")),
|
||||
args: vec!(Ptr(Box::new(Literal(Path::new_local("__D"))),
|
||||
Borrowed(None, MutMutable))),
|
||||
ret_ty: Literal(Path::new_(
|
||||
pathvec_std!(cx, core::result::Result),
|
||||
None,
|
||||
vec!(box Self_, box Literal(Path::new_(
|
||||
vec!(Box::new(Self_), Box::new(Literal(Path::new_(
|
||||
vec!["__D", "Error"], None, vec![], false
|
||||
))),
|
||||
)))),
|
||||
true
|
||||
)),
|
||||
attributes: Vec::new(),
|
||||
|
|
|
@ -144,14 +144,14 @@ fn expand_deriving_encodable_imp(cx: &mut ExtCtxt,
|
|||
vec!(), true))))
|
||||
},
|
||||
explicit_self: borrowed_explicit_self(),
|
||||
args: vec!(Ptr(box Literal(Path::new_local("__S")),
|
||||
args: vec!(Ptr(Box::new(Literal(Path::new_local("__S"))),
|
||||
Borrowed(None, MutMutable))),
|
||||
ret_ty: Literal(Path::new_(
|
||||
pathvec_std!(cx, core::result::Result),
|
||||
None,
|
||||
vec!(box Tuple(Vec::new()), box Literal(Path::new_(
|
||||
vec!(Box::new(Tuple(Vec::new())), Box::new(Literal(Path::new_(
|
||||
vec!["__S", "Error"], None, vec![], false
|
||||
))),
|
||||
)))),
|
||||
true
|
||||
)),
|
||||
attributes: Vec::new(),
|
||||
|
|
|
@ -807,7 +807,7 @@ impl<'a> MethodDef<'a> {
|
|||
Self_ if nonstatic => {
|
||||
self_args.push(arg_expr);
|
||||
}
|
||||
Ptr(box Self_, _) if nonstatic => {
|
||||
Ptr(ref ty, _) if **ty == Self_ && nonstatic => {
|
||||
self_args.push(cx.expr_deref(trait_.span, arg_expr))
|
||||
}
|
||||
_ => {
|
||||
|
|
|
@ -24,7 +24,7 @@ use parse::token::special_idents;
|
|||
use ptr::P;
|
||||
|
||||
/// The types of pointers
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
pub enum PtrTy<'a> {
|
||||
/// &'lifetime mut
|
||||
Borrowed(Option<&'a str>, ast::Mutability),
|
||||
|
@ -34,7 +34,7 @@ pub enum PtrTy<'a> {
|
|||
|
||||
/// A path, e.g. `::std::option::Option::<i32>` (global). Has support
|
||||
/// for type parameters and a lifetime.
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
pub struct Path<'a> {
|
||||
pub path: Vec<&'a str> ,
|
||||
pub lifetime: Option<&'a str>,
|
||||
|
@ -85,7 +85,7 @@ impl<'a> Path<'a> {
|
|||
}
|
||||
|
||||
/// A type. Supports pointers, Self, and literals
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
pub enum Ty<'a> {
|
||||
Self_,
|
||||
/// &/Box/ Ty
|
||||
|
@ -109,7 +109,7 @@ pub fn borrowed_explicit_self<'r>() -> Option<Option<PtrTy<'r>>> {
|
|||
}
|
||||
|
||||
pub fn borrowed_self<'r>() -> Ty<'r> {
|
||||
borrowed(box Self_)
|
||||
borrowed(Box::new(Self_))
|
||||
}
|
||||
|
||||
pub fn nil_ty<'r>() -> Ty<'r> {
|
||||
|
|
|
@ -41,7 +41,7 @@ pub fn expand_deriving_hash(cx: &mut ExtCtxt,
|
|||
vec![path_std!(cx, core::hash::Hasher)])],
|
||||
},
|
||||
explicit_self: borrowed_explicit_self(),
|
||||
args: vec!(Ptr(box Literal(arg), Borrowed(None, MutMutable))),
|
||||
args: vec!(Ptr(Box::new(Literal(arg)), Borrowed(None, MutMutable))),
|
||||
ret_ty: nil_ty(),
|
||||
attributes: vec![],
|
||||
combine_substructure: combine_substructure(Box::new(|a, b, c| {
|
||||
|
|
|
@ -40,7 +40,7 @@ pub fn expand_deriving_from_primitive(cx: &mut ExtCtxt,
|
|||
args: vec!(Literal(path_local!(i64))),
|
||||
ret_ty: Literal(Path::new_(pathvec_std!(cx, core::option::Option),
|
||||
None,
|
||||
vec!(box Self_),
|
||||
vec!(Box::new(Self_)),
|
||||
true)),
|
||||
// #[inline] liable to cause code-bloat
|
||||
attributes: attrs.clone(),
|
||||
|
@ -55,7 +55,7 @@ pub fn expand_deriving_from_primitive(cx: &mut ExtCtxt,
|
|||
args: vec!(Literal(path_local!(u64))),
|
||||
ret_ty: Literal(Path::new_(pathvec_std!(cx, core::option::Option),
|
||||
None,
|
||||
vec!(box Self_),
|
||||
vec!(Box::new(Self_)),
|
||||
true)),
|
||||
// #[inline] liable to cause code-bloat
|
||||
attributes: attrs,
|
||||
|
|
|
@ -25,7 +25,7 @@ pub fn expand_deriving_show(cx: &mut ExtCtxt,
|
|||
push: &mut FnMut(P<Item>))
|
||||
{
|
||||
// &mut ::std::fmt::Formatter
|
||||
let fmtr = Ptr(box Literal(path_std!(cx, core::fmt::Formatter)),
|
||||
let fmtr = Ptr(Box::new(Literal(path_std!(cx, core::fmt::Formatter))),
|
||||
Borrowed(None, ast::MutMutable));
|
||||
|
||||
let trait_def = TraitDef {
|
||||
|
|
|
@ -128,7 +128,7 @@ pub fn expand_include<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree
|
|||
}
|
||||
}
|
||||
|
||||
box ExpandResult { p: p }
|
||||
Box::new(ExpandResult { p: p })
|
||||
}
|
||||
|
||||
// include_str! : read the given file, insert it as a literal string expr
|
||||
|
|
|
@ -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()),
|
||||
_ => {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -677,10 +677,10 @@ pub fn noop_fold_interpolated<T: Folder>(nt: token::Nonterminal, fld: &mut T)
|
|||
token::NtPat(pat) => token::NtPat(fld.fold_pat(pat)),
|
||||
token::NtExpr(expr) => token::NtExpr(fld.fold_expr(expr)),
|
||||
token::NtTy(ty) => token::NtTy(fld.fold_ty(ty)),
|
||||
token::NtIdent(box id, is_mod_name) =>
|
||||
token::NtIdent(box fld.fold_ident(id), is_mod_name),
|
||||
token::NtIdent(id, is_mod_name) =>
|
||||
token::NtIdent(Box::new(fld.fold_ident(*id)), is_mod_name),
|
||||
token::NtMeta(meta_item) => token::NtMeta(fld.fold_meta_item(meta_item)),
|
||||
token::NtPath(box path) => token::NtPath(box fld.fold_path(path)),
|
||||
token::NtPath(path) => token::NtPath(Box::new(fld.fold_path(*path))),
|
||||
token::NtTT(tt) => token::NtTT(P(fld.fold_tt(&*tt))),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
|
||||
html_root_url = "http://doc.rust-lang.org/nightly/")]
|
||||
|
||||
#![feature(box_patterns)]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(collections)]
|
||||
#![feature(core)]
|
||||
#![feature(libc)]
|
||||
|
|
|
@ -288,7 +288,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::StringReader::new(&sess.span_diagnostic, filemap);
|
||||
let mut p1 = Parser::new(sess, cfg, box srdr);
|
||||
let mut p1 = Parser::new(sess, cfg, Box::new(srdr));
|
||||
panictry!(p1.parse_all_token_trees())
|
||||
}
|
||||
|
||||
|
@ -297,7 +297,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, None, tts);
|
||||
let mut p = Parser::new(sess, cfg, box trdr);
|
||||
let mut p = Parser::new(sess, cfg, Box::new(trdr));
|
||||
panictry!(p.check_unknown_macro_variable());
|
||||
p
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ pub mod with_hygiene {
|
|||
use super::lexer::make_reader_with_embedded_idents as make_reader;
|
||||
let cfg = Vec::new();
|
||||
let srdr = make_reader(&sess.span_diagnostic, filemap);
|
||||
let mut p1 = Parser::new(sess, cfg, box srdr);
|
||||
let mut p1 = Parser::new(sess, cfg, Box::new(srdr));
|
||||
panictry!(p1.parse_all_token_trees())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -897,7 +897,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 self.token.is_ident() || self.token.is_path() {
|
||||
Some(box self.token.clone())
|
||||
Some(Box::new(self.token.clone()))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
@ -1578,8 +1578,8 @@ impl<'a> Parser<'a> {
|
|||
token::Interpolated(token::NtPath(_)) => Some(try!(self.bump_and_get())),
|
||||
_ => None,
|
||||
};
|
||||
if let Some(token::Interpolated(token::NtPath(box path))) = found {
|
||||
return Ok(path);
|
||||
if let Some(token::Interpolated(token::NtPath(path))) = found {
|
||||
return Ok(*path);
|
||||
}
|
||||
|
||||
let lo = self.span.lo;
|
||||
|
|
|
@ -188,7 +188,7 @@ pub fn to_string<F>(f: F) -> String where
|
|||
F: FnOnce(&mut State) -> io::Result<()>,
|
||||
{
|
||||
use std::raw::TraitObject;
|
||||
let mut s = rust_printer(box Vec::new());
|
||||
let mut s = rust_printer(Box::new(Vec::new()));
|
||||
f(&mut s).unwrap();
|
||||
eof(&mut s.s).unwrap();
|
||||
let wr = unsafe {
|
||||
|
|
|
@ -52,7 +52,7 @@ pub struct P<T> {
|
|||
/// Construct a `P<T>` from a `T` value.
|
||||
pub fn P<T: 'static>(value: T) -> P<T> {
|
||||
P {
|
||||
ptr: box value
|
||||
ptr: Box::new(value)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue