@@ -698,7 +698,7 @@ impl<'a> Parser<'a> {
698
698
let vis = self . parse_visibility ( FollowedByType :: No ) ?;
699
699
let defaultness = self . parse_defaultness ( ) ;
700
700
let ( name, kind, generics) = if self . eat_keyword ( kw:: Type ) {
701
- self . parse_impl_assoc_ty ( ) ?
701
+ self . parse_assoc_ty ( ) ?
702
702
} else if self . is_const_item ( ) {
703
703
self . parse_assoc_const ( ) ?
704
704
} else if let Some ( mac) = self . parse_assoc_macro_invoc ( "impl" , Some ( & vis) , at_end) ? {
@@ -750,31 +750,6 @@ impl<'a> Parser<'a> {
750
750
!self . is_keyword_ahead ( 1 , & [ kw:: Fn , kw:: Unsafe ] )
751
751
}
752
752
753
- /// Parses the following grammar:
754
- ///
755
- /// AssocTy = Ident ["<"...">"] [":" [GenericBounds]] ["where" ...] ["=" Ty]
756
- fn parse_impl_assoc_ty ( & mut self ) -> PResult < ' a , ( Ident , ImplItemKind , Generics ) > {
757
- let ident = self . parse_ident ( ) ?;
758
- let mut generics = self . parse_generics ( ) ?;
759
-
760
- // Parse optional colon and param bounds.
761
- let bounds = if self . eat ( & token:: Colon ) {
762
- self . parse_generic_bounds ( None ) ?
763
- } else {
764
- Vec :: new ( )
765
- } ;
766
- generics. where_clause = self . parse_where_clause ( ) ?;
767
-
768
- let default = if self . eat ( & token:: Eq ) {
769
- Some ( self . parse_ty ( ) ?)
770
- } else {
771
- None
772
- } ;
773
- self . expect_semi ( ) ?;
774
-
775
- Ok ( ( ident, ImplItemKind :: TyAlias ( bounds, default) , generics) )
776
- }
777
-
778
753
/// Parses `auto? trait Foo { ... }` or `trait Foo = Bar;`.
779
754
fn parse_item_trait ( & mut self , lo : Span , unsafety : Unsafety ) -> PResult < ' a , ItemInfo > {
780
755
// Parse optional `auto` prefix.
@@ -894,7 +869,7 @@ impl<'a> Parser<'a> {
894
869
let vis = self . parse_visibility ( FollowedByType :: No ) ?;
895
870
let defaultness = self . parse_defaultness ( ) ;
896
871
let ( name, kind, generics) = if self . eat_keyword ( kw:: Type ) {
897
- self . parse_trait_item_assoc_ty ( ) ?
872
+ self . parse_assoc_ty ( ) ?
898
873
} else if self . is_const_item ( ) {
899
874
self . parse_assoc_const ( ) ?
900
875
} else if let Some ( mac) = self . parse_assoc_macro_invoc ( "trait" , None , & mut false ) ? {
@@ -937,7 +912,7 @@ impl<'a> Parser<'a> {
937
912
/// Parses the following grammar:
938
913
///
939
914
/// AssocTy = Ident ["<"...">"] [":" [GenericBounds]] ["where" ...] ["=" Ty]
940
- fn parse_trait_item_assoc_ty ( & mut self ) -> PResult < ' a , ( Ident , TraitItemKind , Generics ) > {
915
+ fn parse_assoc_ty ( & mut self ) -> PResult < ' a , ( Ident , AssocItemKind , Generics ) > {
941
916
let ident = self . parse_ident ( ) ?;
942
917
let mut generics = self . parse_generics ( ) ?;
943
918
@@ -956,7 +931,7 @@ impl<'a> Parser<'a> {
956
931
} ;
957
932
self . expect_semi ( ) ?;
958
933
959
- Ok ( ( ident, TraitItemKind :: TyAlias ( bounds, default) , generics) )
934
+ Ok ( ( ident, AssocItemKind :: TyAlias ( bounds, default) , generics) )
960
935
}
961
936
962
937
/// Parses a `UseTree`.
0 commit comments