diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2014-11-04 16:25:15 -0500 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2014-11-06 06:48:24 -0500 |
| commit | d0fa4c6239accc08aae11d9db3e13d4153add432 (patch) | |
| tree | 6acb078eaf06ad01af0b2849cba93131f82411ee /src/libsyntax/parse | |
| parent | 221edbae3843848047825701e25b6f9d8b096075 (diff) | |
| download | rust-d0fa4c6239accc08aae11d9db3e13d4153add432.tar.gz rust-d0fa4c6239accc08aae11d9db3e13d4153add432.zip | |
Remove the unboxed closure `|:|` notation from types and trait references completely.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 66 |
1 files changed, 16 insertions, 50 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 1c65a47350e..18dd7074d28 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -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, } |
