File tree 1 file changed +8
-8
lines changed
1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -1761,27 +1761,27 @@ impl<'a> Parser<'a> {
1761
1761
pub fn parse_arg_general ( & mut self , require_name : bool ) -> PResult < ' a , Arg > {
1762
1762
maybe_whole ! ( self , NtArg , |x| x) ;
1763
1763
1764
- let pat = if require_name || self . is_named_argument ( ) {
1764
+ let ( pat, ty ) = if require_name || self . is_named_argument ( ) {
1765
1765
debug ! ( "parse_arg_general parse_pat (require_name:{})" ,
1766
1766
require_name) ;
1767
1767
let pat = self . parse_pat ( ) ?;
1768
1768
1769
1769
self . expect ( & token:: Colon ) ?;
1770
- pat
1770
+ ( pat, self . parse_ty ( ) ? )
1771
1771
} else {
1772
1772
debug ! ( "parse_arg_general ident_to_pat" ) ;
1773
1773
let ident = Ident :: new ( keywords:: Invalid . name ( ) , self . prev_span ) ;
1774
- P ( Pat {
1774
+ let ty = self . parse_ty ( ) ?;
1775
+ let pat = P ( Pat {
1775
1776
id : ast:: DUMMY_NODE_ID ,
1776
1777
node : PatKind :: Ident ( BindingMode :: ByValue ( Mutability :: Immutable ) , ident, None ) ,
1777
- span : ident. span ,
1778
- } )
1778
+ span : ty. span ,
1779
+ } ) ;
1780
+ ( pat, ty)
1779
1781
} ;
1780
1782
1781
- let t = self . parse_ty ( ) ?;
1782
-
1783
1783
Ok ( Arg {
1784
- ty : t ,
1784
+ ty,
1785
1785
pat,
1786
1786
id : ast:: DUMMY_NODE_ID ,
1787
1787
} )
You can’t perform that action at this time.
0 commit comments