@@ -405,11 +405,14 @@ impl TokenType {
405405 }
406406}
407407
408- // Returns true if `IDENT t` can start a type - `IDENT::a::b`, `IDENT<u8, u8>`,
409- // `IDENT<<u8 as Trait>::AssocTy>`, `IDENT(u8, u8) -> u8`.
410- fn can_continue_type_after_ident ( t : & token:: Token ) -> bool {
408+ /// Returns true if `IDENT t` can start a type - `IDENT::a::b`, `IDENT<u8, u8>`,
409+ /// `IDENT<<u8 as Trait>::AssocTy>`.
410+ ///
411+ /// Types can also be of the form `IDENT(u8, u8) -> u8`, however this assumes
412+ /// that IDENT is not the ident of a fn trait
413+ fn can_continue_type_after_non_fn_ident ( t : & token:: Token ) -> bool {
411414 t == & token:: ModSep || t == & token:: Lt ||
412- t == & token:: BinOp ( token:: Shl ) || t == & token :: OpenDelim ( token :: Paren )
415+ t == & token:: BinOp ( token:: Shl )
413416}
414417
415418/// Information about the path to a module.
@@ -1619,7 +1622,8 @@ impl<'a> Parser<'a> {
16191622 impl_dyn_multi = bounds. len ( ) > 1 || self . prev_token_kind == PrevTokenKind :: Plus ;
16201623 TyKind :: ImplTrait ( bounds)
16211624 } else if self . check_keyword ( keywords:: Dyn ) &&
1622- self . look_ahead ( 1 , |t| t. can_begin_bound ( ) && !can_continue_type_after_ident ( t) ) {
1625+ self . look_ahead ( 1 , |t| t. can_begin_bound ( ) &&
1626+ !can_continue_type_after_non_fn_ident ( t) ) {
16231627 self . bump ( ) ; // `dyn`
16241628 // Always parse bounds greedily for better error recovery.
16251629 let bounds = self . parse_ty_param_bounds ( ) ?;
0 commit comments