@@ -964,11 +964,11 @@ impl Clean<Item> for hir::TraitItem<'_> {
964964        let  local_did = self . def_id . to_def_id ( ) ; 
965965        cx. with_param_env ( local_did,  |cx| { 
966966            let  inner = match  self . kind  { 
967-                 hir:: TraitItemKind :: Const ( ref  ty,  default)  => { 
968-                     let  default = 
969-                         default . map ( |e|  ConstantKind :: Local  {  def_id :  local_did,  body :  e  } ) ; 
970-                      AssocConstItem ( ty . clean ( cx ) ,  default ) 
971-                 } 
967+                 hir:: TraitItemKind :: Const ( ref  ty,  Some ( default) )  => AssocConstItem ( 
968+                     ty . clean ( cx ) , 
969+                     ConstantKind :: Local  {  def_id :  local_did,  body :  default  } , 
970+                 ) , 
971+                 hir :: TraitItemKind :: Const ( ref  ty ,   None )  =>  TyAssocConstItem ( ty . clean ( cx ) ) , 
972972                hir:: TraitItemKind :: Fn ( ref  sig,  hir:: TraitFn :: Provided ( body) )  => { 
973973                    let  m = clean_function ( cx,  sig,  & self . generics ,  body) ; 
974974                    MethodItem ( m,  None ) 
@@ -983,11 +983,19 @@ impl Clean<Item> for hir::TraitItem<'_> {
983983                    } ) ; 
984984                    TyMethodItem ( Function  {  decl,  generics } ) 
985985                } 
986-                 hir:: TraitItemKind :: Type ( bounds,  ref  default)  => { 
986+                 hir:: TraitItemKind :: Type ( bounds,  Some ( default) )  => { 
987+                     let  generics = enter_impl_trait ( cx,  |cx| self . generics . clean ( cx) ) ; 
988+                     let  bounds = bounds. iter ( ) . filter_map ( |x| x. clean ( cx) ) . collect ( ) ; 
989+                     let  item_type = hir_ty_to_ty ( cx. tcx ,  default) . clean ( cx) ; 
990+                     AssocTypeItem ( 
991+                         Typedef  {  type_ :  default. clean ( cx) ,  generics,  item_type :  Some ( item_type)  } , 
992+                         bounds, 
993+                     ) 
994+                 } 
995+                 hir:: TraitItemKind :: Type ( bounds,  None )  => { 
987996                    let  generics = enter_impl_trait ( cx,  |cx| self . generics . clean ( cx) ) ; 
988997                    let  bounds = bounds. iter ( ) . filter_map ( |x| x. clean ( cx) ) . collect ( ) ; 
989-                     let  default = default. map ( |t| t. clean ( cx) ) ; 
990-                     AssocTypeItem ( Box :: new ( generics) ,  bounds,  default) 
998+                     TyAssocTypeItem ( Box :: new ( generics) ,  bounds) 
991999                } 
9921000            } ; 
9931001            let  what_rustc_thinks =
@@ -1004,7 +1012,7 @@ impl Clean<Item> for hir::ImplItem<'_> {
10041012        cx. with_param_env ( local_did,  |cx| { 
10051013            let  inner = match  self . kind  { 
10061014                hir:: ImplItemKind :: Const ( ref  ty,  expr)  => { 
1007-                     let  default = Some ( ConstantKind :: Local  {  def_id :  local_did,  body :  expr } ) ; 
1015+                     let  default = ConstantKind :: Local  {  def_id :  local_did,  body :  expr } ; 
10081016                    AssocConstItem ( ty. clean ( cx) ,  default) 
10091017                } 
10101018                hir:: ImplItemKind :: Fn ( ref  sig,  body)  => { 
@@ -1016,7 +1024,10 @@ impl Clean<Item> for hir::ImplItem<'_> {
10161024                    let  type_ = hir_ty. clean ( cx) ; 
10171025                    let  generics = self . generics . clean ( cx) ; 
10181026                    let  item_type = hir_ty_to_ty ( cx. tcx ,  hir_ty) . clean ( cx) ; 
1019-                     TypedefItem ( Typedef  {  type_,  generics,  item_type :  Some ( item_type)  } ,  true ) 
1027+                     AssocTypeItem ( 
1028+                         Typedef  {  type_,  generics,  item_type :  Some ( item_type)  } , 
1029+                         Vec :: new ( ) , 
1030+                     ) 
10201031                } 
10211032            } ; 
10221033
@@ -1041,13 +1052,17 @@ impl Clean<Item> for ty::AssocItem {
10411052        let  tcx = cx. tcx ; 
10421053        let  kind = match  self . kind  { 
10431054            ty:: AssocKind :: Const  => { 
1044-                 let  ty = tcx. type_of ( self . def_id ) ; 
1045-                  let  default =  if   self . defaultness . has_value ( )   { 
1046-                      Some ( ConstantKind :: Extern   {   def_id :   self . def_id   } ) 
1047-                 }   else   { 
1048-                     None 
1055+                 let  ty = tcx. type_of ( self . def_id ) . clean ( cx ) ; 
1056+ 
1057+                 let  provided =  match   self . container   { 
1058+                     ty :: ImplContainer ( _ )  =>  true , 
1059+                     ty :: TraitContainer ( _ )  =>  self . defaultness . has_value ( ) , 
10491060                } ; 
1050-                 AssocConstItem ( ty. clean ( cx) ,  default) 
1061+                 if  provided { 
1062+                     AssocConstItem ( ty,  ConstantKind :: Extern  {  def_id :  self . def_id  } ) 
1063+                 }  else  { 
1064+                     TyAssocConstItem ( ty) 
1065+                 } 
10511066            } 
10521067            ty:: AssocKind :: Fn  => { 
10531068                let  generics = clean_ty_generics ( 
@@ -1181,23 +1196,28 @@ impl Clean<Item> for ty::AssocItem {
11811196                        None  => bounds. push ( GenericBound :: maybe_sized ( cx) ) , 
11821197                    } 
11831198
1184-                     let  ty = if  self . defaultness . has_value ( )  { 
1185-                         Some ( tcx. type_of ( self . def_id ) ) 
1199+                     if  self . defaultness . has_value ( )  { 
1200+                         AssocTypeItem ( 
1201+                             Typedef  { 
1202+                                 type_ :  tcx. type_of ( self . def_id ) . clean ( cx) , 
1203+                                 generics, 
1204+                                 // FIXME: should we obtain the Type from HIR and pass it on here? 
1205+                                 item_type :  None , 
1206+                             } , 
1207+                             bounds, 
1208+                         ) 
11861209                    }  else  { 
1187-                         None 
1188-                     } ; 
1189- 
1190-                     AssocTypeItem ( Box :: new ( generics) ,  bounds,  ty. map ( |t| t. clean ( cx) ) ) 
1210+                         TyAssocTypeItem ( Box :: new ( generics) ,  bounds) 
1211+                     } 
11911212                }  else  { 
11921213                    // FIXME: when could this happen? Associated items in inherent impls? 
1193-                     let  type_ = tcx. type_of ( self . def_id ) . clean ( cx) ; 
1194-                     TypedefItem ( 
1214+                     AssocTypeItem ( 
11951215                        Typedef  { 
1196-                             type_, 
1216+                             type_ :  tcx . type_of ( self . def_id ) . clean ( cx ) , 
11971217                            generics :  Generics  {  params :  Vec :: new ( ) ,  where_predicates :  Vec :: new ( )  } , 
11981218                            item_type :  None , 
11991219                        } , 
1200-                         true , 
1220+                         Vec :: new ( ) , 
12011221                    ) 
12021222                } 
12031223            } 
@@ -1837,14 +1857,11 @@ fn clean_maybe_renamed_item(
18371857            ItemKind :: TyAlias ( hir_ty,  ref  generics)  => { 
18381858                let  rustdoc_ty = hir_ty. clean ( cx) ; 
18391859                let  ty = hir_ty_to_ty ( cx. tcx ,  hir_ty) . clean ( cx) ; 
1840-                 TypedefItem ( 
1841-                     Typedef  { 
1842-                         type_ :  rustdoc_ty, 
1843-                         generics :  generics. clean ( cx) , 
1844-                         item_type :  Some ( ty) , 
1845-                     } , 
1846-                     false , 
1847-                 ) 
1860+                 TypedefItem ( Typedef  { 
1861+                     type_ :  rustdoc_ty, 
1862+                     generics :  generics. clean ( cx) , 
1863+                     item_type :  Some ( ty) , 
1864+                 } ) 
18481865            } 
18491866            ItemKind :: Enum ( ref  def,  ref  generics)  => EnumItem ( Enum  { 
18501867                variants :  def. variants . iter ( ) . map ( |v| v. clean ( cx) ) . collect ( ) , 
0 commit comments