@@ -773,22 +773,25 @@ fn assoc_const(
773773fn assoc_type (
774774 w : & mut Buffer ,
775775 it : & clean:: Item ,
776+ generics : & clean:: Generics ,
776777 bounds : & [ clean:: GenericBound ] ,
777778 default : Option < & clean:: Type > ,
778779 link : AssocItemLink < ' _ > ,
779- extra : & str ,
780+ indent : usize ,
780781 cx : & Context < ' _ > ,
781782) {
782783 write ! (
783784 w,
784- "{}type <a href=\" {}\" class=\" associatedtype\" >{}</a>" ,
785- extra,
786- naive_assoc_href( it, link, cx) ,
787- it. name. as_ref( ) . unwrap( )
785+ "{indent}type <a href=\" {href}\" class=\" associatedtype\" >{name}</a>{generics}" ,
786+ indent = " " . repeat( indent) ,
787+ href = naive_assoc_href( it, link, cx) ,
788+ name = it. name. as_ref( ) . unwrap( ) ,
789+ generics = generics. print( cx) ,
788790 ) ;
789791 if !bounds. is_empty ( ) {
790792 write ! ( w, ": {}" , print_generic_bounds( bounds, cx) )
791793 }
794+ write ! ( w, "{}" , print_where_clause( generics, cx, indent, false ) ) ;
792795 if let Some ( default) = default {
793796 write ! ( w, " = {}" , default . print( cx) )
794797 }
@@ -812,11 +815,8 @@ fn assoc_method(
812815 AssocItemLink :: GotoSource ( did, provided_methods) => {
813816 // We're creating a link from an impl-item to the corresponding
814817 // trait-item and need to map the anchored type accordingly.
815- let ty = if provided_methods. contains ( name) {
816- ItemType :: Method
817- } else {
818- ItemType :: TyMethod
819- } ;
818+ let ty =
819+ if provided_methods. contains ( name) { ItemType :: Method } else { ItemType :: TyMethod } ;
820820
821821 match ( href ( did. expect_def_id ( ) , cx) , ty) {
822822 ( Ok ( p) , ty) => Some ( format ! ( "{}#{}.{}" , p. 0 , ty, name) ) ,
@@ -974,13 +974,14 @@ fn render_assoc_item(
974974 clean:: AssocConstItem ( ref ty, _) => {
975975 assoc_const ( w, item, ty, link, if parent == ItemType :: Trait { " " } else { "" } , cx)
976976 }
977- clean:: AssocTypeItem ( ref bounds, ref default) => assoc_type (
977+ clean:: AssocTypeItem ( ref generics , ref bounds, ref default) => assoc_type (
978978 w,
979979 item,
980+ generics,
980981 bounds,
981982 default. as_ref ( ) ,
982983 link,
983- if parent == ItemType :: Trait { " " } else { "" } ,
984+ if parent == ItemType :: Trait { 4 } else { 0 } ,
984985 cx,
985986 ) ,
986987 _ => panic ! ( "render_assoc_item called on non-associated-item" ) ,
@@ -1284,7 +1285,16 @@ fn notable_traits_decl(decl: &clean::FnDecl, cx: &Context<'_>) -> String {
12841285 let empty_set = FxHashSet :: default ( ) ;
12851286 let src_link =
12861287 AssocItemLink :: GotoSource ( trait_did. into ( ) , & empty_set) ;
1287- assoc_type ( & mut out, it, & [ ] , Some ( & tydef. type_ ) , src_link, "" , cx) ;
1288+ assoc_type (
1289+ & mut out,
1290+ it,
1291+ & tydef. generics ,
1292+ & [ ] ,
1293+ Some ( & tydef. type_ ) ,
1294+ src_link,
1295+ 0 ,
1296+ cx,
1297+ ) ;
12881298 out. push_str ( ";</span>" ) ;
12891299 }
12901300 }
@@ -1463,10 +1473,11 @@ fn render_impl(
14631473 assoc_type (
14641474 w,
14651475 item,
1466- & Vec :: new ( ) ,
1476+ & tydef. generics ,
1477+ & [ ] ,
14671478 Some ( & tydef. type_ ) ,
14681479 link. anchor ( if trait_. is_some ( ) { & source_id } else { & id } ) ,
1469- "" ,
1480+ 0 ,
14701481 cx,
14711482 ) ;
14721483 w. write_str ( "</h4>" ) ;
@@ -1494,7 +1505,7 @@ fn render_impl(
14941505 w. write_str ( "</h4>" ) ;
14951506 w. write_str ( "</section>" ) ;
14961507 }
1497- clean:: AssocTypeItem ( ref bounds, ref default) => {
1508+ clean:: AssocTypeItem ( ref generics , ref bounds, ref default) => {
14981509 let source_id = format ! ( "{}.{}" , item_type, name) ;
14991510 let id = cx. derive_id ( source_id. clone ( ) ) ;
15001511 write ! ( w, "<section id=\" {}\" class=\" {}{}\" >" , id, item_type, in_trait_class, ) ;
@@ -1503,10 +1514,11 @@ fn render_impl(
15031514 assoc_type (
15041515 w,
15051516 item,
1517+ generics,
15061518 bounds,
15071519 default. as_ref ( ) ,
15081520 link. anchor ( if trait_. is_some ( ) { & source_id } else { & id } ) ,
1509- "" ,
1521+ 0 ,
15101522 cx,
15111523 ) ;
15121524 w. write_str ( "</h4>" ) ;
@@ -1727,7 +1739,16 @@ pub(crate) fn render_impl_summary(
17271739 for it in & i. inner_impl ( ) . items {
17281740 if let clean:: TypedefItem ( ref tydef, _) = * it. kind {
17291741 w. write_str ( "<span class=\" where fmt-newline\" > " ) ;
1730- assoc_type ( w, it, & [ ] , Some ( & tydef. type_ ) , AssocItemLink :: Anchor ( None ) , "" , cx) ;
1742+ assoc_type (
1743+ w,
1744+ it,
1745+ & tydef. generics ,
1746+ & [ ] ,
1747+ Some ( & tydef. type_ ) ,
1748+ AssocItemLink :: Anchor ( None ) ,
1749+ 0 ,
1750+ cx,
1751+ ) ;
17311752 w. write_str ( ";</span>" ) ;
17321753 }
17331754 }
0 commit comments