@@ -1787,6 +1787,9 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
17871787 let types = t. items . iter ( ) . filter ( |m| {
17881788 match m. inner { clean:: AssociatedTypeItem ( ..) => true , _ => false }
17891789 } ) . collect :: < Vec < _ > > ( ) ;
1790+ let consts = t. items . iter ( ) . filter ( |m| {
1791+ match m. inner { clean:: AssociatedConstItem ( ..) => true , _ => false }
1792+ } ) . collect :: < Vec < _ > > ( ) ;
17901793 let required = t. items . iter ( ) . filter ( |m| {
17911794 match m. inner { clean:: TyMethodItem ( _) => true , _ => false }
17921795 } ) . collect :: < Vec < _ > > ( ) ;
@@ -1803,7 +1806,15 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
18031806 try!( render_assoc_item ( w, t, AssocItemLink :: Anchor ) ) ;
18041807 try!( write ! ( w, ";\n " ) ) ;
18051808 }
1806- if !types. is_empty ( ) && !required. is_empty ( ) {
1809+ if !types. is_empty ( ) && !consts. is_empty ( ) {
1810+ try!( w. write_str ( "\n " ) ) ;
1811+ }
1812+ for t in & consts {
1813+ try!( write ! ( w, " " ) ) ;
1814+ try!( render_assoc_item ( w, t, AssocItemLink :: Anchor ) ) ;
1815+ try!( write ! ( w, ";\n " ) ) ;
1816+ }
1817+ if !consts. is_empty ( ) && !required. is_empty ( ) {
18071818 try!( w. write_str ( "\n " ) ) ;
18081819 }
18091820 for m in & required {
@@ -1905,11 +1916,11 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
19051916}
19061917
19071918fn assoc_const ( w : & mut fmt:: Formatter , it : & clean:: Item ,
1908- ty : & clean:: Type , default : & Option < String > )
1919+ ty : & clean:: Type , default : Option < & String > )
19091920 -> fmt:: Result {
19101921 try!( write ! ( w, "const {}" , it. name. as_ref( ) . unwrap( ) ) ) ;
19111922 try!( write ! ( w, ": {}" , ty) ) ;
1912- if let Some ( ref default) = * default {
1923+ if let Some ( default) = default {
19131924 try!( write ! ( w, " = {}" , default ) ) ;
19141925 }
19151926 Ok ( ( ) )
@@ -1971,7 +1982,7 @@ fn render_assoc_item(w: &mut fmt::Formatter, meth: &clean::Item,
19711982 link)
19721983 }
19731984 clean:: AssociatedConstItem ( ref ty, ref default) => {
1974- assoc_const ( w, meth, ty, default)
1985+ assoc_const ( w, meth, ty, default. as_ref ( ) )
19751986 }
19761987 clean:: AssociatedTypeItem ( ref bounds, ref default) => {
19771988 assoc_type ( w, meth, bounds, default)
@@ -2335,9 +2346,15 @@ fn render_impl(w: &mut fmt::Formatter, i: &Impl, link: AssocItemLink,
23352346 clean:: AssociatedConstItem ( ref ty, ref default) => {
23362347 let name = item. name . as_ref ( ) . unwrap ( ) ;
23372348 try!( write ! ( w, "<h4 id='assoc_const.{}' class='{}'><code>" ,
2338- * name,
2339- shortty( item) ) ) ;
2340- try!( assoc_const ( w, item, ty, default) ) ;
2349+ * name, shortty( item) ) ) ;
2350+ try!( assoc_const ( w, item, ty, default. as_ref ( ) ) ) ;
2351+ try!( write ! ( w, "</code></h4>\n " ) ) ;
2352+ }
2353+ clean:: ConstantItem ( ref c) => {
2354+ let name = item. name . as_ref ( ) . unwrap ( ) ;
2355+ try!( write ! ( w, "<h4 id='assoc_const.{}' class='{}'><code>" ,
2356+ * name, shortty( item) ) ) ;
2357+ try!( assoc_const ( w, item, & c. type_ , Some ( & c. expr ) ) ) ;
23412358 try!( write ! ( w, "</code></h4>\n " ) ) ;
23422359 }
23432360 clean:: AssociatedTypeItem ( ref bounds, ref default) => {
0 commit comments