Remove the unboxed closure |:|
notation from types and trait references completely.
This commit is contained in:
parent
221edbae38
commit
d0fa4c6239
17 changed files with 29 additions and 348 deletions
|
@ -53,9 +53,8 @@ use ast::{TtNonterminal, TupleVariantKind, Ty, Ty_, TyBot};
|
|||
use ast::{TypeField, TyFixedLengthVec, TyClosure, TyProc, TyBareFn};
|
||||
use ast::{TyTypeof, TyInfer, TypeMethod};
|
||||
use ast::{TyNil, TyParam, TyParamBound, TyParen, TyPath, TyPtr, TyQPath};
|
||||
use ast::{TyRptr, TyTup, TyU32, TyUnboxedFn, TyUniq, TyVec, UnUniq};
|
||||
use ast::{TyRptr, TyTup, TyU32, TyUniq, TyVec, UnUniq};
|
||||
use ast::{TypeImplItem, TypeTraitItem, Typedef, UnboxedClosureKind};
|
||||
use ast::{UnboxedFnBound, UnboxedFnTy, UnboxedFnTyParamBound};
|
||||
use ast::{UnnamedField, UnsafeBlock};
|
||||
use ast::{UnsafeFn, ViewItem, ViewItem_, ViewItemExternCrate, ViewItemUse};
|
||||
use ast::{ViewPath, ViewPathGlob, ViewPathList, ViewPathSimple};
|
||||
|
@ -1127,19 +1126,16 @@ impl<'a> Parser<'a> {
|
|||
Vec::new()
|
||||
};
|
||||
|
||||
let (optional_unboxed_closure_kind, inputs) = if self.eat(&token::OrOr) {
|
||||
(None, Vec::new())
|
||||
let inputs = if self.eat(&token::OrOr) {
|
||||
Vec::new()
|
||||
} else {
|
||||
self.expect_or();
|
||||
|
||||
let optional_unboxed_closure_kind =
|
||||
self.parse_optional_unboxed_closure_kind();
|
||||
|
||||
let inputs = self.parse_seq_to_before_or(
|
||||
&token::Comma,
|
||||
|p| p.parse_arg_general(false));
|
||||
self.expect_or();
|
||||
(optional_unboxed_closure_kind, inputs)
|
||||
inputs
|
||||
};
|
||||
|
||||
let bounds = self.parse_colon_then_ty_param_bounds();
|
||||
|
@ -1152,23 +1148,13 @@ impl<'a> Parser<'a> {
|
|||
variadic: false
|
||||
});
|
||||
|
||||
match optional_unboxed_closure_kind {
|
||||
Some(unboxed_closure_kind) => {
|
||||
TyUnboxedFn(P(UnboxedFnTy {
|
||||
kind: unboxed_closure_kind,
|
||||
decl: decl,
|
||||
}))
|
||||
}
|
||||
None => {
|
||||
TyClosure(P(ClosureTy {
|
||||
fn_style: fn_style,
|
||||
onceness: onceness,
|
||||
bounds: bounds,
|
||||
decl: decl,
|
||||
lifetimes: lifetime_defs,
|
||||
}))
|
||||
}
|
||||
}
|
||||
TyClosure(P(ClosureTy {
|
||||
fn_style: fn_style,
|
||||
onceness: onceness,
|
||||
bounds: bounds,
|
||||
decl: decl,
|
||||
lifetimes: lifetime_defs,
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn parse_unsafety(&mut self) -> FnStyle {
|
||||
|
@ -3935,31 +3921,11 @@ impl<'a> Parser<'a> {
|
|||
token::ModSep | token::Ident(..) => {
|
||||
let path =
|
||||
self.parse_path(LifetimeAndTypesWithoutColons).path;
|
||||
if self.token == token::OpenDelim(token::Paren) {
|
||||
self.bump();
|
||||
let inputs = self.parse_seq_to_end(
|
||||
&token::CloseDelim(token::Paren),
|
||||
seq_sep_trailing_allowed(token::Comma),
|
||||
|p| p.parse_arg_general(false));
|
||||
let (return_style, output) = self.parse_ret_ty();
|
||||
result.push(UnboxedFnTyParamBound(P(UnboxedFnBound {
|
||||
path: path,
|
||||
decl: P(FnDecl {
|
||||
inputs: inputs,
|
||||
output: output,
|
||||
cf: return_style,
|
||||
variadic: false,
|
||||
}),
|
||||
lifetimes: lifetime_defs,
|
||||
ref_id: ast::DUMMY_NODE_ID,
|
||||
})));
|
||||
} else {
|
||||
result.push(TraitTyParamBound(ast::TraitRef {
|
||||
path: path,
|
||||
ref_id: ast::DUMMY_NODE_ID,
|
||||
lifetimes: lifetime_defs,
|
||||
}))
|
||||
}
|
||||
result.push(TraitTyParamBound(ast::TraitRef {
|
||||
path: path,
|
||||
ref_id: ast::DUMMY_NODE_ID,
|
||||
lifetimes: lifetime_defs,
|
||||
}))
|
||||
}
|
||||
_ => break,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue