@@ -1222,22 +1222,24 @@ fn clean_trait_item<'tcx>(trait_item: &hir::TraitItem<'tcx>, cx: &mut DocContext
1222
1222
let local_did = trait_item. owner_id . to_def_id ( ) ;
1223
1223
cx. with_param_env ( local_did, |cx| {
1224
1224
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
+ }
1230
1232
hir:: TraitItemKind :: Const ( ty, None ) => {
1231
1233
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) ) )
1233
1235
}
1234
1236
hir:: TraitItemKind :: Fn ( ref sig, hir:: TraitFn :: Provided ( body) ) => {
1235
1237
let m = clean_function ( cx, sig, trait_item. generics , FunctionArgs :: Body ( body) ) ;
1236
1238
MethodItem ( m, None )
1237
1239
}
1238
1240
hir:: TraitItemKind :: Fn ( ref sig, hir:: TraitFn :: Required ( names) ) => {
1239
1241
let m = clean_function ( cx, sig, trait_item. generics , FunctionArgs :: Names ( names) ) ;
1240
- TyMethodItem ( m)
1242
+ RequiredMethodItem ( m)
1241
1243
}
1242
1244
hir:: TraitItemKind :: Type ( bounds, Some ( default) ) => {
1243
1245
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
1257
1259
hir:: TraitItemKind :: Type ( bounds, None ) => {
1258
1260
let generics = enter_impl_trait ( cx, |cx| clean_generics ( trait_item. generics , cx) ) ;
1259
1261
let bounds = bounds. iter ( ) . filter_map ( |x| clean_generic_bound ( x, cx) ) . collect ( ) ;
1260
- TyAssocTypeItem ( generics, bounds)
1262
+ RequiredAssocTypeItem ( generics, bounds)
1261
1263
}
1262
1264
} ;
1263
1265
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>(
1271
1273
let local_did = impl_. owner_id . to_def_id ( ) ;
1272
1274
cx. with_param_env ( local_did, |cx| {
1273
1275
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 {
1275
1277
generics : clean_generics ( impl_. generics , cx) ,
1276
1278
kind : ConstantKind :: Local { def_id : local_did, body : expr } ,
1277
1279
type_ : clean_ty ( ty, cx) ,
@@ -1320,18 +1322,23 @@ pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocCo
1320
1322
) ;
1321
1323
simplify:: move_bounds_to_generic_parameters ( & mut generics) ;
1322
1324
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 {
1329
1327
generics,
1330
1328
kind : ConstantKind :: Extern { def_id : assoc_item. def_id } ,
1331
1329
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
+ }
1335
1342
}
1336
1343
}
1337
1344
ty:: AssocKind :: Fn => {
@@ -1369,7 +1376,7 @@ pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocCo
1369
1376
} ;
1370
1377
MethodItem ( item, defaultness)
1371
1378
} else {
1372
- TyMethodItem ( item)
1379
+ RequiredMethodItem ( item)
1373
1380
}
1374
1381
}
1375
1382
ty:: AssocKind :: Type => {
@@ -1486,7 +1493,7 @@ pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocCo
1486
1493
bounds,
1487
1494
)
1488
1495
} else {
1489
- TyAssocTypeItem ( generics, bounds)
1496
+ RequiredAssocTypeItem ( generics, bounds)
1490
1497
}
1491
1498
} else {
1492
1499
AssocTypeItem (
0 commit comments