@@ -18,7 +18,7 @@ use tracing::{debug, instrument, trace};
1818
1919use super :: { Item , extract_cfg_from_attrs} ;
2020use crate :: clean:: {
21- self , Attributes , CfgInfo , ImplKind , ItemId , Type , clean_bound_vars, clean_generics,
21+ self , Attributes , CfgInfo , ImplKind , ItemId , ItemKind , Type , clean_bound_vars, clean_generics,
2222 clean_impl_item, clean_middle_assoc_item, clean_middle_field, clean_middle_ty,
2323 clean_poly_fn_sig, clean_trait_ref_with_constraints, clean_ty, clean_ty_alias_inner_type,
2424 clean_ty_generics, clean_variant_def, utils,
@@ -47,7 +47,7 @@ pub(crate) fn try_inline(
4747) -> Option < Vec < clean:: Item > > {
4848 fn try_inline_inner (
4949 cx : & mut DocContext < ' _ > ,
50- kind : clean :: ItemKind ,
50+ kind : ItemKind ,
5151 did : DefId ,
5252 name : Symbol ,
5353 import_def_id : Option < LocalDefId > ,
@@ -87,52 +87,52 @@ pub(crate) fn try_inline(
8787 record_extern_fqn ( cx, did, ItemType :: Trait ) ;
8888 cx. with_param_env ( did, |cx| {
8989 build_impls ( cx, did, attrs_without_docs, & mut ret) ;
90- clean :: TraitItem ( Box :: new ( build_trait ( cx, did) ) )
90+ ItemKind :: Trait ( Box :: new ( build_trait ( cx, did) ) )
9191 } )
9292 }
9393 Res :: Def ( DefKind :: TraitAlias , did) => {
9494 record_extern_fqn ( cx, did, ItemType :: TraitAlias ) ;
95- cx. with_param_env ( did, |cx| clean :: TraitAliasItem ( build_trait_alias ( cx, did) ) )
95+ cx. with_param_env ( did, |cx| ItemKind :: TraitAlias ( build_trait_alias ( cx, did) ) )
9696 }
9797 Res :: Def ( DefKind :: Fn , did) => {
9898 record_extern_fqn ( cx, did, ItemType :: Function ) ;
9999 cx. with_param_env ( did, |cx| {
100- clean:: enter_impl_trait ( cx, |cx| clean :: FunctionItem ( build_function ( cx, did) ) )
100+ clean:: enter_impl_trait ( cx, |cx| ItemKind :: Fn ( build_function ( cx, did) ) )
101101 } )
102102 }
103103 Res :: Def ( DefKind :: Struct , did) => {
104104 record_extern_fqn ( cx, did, ItemType :: Struct ) ;
105105 cx. with_param_env ( did, |cx| {
106106 build_impls ( cx, did, attrs_without_docs, & mut ret) ;
107- clean :: StructItem ( build_struct ( cx, did) )
107+ ItemKind :: Struct ( build_struct ( cx, did) )
108108 } )
109109 }
110110 Res :: Def ( DefKind :: Union , did) => {
111111 record_extern_fqn ( cx, did, ItemType :: Union ) ;
112112 cx. with_param_env ( did, |cx| {
113113 build_impls ( cx, did, attrs_without_docs, & mut ret) ;
114- clean :: UnionItem ( build_union ( cx, did) )
114+ ItemKind :: Union ( build_union ( cx, did) )
115115 } )
116116 }
117117 Res :: Def ( DefKind :: TyAlias , did) => {
118118 record_extern_fqn ( cx, did, ItemType :: TypeAlias ) ;
119119 cx. with_param_env ( did, |cx| {
120120 build_impls ( cx, did, attrs_without_docs, & mut ret) ;
121- clean :: TypeAliasItem ( build_type_alias ( cx, did, & mut ret) )
121+ ItemKind :: TyAlias ( build_type_alias ( cx, did, & mut ret) )
122122 } )
123123 }
124124 Res :: Def ( DefKind :: Enum , did) => {
125125 record_extern_fqn ( cx, did, ItemType :: Enum ) ;
126126 cx. with_param_env ( did, |cx| {
127127 build_impls ( cx, did, attrs_without_docs, & mut ret) ;
128- clean :: EnumItem ( build_enum ( cx, did) )
128+ ItemKind :: Enum ( build_enum ( cx, did) )
129129 } )
130130 }
131131 Res :: Def ( DefKind :: ForeignTy , did) => {
132132 record_extern_fqn ( cx, did, ItemType :: ForeignType ) ;
133133 cx. with_param_env ( did, |cx| {
134134 build_impls ( cx, did, attrs_without_docs, & mut ret) ;
135- clean :: ForeignTypeItem
135+ ItemKind :: ForeignTy
136136 } )
137137 }
138138 // Never inline enum variants but leave them shown as re-exports.
@@ -142,19 +142,19 @@ pub(crate) fn try_inline(
142142 Res :: Def ( DefKind :: Ctor ( ..) , _) | Res :: SelfCtor ( ..) => return Some ( Vec :: new ( ) ) ,
143143 Res :: Def ( DefKind :: Mod , did) => {
144144 record_extern_fqn ( cx, did, ItemType :: Module ) ;
145- clean :: ModuleItem ( build_module ( cx, did, name, visited) )
145+ ItemKind :: Module ( build_module ( cx, did, name, visited) )
146146 }
147147 Res :: Def ( DefKind :: Static { .. } , did) => {
148148 record_extern_fqn ( cx, did, ItemType :: Static ) ;
149149 cx. with_param_env ( did, |cx| {
150- clean :: StaticItem ( build_static ( cx, did, cx. tcx . is_mutable_static ( did) ) )
150+ ItemKind :: Static ( build_static ( cx, did, cx. tcx . is_mutable_static ( did) ) )
151151 } )
152152 }
153153 Res :: Def ( DefKind :: Const , did) => {
154154 record_extern_fqn ( cx, did, ItemType :: Constant ) ;
155155 cx. with_param_env ( did, |cx| {
156156 let ct = build_const_item ( cx, did) ;
157- clean :: ConstantItem ( Box :: new ( ct) )
157+ ItemKind :: Const ( Box :: new ( ct) )
158158 } )
159159 }
160160 Res :: Def ( DefKind :: Macro ( kinds) , did) => {
@@ -388,12 +388,7 @@ fn build_type_alias(
388388 let type_ = clean_middle_ty ( ty:: Binder :: dummy ( ty) , cx, Some ( did) , None ) ;
389389 let inner_type = clean_ty_alias_inner_type ( ty, cx, ret) ;
390390
391- Box :: new ( clean:: TypeAlias {
392- type_,
393- generics : clean_ty_generics ( cx, did) ,
394- inner_type,
395- item_type : None ,
396- } )
391+ Box :: new ( clean:: TypeAlias { type_, generics : clean_ty_generics ( cx, did) , inner_type } )
397392}
398393
399394/// Builds all inherent implementations of an ADT (struct/union/enum) or Trait item/path/reexport.
@@ -650,7 +645,7 @@ pub(crate) fn build_impl(
650645 ret. push ( clean:: Item :: from_def_id_and_attrs_and_parts (
651646 did,
652647 None ,
653- clean :: ImplItem ( Box :: new ( clean:: Impl {
648+ ItemKind :: Impl ( Box :: new ( clean:: Impl {
654649 safety : hir:: Safety :: Safe ,
655650 generics,
656651 trait_,
@@ -756,7 +751,7 @@ fn build_module_items(
756751 item_id : ItemId :: DefId ( module_def_id) ,
757752 attrs : Default :: default ( ) ,
758753 stability : None ,
759- kind : clean :: ImportItem ( clean:: Import :: new_simple (
754+ kind : ItemKind :: Import ( clean:: Import :: new_simple (
760755 item. ident . name ,
761756 clean:: ImportSource {
762757 path : clean:: Path {
@@ -795,7 +790,7 @@ fn build_module_items(
795790 let item = Item :: from_def_id_and_parts (
796791 module_def_id,
797792 None ,
798- clean :: ImportItem ( clean:: Import :: new_simple (
793+ ItemKind :: Import ( clean:: Import :: new_simple (
799794 item. ident . name ,
800795 clean:: ImportSource {
801796 path : clean:: Path {
@@ -850,7 +845,7 @@ fn build_const_item(cx: &mut DocContext<'_>, def_id: DefId) -> clean::Constant {
850845 None ,
851846 None ,
852847 ) ;
853- clean:: Constant { generics, type_ : ty, kind : clean:: ConstantKind :: Extern { def_id } }
848+ clean:: Constant { generics, ty, rhs : clean:: ConstantKind :: Extern { def_id } }
854849}
855850
856851fn build_static ( cx : & mut DocContext < ' _ > , did : DefId , mutable : bool ) -> clean:: Static {
@@ -866,23 +861,17 @@ fn build_static(cx: &mut DocContext<'_>, did: DefId, mutable: bool) -> clean::St
866861 }
867862}
868863
869- fn build_macro (
870- tcx : TyCtxt < ' _ > ,
871- def_id : DefId ,
872- name : Symbol ,
873- macro_kinds : MacroKinds ,
874- ) -> clean:: ItemKind {
864+ fn build_macro ( tcx : TyCtxt < ' _ > , def_id : DefId , name : Symbol , macro_kinds : MacroKinds ) -> ItemKind {
875865 match CStore :: from_tcx ( tcx) . load_macro_untracked ( tcx, def_id) {
876866 LoadedMacro :: MacroDef { def, .. } => match macro_kinds {
877- MacroKinds :: DERIVE => clean :: ProcMacroItem ( clean:: ProcMacro {
867+ MacroKinds :: DERIVE => ItemKind :: ProcMacro ( clean:: ProcMacro {
878868 kind : MacroKind :: Derive ,
879869 helpers : Vec :: new ( ) ,
880870 } ) ,
881- MacroKinds :: ATTR => clean:: ProcMacroItem ( clean:: ProcMacro {
882- kind : MacroKind :: Attr ,
883- helpers : Vec :: new ( ) ,
884- } ) ,
885- _ => clean:: MacroItem (
871+ MacroKinds :: ATTR => {
872+ ItemKind :: ProcMacro ( clean:: ProcMacro { kind : MacroKind :: Attr , helpers : Vec :: new ( ) } )
873+ }
874+ _ => ItemKind :: DeclMacro (
886875 clean:: Macro {
887876 source : utils:: display_macro_source ( tcx, name, & def) ,
888877 macro_rules : def. macro_rules ,
@@ -898,7 +887,7 @@ fn build_macro(
898887 MacroKinds :: DERIVE => MacroKind :: Derive ,
899888 _ => unreachable ! ( ) ,
900889 } ;
901- clean :: ProcMacroItem ( clean:: ProcMacro { kind, helpers : ext. helper_attrs } )
890+ ItemKind :: ProcMacro ( clean:: ProcMacro { kind, helpers : ext. helper_attrs } )
902891 }
903892 }
904893}
0 commit comments