@@ -1222,22 +1222,24 @@ fn clean_trait_item<'tcx>(trait_item: &hir::TraitItem<'tcx>, cx: &mut DocContext
12221222 let local_did = trait_item. owner_id . to_def_id ( ) ;
12231223 cx. with_param_env ( local_did, |cx| {
12241224 let inner = match trait_item. kind {
1225- hir:: TraitItemKind :: Const ( ty, Some ( default) ) => AssocConstItem ( Box :: new ( Constant {
1226- generics : enter_impl_trait ( cx, |cx| clean_generics ( trait_item. generics , cx) ) ,
1227- kind : ConstantKind :: Local { def_id : local_did, body : default } ,
1228- type_ : clean_ty ( ty, cx) ,
1229- } ) ) ,
1225+ hir:: TraitItemKind :: Const ( ty, Some ( default) ) => {
1226+ ProvidedAssocConstItem ( Box :: new ( Constant {
1227+ generics : enter_impl_trait ( cx, |cx| clean_generics ( trait_item. generics , cx) ) ,
1228+ kind : ConstantKind :: Local { def_id : local_did, body : default } ,
1229+ type_ : clean_ty ( ty, cx) ,
1230+ } ) )
1231+ }
12301232 hir:: TraitItemKind :: Const ( ty, None ) => {
12311233 let generics = enter_impl_trait ( cx, |cx| clean_generics ( trait_item. generics , cx) ) ;
1232- TyAssocConstItem ( generics, Box :: new ( clean_ty ( ty, cx) ) )
1234+ RequiredAssocConstItem ( generics, Box :: new ( clean_ty ( ty, cx) ) )
12331235 }
12341236 hir:: TraitItemKind :: Fn ( ref sig, hir:: TraitFn :: Provided ( body) ) => {
12351237 let m = clean_function ( cx, sig, trait_item. generics , FunctionArgs :: Body ( body) ) ;
12361238 MethodItem ( m, None )
12371239 }
12381240 hir:: TraitItemKind :: Fn ( ref sig, hir:: TraitFn :: Required ( names) ) => {
12391241 let m = clean_function ( cx, sig, trait_item. generics , FunctionArgs :: Names ( names) ) ;
1240- TyMethodItem ( m)
1242+ RequiredMethodItem ( m)
12411243 }
12421244 hir:: TraitItemKind :: Type ( bounds, Some ( default) ) => {
12431245 let generics = enter_impl_trait ( cx, |cx| clean_generics ( trait_item. generics , cx) ) ;
@@ -1257,7 +1259,7 @@ fn clean_trait_item<'tcx>(trait_item: &hir::TraitItem<'tcx>, cx: &mut DocContext
12571259 hir:: TraitItemKind :: Type ( bounds, None ) => {
12581260 let generics = enter_impl_trait ( cx, |cx| clean_generics ( trait_item. generics , cx) ) ;
12591261 let bounds = bounds. iter ( ) . filter_map ( |x| clean_generic_bound ( x, cx) ) . collect ( ) ;
1260- TyAssocTypeItem ( generics, bounds)
1262+ RequiredAssocTypeItem ( generics, bounds)
12611263 }
12621264 } ;
12631265 Item :: from_def_id_and_parts ( local_did, Some ( trait_item. ident . name ) , inner, cx)
@@ -1271,7 +1273,7 @@ pub(crate) fn clean_impl_item<'tcx>(
12711273 let local_did = impl_. owner_id . to_def_id ( ) ;
12721274 cx. with_param_env ( local_did, |cx| {
12731275 let inner = match impl_. kind {
1274- hir:: ImplItemKind :: Const ( ty, expr) => AssocConstItem ( Box :: new ( Constant {
1276+ hir:: ImplItemKind :: Const ( ty, expr) => ImplAssocConstItem ( Box :: new ( Constant {
12751277 generics : clean_generics ( impl_. generics , cx) ,
12761278 kind : ConstantKind :: Local { def_id : local_did, body : expr } ,
12771279 type_ : clean_ty ( ty, cx) ,
@@ -1320,18 +1322,23 @@ pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocCo
13201322 ) ;
13211323 simplify:: move_bounds_to_generic_parameters ( & mut generics) ;
13221324
1323- let provided = match assoc_item. container {
1324- ty:: AssocItemContainer :: Impl => true ,
1325- ty:: AssocItemContainer :: Trait => tcx. defaultness ( assoc_item. def_id ) . has_value ( ) ,
1326- } ;
1327- if provided {
1328- AssocConstItem ( Box :: new ( Constant {
1325+ match assoc_item. container {
1326+ ty:: AssocItemContainer :: Impl => ImplAssocConstItem ( Box :: new ( Constant {
13291327 generics,
13301328 kind : ConstantKind :: Extern { def_id : assoc_item. def_id } ,
13311329 type_ : ty,
1332- } ) )
1333- } else {
1334- TyAssocConstItem ( generics, Box :: new ( ty) )
1330+ } ) ) ,
1331+ ty:: AssocItemContainer :: Trait => {
1332+ if tcx. defaultness ( assoc_item. def_id ) . has_value ( ) {
1333+ ProvidedAssocConstItem ( Box :: new ( Constant {
1334+ generics,
1335+ kind : ConstantKind :: Extern { def_id : assoc_item. def_id } ,
1336+ type_ : ty,
1337+ } ) )
1338+ } else {
1339+ RequiredAssocConstItem ( generics, Box :: new ( ty) )
1340+ }
1341+ }
13351342 }
13361343 }
13371344 ty:: AssocKind :: Fn => {
@@ -1369,7 +1376,7 @@ pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocCo
13691376 } ;
13701377 MethodItem ( item, defaultness)
13711378 } else {
1372- TyMethodItem ( item)
1379+ RequiredMethodItem ( item)
13731380 }
13741381 }
13751382 ty:: AssocKind :: Type => {
@@ -1486,7 +1493,7 @@ pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocCo
14861493 bounds,
14871494 )
14881495 } else {
1489- TyAssocTypeItem ( generics, bounds)
1496+ RequiredAssocTypeItem ( generics, bounds)
14901497 }
14911498 } else {
14921499 AssocTypeItem (
0 commit comments