@@ -545,14 +545,14 @@ impl Item {
545
545
pub ( crate ) fn is_associated_type ( & self ) -> bool {
546
546
matches ! ( self . kind, AssocTypeItem ( ..) | StrippedItem ( box AssocTypeItem ( ..) ) )
547
547
}
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 ( ..) ) )
550
550
}
551
551
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 ( .. ) ) ) )
553
553
}
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 ( ..) ) )
556
556
}
557
557
pub ( crate ) fn is_method ( & self ) -> bool {
558
558
self . type_ ( ) == ItemType :: Method
@@ -669,7 +669,9 @@ impl Item {
669
669
asyncness : hir:: IsAsync :: NotAsync ,
670
670
}
671
671
}
672
- ItemKind :: FunctionItem ( _) | ItemKind :: MethodItem ( _, _) | ItemKind :: TyMethodItem ( _) => {
672
+ ItemKind :: FunctionItem ( _)
673
+ | ItemKind :: MethodItem ( _, _)
674
+ | ItemKind :: RequiredMethodItem ( _) => {
673
675
let def_id = self . def_id ( ) . unwrap ( ) ;
674
676
build_fn_header ( def_id, tcx, tcx. asyncness ( def_id) )
675
677
}
@@ -699,8 +701,13 @@ impl Item {
699
701
// Variants always inherit visibility
700
702
VariantItem ( ..) | ImplItem ( ..) => return None ,
701
703
// 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 ( ..) => {
704
711
let assoc_item = tcx. associated_item ( def_id) ;
705
712
let is_trait_item = match assoc_item. container {
706
713
ty:: AssocItemContainer :: Trait => true ,
@@ -845,10 +852,10 @@ pub(crate) enum ItemKind {
845
852
TraitAliasItem ( TraitAlias ) ,
846
853
ImplItem ( Box < Impl > ) ,
847
854
/// A required method in a trait declaration meaning it's only a function signature.
848
- TyMethodItem ( Box < Function > ) ,
855
+ RequiredMethodItem ( Box < Function > ) ,
849
856
/// A method in a trait impl or a provided method in a trait declaration.
850
857
///
851
- /// Compared to [TyMethodItem ], it also contains a method body.
858
+ /// Compared to [RequiredMethodItem ], it also contains a method body.
852
859
MethodItem ( Box < Function > , Option < hir:: Defaultness > ) ,
853
860
StructFieldItem ( Type ) ,
854
861
VariantItem ( Variant ) ,
@@ -862,14 +869,16 @@ pub(crate) enum ItemKind {
862
869
ProcMacroItem ( ProcMacro ) ,
863
870
PrimitiveItem ( PrimitiveType ) ,
864
871
/// A required associated constant in a trait declaration.
865
- TyAssocConstItem ( Generics , Box < Type > ) ,
872
+ RequiredAssocConstItem ( Generics , Box < Type > ) ,
866
873
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 > ) ,
869
878
/// A required associated type in a trait declaration.
870
879
///
871
880
/// The bounds may be non-empty if there is a `where` clause.
872
- TyAssocTypeItem ( Generics , Vec < GenericBound > ) ,
881
+ RequiredAssocTypeItem ( Generics , Vec < GenericBound > ) ,
873
882
/// An associated type in a trait impl or a provided one in a trait declaration.
874
883
AssocTypeItem ( Box < TypeAlias > , Vec < GenericBound > ) ,
875
884
/// An item that has been stripped by a rustdoc pass
@@ -900,7 +909,7 @@ impl ItemKind {
900
909
| StaticItem ( _)
901
910
| ConstantItem ( _)
902
911
| TraitAliasItem ( _)
903
- | TyMethodItem ( _)
912
+ | RequiredMethodItem ( _)
904
913
| MethodItem ( _, _)
905
914
| StructFieldItem ( _)
906
915
| ForeignFunctionItem ( _, _)
@@ -909,9 +918,10 @@ impl ItemKind {
909
918
| MacroItem ( _)
910
919
| ProcMacroItem ( _)
911
920
| PrimitiveItem ( _)
912
- | TyAssocConstItem ( ..)
913
- | AssocConstItem ( ..)
914
- | TyAssocTypeItem ( ..)
921
+ | RequiredAssocConstItem ( ..)
922
+ | ProvidedAssocConstItem ( ..)
923
+ | ImplAssocConstItem ( ..)
924
+ | RequiredAssocTypeItem ( ..)
915
925
| AssocTypeItem ( ..)
916
926
| StrippedItem ( _)
917
927
| KeywordItem => [ ] . iter ( ) ,
0 commit comments