@@ -545,14 +545,14 @@ impl Item {
545545 pub ( crate ) fn is_associated_type ( & self ) -> bool {
546546 matches ! ( self . kind, AssocTypeItem ( ..) | StrippedItem ( box AssocTypeItem ( ..) ) )
547547 }
548- pub ( crate ) fn is_ty_associated_type ( & self ) -> bool {
549- matches ! ( self . kind, TyAssocTypeItem ( ..) | StrippedItem ( box TyAssocTypeItem ( ..) ) )
548+ pub ( crate ) fn is_required_associated_type ( & self ) -> bool {
549+ matches ! ( self . kind, RequiredAssocTypeItem ( ..) | StrippedItem ( box RequiredAssocTypeItem ( ..) ) )
550550 }
551551 pub ( crate ) fn is_associated_const ( & self ) -> bool {
552- matches ! ( self . kind, AssocConstItem ( ..) | StrippedItem ( box AssocConstItem ( .. ) ) )
552+ matches ! ( self . kind, ProvidedAssocConstItem ( ..) | ImplAssocConstItem ( .. ) | StrippedItem ( box ( ProvidedAssocConstItem ( .. ) | ImplAssocConstItem ( .. ) ) ) )
553553 }
554- pub ( crate ) fn is_ty_associated_const ( & self ) -> bool {
555- matches ! ( self . kind, TyAssocConstItem ( ..) | StrippedItem ( box TyAssocConstItem ( ..) ) )
554+ pub ( crate ) fn is_required_associated_const ( & self ) -> bool {
555+ matches ! ( self . kind, RequiredAssocConstItem ( ..) | StrippedItem ( box RequiredAssocConstItem ( ..) ) )
556556 }
557557 pub ( crate ) fn is_method ( & self ) -> bool {
558558 self . type_ ( ) == ItemType :: Method
@@ -669,7 +669,9 @@ impl Item {
669669 asyncness : hir:: IsAsync :: NotAsync ,
670670 }
671671 }
672- ItemKind :: FunctionItem ( _) | ItemKind :: MethodItem ( _, _) | ItemKind :: TyMethodItem ( _) => {
672+ ItemKind :: FunctionItem ( _)
673+ | ItemKind :: MethodItem ( _, _)
674+ | ItemKind :: RequiredMethodItem ( _) => {
673675 let def_id = self . def_id ( ) . unwrap ( ) ;
674676 build_fn_header ( def_id, tcx, tcx. asyncness ( def_id) )
675677 }
@@ -699,8 +701,13 @@ impl Item {
699701 // Variants always inherit visibility
700702 VariantItem ( ..) | ImplItem ( ..) => return None ,
701703 // Trait items inherit the trait's visibility
702- AssocConstItem ( ..) | TyAssocConstItem ( ..) | AssocTypeItem ( ..) | TyAssocTypeItem ( ..)
703- | TyMethodItem ( ..) | MethodItem ( ..) => {
704+ RequiredAssocConstItem ( ..)
705+ | ProvidedAssocConstItem ( ..)
706+ | ImplAssocConstItem ( ..)
707+ | AssocTypeItem ( ..)
708+ | RequiredAssocTypeItem ( ..)
709+ | RequiredMethodItem ( ..)
710+ | MethodItem ( ..) => {
704711 let assoc_item = tcx. associated_item ( def_id) ;
705712 let is_trait_item = match assoc_item. container {
706713 ty:: AssocItemContainer :: Trait => true ,
@@ -845,10 +852,10 @@ pub(crate) enum ItemKind {
845852 TraitAliasItem ( TraitAlias ) ,
846853 ImplItem ( Box < Impl > ) ,
847854 /// A required method in a trait declaration meaning it's only a function signature.
848- TyMethodItem ( Box < Function > ) ,
855+ RequiredMethodItem ( Box < Function > ) ,
849856 /// A method in a trait impl or a provided method in a trait declaration.
850857 ///
851- /// Compared to [TyMethodItem ], it also contains a method body.
858+ /// Compared to [RequiredMethodItem ], it also contains a method body.
852859 MethodItem ( Box < Function > , Option < hir:: Defaultness > ) ,
853860 StructFieldItem ( Type ) ,
854861 VariantItem ( Variant ) ,
@@ -862,14 +869,16 @@ pub(crate) enum ItemKind {
862869 ProcMacroItem ( ProcMacro ) ,
863870 PrimitiveItem ( PrimitiveType ) ,
864871 /// A required associated constant in a trait declaration.
865- TyAssocConstItem ( Generics , Box < Type > ) ,
872+ RequiredAssocConstItem ( Generics , Box < Type > ) ,
866873 ConstantItem ( Box < Constant > ) ,
867- /// An associated constant in a trait impl or a provided one in a trait declaration.
868- AssocConstItem ( Box < Constant > ) ,
874+ /// An associated constant in a trait declaration with provided default value.
875+ ProvidedAssocConstItem ( Box < Constant > ) ,
876+ /// An associated constant in an inherent impl or trait impl.
877+ ImplAssocConstItem ( Box < Constant > ) ,
869878 /// A required associated type in a trait declaration.
870879 ///
871880 /// The bounds may be non-empty if there is a `where` clause.
872- TyAssocTypeItem ( Generics , Vec < GenericBound > ) ,
881+ RequiredAssocTypeItem ( Generics , Vec < GenericBound > ) ,
873882 /// An associated type in a trait impl or a provided one in a trait declaration.
874883 AssocTypeItem ( Box < TypeAlias > , Vec < GenericBound > ) ,
875884 /// An item that has been stripped by a rustdoc pass
@@ -900,7 +909,7 @@ impl ItemKind {
900909 | StaticItem ( _)
901910 | ConstantItem ( _)
902911 | TraitAliasItem ( _)
903- | TyMethodItem ( _)
912+ | RequiredMethodItem ( _)
904913 | MethodItem ( _, _)
905914 | StructFieldItem ( _)
906915 | ForeignFunctionItem ( _, _)
@@ -909,9 +918,10 @@ impl ItemKind {
909918 | MacroItem ( _)
910919 | ProcMacroItem ( _)
911920 | PrimitiveItem ( _)
912- | TyAssocConstItem ( ..)
913- | AssocConstItem ( ..)
914- | TyAssocTypeItem ( ..)
921+ | RequiredAssocConstItem ( ..)
922+ | ProvidedAssocConstItem ( ..)
923+ | ImplAssocConstItem ( ..)
924+ | RequiredAssocTypeItem ( ..)
915925 | AssocTypeItem ( ..)
916926 | StrippedItem ( _)
917927 | KeywordItem => [ ] . iter ( ) ,
0 commit comments