@@ -55,7 +55,8 @@ use ast::{TyTypeof, TyInfer, TypeMethod};
5555use ast:: { TyNil , TyParam , TyParamBound , TyParen , TyPath , TyPtr , TyQPath } ;
5656use ast:: { TyRptr , TyTup , TyU32 , TyUnboxedFn , TyUniq , TyVec , UnUniq } ;
5757use ast:: { TypeImplItem , TypeTraitItem , Typedef , UnboxedClosureKind } ;
58- use ast:: { UnboxedFnTy , UnboxedFnTyParamBound , UnnamedField , UnsafeBlock } ;
58+ use ast:: { UnboxedFnBound , UnboxedFnTy , UnboxedFnTyParamBound } ;
59+ use ast:: { UnnamedField , UnsafeBlock } ;
5960use ast:: { UnsafeFn , ViewItem , ViewItem_ , ViewItemExternCrate , ViewItemUse } ;
6061use ast:: { ViewPath , ViewPathGlob , ViewPathList , ViewPathSimple } ;
6162use ast:: { Visibility , WhereClause , WherePredicate } ;
@@ -3666,39 +3667,6 @@ impl<'a> Parser<'a> {
36663667 } )
36673668 }
36683669
3669- fn parse_unboxed_function_type ( & mut self ) -> UnboxedFnTy {
3670- let ( optional_unboxed_closure_kind, inputs) =
3671- if self . eat ( & token:: OROR ) {
3672- ( None , Vec :: new ( ) )
3673- } else {
3674- self . expect_or ( ) ;
3675-
3676- let optional_unboxed_closure_kind =
3677- self . parse_optional_unboxed_closure_kind ( ) ;
3678-
3679- let inputs = self . parse_seq_to_before_or ( & token:: COMMA ,
3680- |p| {
3681- p. parse_arg_general ( false )
3682- } ) ;
3683- self . expect_or ( ) ;
3684- ( optional_unboxed_closure_kind, inputs)
3685- } ;
3686-
3687- let ( return_style, output) = self . parse_ret_ty ( ) ;
3688- UnboxedFnTy {
3689- decl : P ( FnDecl {
3690- inputs : inputs,
3691- output : output,
3692- cf : return_style,
3693- variadic : false ,
3694- } ) ,
3695- kind : match optional_unboxed_closure_kind {
3696- Some ( kind) => kind,
3697- None => FnMutUnboxedClosureKind ,
3698- } ,
3699- }
3700- }
3701-
37023670 // Parses a sequence of bounds if a `:` is found,
37033671 // otherwise returns empty list.
37043672 fn parse_colon_then_ty_param_bounds ( & mut self )
@@ -3730,13 +3698,31 @@ impl<'a> Parser<'a> {
37303698 self . bump ( ) ;
37313699 }
37323700 token:: MOD_SEP | token:: IDENT ( ..) => {
3733- let tref = self . parse_trait_ref ( ) ;
3734- result. push ( TraitTyParamBound ( tref) ) ;
3735- }
3736- token:: BINOP ( token:: OR ) | token:: OROR => {
3737- let unboxed_function_type =
3738- self . parse_unboxed_function_type ( ) ;
3739- result. push ( UnboxedFnTyParamBound ( unboxed_function_type) ) ;
3701+ let path =
3702+ self . parse_path ( LifetimeAndTypesWithoutColons ) . path ;
3703+ if self . token == token:: LPAREN {
3704+ self . bump ( ) ;
3705+ let inputs = self . parse_seq_to_end (
3706+ & token:: RPAREN ,
3707+ seq_sep_trailing_allowed ( token:: COMMA ) ,
3708+ |p| p. parse_arg_general ( false ) ) ;
3709+ let ( return_style, output) = self . parse_ret_ty ( ) ;
3710+ result. push ( UnboxedFnTyParamBound ( P ( UnboxedFnBound {
3711+ path : path,
3712+ decl : P ( FnDecl {
3713+ inputs : inputs,
3714+ output : output,
3715+ cf : return_style,
3716+ variadic : false ,
3717+ } ) ,
3718+ ref_id : ast:: DUMMY_NODE_ID ,
3719+ } ) ) ) ;
3720+ } else {
3721+ result. push ( TraitTyParamBound ( ast:: TraitRef {
3722+ path : path,
3723+ ref_id : ast:: DUMMY_NODE_ID ,
3724+ } ) )
3725+ }
37403726 }
37413727 _ => break ,
37423728 }
@@ -4423,14 +4409,6 @@ impl<'a> Parser<'a> {
44234409 Some ( attrs) )
44244410 }
44254411
4426- /// Parse a::B<String,int>
4427- fn parse_trait_ref ( & mut self ) -> TraitRef {
4428- ast:: TraitRef {
4429- path : self . parse_path ( LifetimeAndTypesWithoutColons ) . path ,
4430- ref_id : ast:: DUMMY_NODE_ID ,
4431- }
4432- }
4433-
44344412 /// Parse struct Foo { ... }
44354413 fn parse_item_struct ( & mut self , is_virtual : bool ) -> ItemInfo {
44364414 let class_name = self . parse_ident ( ) ;
0 commit comments