@@ -55,7 +55,8 @@ use ast::{TyTypeof, TyInfer, TypeMethod};
55
55
use ast:: { TyNil , TyParam , TyParamBound , TyParen , TyPath , TyPtr , TyQPath } ;
56
56
use ast:: { TyRptr , TyTup , TyU32 , TyUnboxedFn , TyUniq , TyVec , UnUniq } ;
57
57
use ast:: { TypeImplItem , TypeTraitItem , Typedef , UnboxedClosureKind } ;
58
- use ast:: { UnboxedFnTy , UnboxedFnTyParamBound , UnnamedField , UnsafeBlock } ;
58
+ use ast:: { UnboxedFnBound , UnboxedFnTy , UnboxedFnTyParamBound } ;
59
+ use ast:: { UnnamedField , UnsafeBlock } ;
59
60
use ast:: { UnsafeFn , ViewItem , ViewItem_ , ViewItemExternCrate , ViewItemUse } ;
60
61
use ast:: { ViewPath , ViewPathGlob , ViewPathList , ViewPathSimple } ;
61
62
use ast:: { Visibility , WhereClause , WherePredicate } ;
@@ -3666,39 +3667,6 @@ impl<'a> Parser<'a> {
3666
3667
} )
3667
3668
}
3668
3669
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
-
3702
3670
// Parses a sequence of bounds if a `:` is found,
3703
3671
// otherwise returns empty list.
3704
3672
fn parse_colon_then_ty_param_bounds ( & mut self )
@@ -3730,13 +3698,31 @@ impl<'a> Parser<'a> {
3730
3698
self . bump ( ) ;
3731
3699
}
3732
3700
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
+ }
3740
3726
}
3741
3727
_ => break ,
3742
3728
}
@@ -4423,14 +4409,6 @@ impl<'a> Parser<'a> {
4423
4409
Some ( attrs) )
4424
4410
}
4425
4411
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
-
4434
4412
/// Parse struct Foo { ... }
4435
4413
fn parse_item_struct ( & mut self , is_virtual : bool ) -> ItemInfo {
4436
4414
let class_name = self . parse_ident ( ) ;
0 commit comments