@@ -1640,8 +1640,8 @@ fn plain_summary_line(s: Option<&str>) -> String {
16401640}
16411641
16421642fn document ( w : & mut fmt:: Formatter , cx : & Context , item : & clean:: Item ) -> fmt:: Result {
1643- if let Some ( s ) = short_stability ( item, cx, true ) {
1644- write ! ( w, "<div class='stability'>{}</div>" , s ) ?;
1643+ for stability in short_stability ( item, cx, true ) {
1644+ write ! ( w, "<div class='stability'>{}</div>" , stability ) ?;
16451645 }
16461646 if let Some ( s) = item. doc_value ( ) {
16471647 write ! ( w, "<div class='docblock'>{}</div>" , Markdown ( s) ) ?;
@@ -1739,16 +1739,19 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
17391739
17401740 match myitem. inner {
17411741 clean:: ExternCrateItem ( ref name, ref src) => {
1742+ use html:: format:: HRef ;
1743+
17421744 match * src {
17431745 Some ( ref src) => {
17441746 write ! ( w, "<tr><td><code>{}extern crate {} as {};" ,
17451747 VisSpace ( & myitem. visibility) ,
1746- src,
1748+ HRef :: new ( myitem . def_id , src) ,
17471749 name) ?
17481750 }
17491751 None => {
17501752 write ! ( w, "<tr><td><code>{}extern crate {};" ,
1751- VisSpace ( & myitem. visibility) , name) ?
1753+ VisSpace ( & myitem. visibility) ,
1754+ HRef :: new( myitem. def_id, name) ) ?
17521755 }
17531756 }
17541757 write ! ( w, "</code></td></tr>" ) ?;
@@ -1761,8 +1764,15 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
17611764
17621765 _ => {
17631766 if myitem. name . is_none ( ) { continue }
1764- let stab_docs = if let Some ( s) = short_stability ( myitem, cx, false ) {
1765- format ! ( "[{}]" , s)
1767+
1768+ let stabilities = short_stability ( myitem, cx, false ) ;
1769+
1770+ let stab_docs = if !stabilities. is_empty ( ) {
1771+ stabilities. iter ( )
1772+ . map ( |s| format ! ( "[{}]" , s) )
1773+ . collect :: < Vec < _ > > ( )
1774+ . as_slice ( )
1775+ . join ( " " )
17661776 } else {
17671777 String :: new ( )
17681778 } ;
@@ -1789,21 +1799,26 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
17891799 write ! ( w, "</table>" )
17901800}
17911801
1792- fn short_stability ( item : & clean:: Item , cx : & Context , show_reason : bool ) -> Option < String > {
1793- item. stability . as_ref ( ) . and_then ( |stab| {
1802+ fn short_stability ( item : & clean:: Item , cx : & Context , show_reason : bool ) -> Vec < String > {
1803+ let mut stability = vec ! [ ] ;
1804+
1805+ if let Some ( stab) = item. stability . as_ref ( ) {
17941806 let reason = if show_reason && !stab. reason . is_empty ( ) {
17951807 format ! ( ": {}" , stab. reason)
17961808 } else {
17971809 String :: new ( )
17981810 } ;
1799- let text = if !stab. deprecated_since . is_empty ( ) {
1811+ if !stab. deprecated_since . is_empty ( ) {
18001812 let since = if show_reason {
18011813 format ! ( " since {}" , Escape ( & stab. deprecated_since) )
18021814 } else {
18031815 String :: new ( )
18041816 } ;
1805- format ! ( "Deprecated{}{}" , since, Markdown ( & reason) )
1806- } else if stab. level == stability:: Unstable {
1817+ let text = format ! ( "Deprecated{}{}" , since, Markdown ( & reason) ) ;
1818+ stability. push ( format ! ( "<em class='stab deprecated'>{}</em>" , text) )
1819+ } ;
1820+
1821+ if stab. level == stability:: Unstable {
18071822 let unstable_extra = if show_reason {
18081823 match ( !stab. feature . is_empty ( ) , & cx. shared . issue_tracker_base_url , stab. issue ) {
18091824 ( true , & Some ( ref tracker_url) , Some ( issue_no) ) if issue_no > 0 =>
@@ -1819,29 +1834,26 @@ fn short_stability(item: &clean::Item, cx: &Context, show_reason: bool) -> Optio
18191834 } else {
18201835 String :: new ( )
18211836 } ;
1822- format ! ( "Unstable{}{}" , unstable_extra, Markdown ( & reason) )
1837+ let text = format ! ( "Unstable{}{}" , unstable_extra, Markdown ( & reason) ) ;
1838+ stability. push ( format ! ( "<em class='stab unstable'>{}</em>" , text) )
1839+ } ;
1840+ } else if let Some ( depr) = item. deprecation . as_ref ( ) {
1841+ let note = if show_reason && !depr. note . is_empty ( ) {
1842+ format ! ( ": {}" , depr. note)
18231843 } else {
1824- return None
1844+ String :: new ( )
1845+ } ;
1846+ let since = if show_reason && !depr. since . is_empty ( ) {
1847+ format ! ( " since {}" , Escape ( & depr. since) )
1848+ } else {
1849+ String :: new ( )
18251850 } ;
1826- Some ( format ! ( "<em class='stab {}'>{}</em>" ,
1827- item. stability_class( ) , text) )
1828- } ) . or_else ( || {
1829- item. deprecation . as_ref ( ) . and_then ( |depr| {
1830- let note = if show_reason && !depr. note . is_empty ( ) {
1831- format ! ( ": {}" , depr. note)
1832- } else {
1833- String :: new ( )
1834- } ;
1835- let since = if show_reason && !depr. since . is_empty ( ) {
1836- format ! ( " since {}" , Escape ( & depr. since) )
1837- } else {
1838- String :: new ( )
1839- } ;
18401851
1841- let text = format ! ( "Deprecated{}{}" , since, Markdown ( & note) ) ;
1842- Some ( format ! ( "<em class='stab deprecated'>{}</em>" , text) )
1843- } )
1844- } )
1852+ let text = format ! ( "Deprecated{}{}" , since, Markdown ( & note) ) ;
1853+ stability. push ( format ! ( "<em class='stab deprecated'>{}</em>" , text) )
1854+ }
1855+
1856+ stability
18451857}
18461858
18471859struct Initializer < ' a > ( & ' a str ) ;
@@ -2548,10 +2560,11 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
25482560 if !is_static || render_static {
25492561 let id = derive_id ( format ! ( "{}.{}" , shortty, name) ) ;
25502562 write ! ( w, "<h4 id='{}' class='{}'>" , id, shortty) ?;
2551- render_stability_since_raw ( w, item. stable_since ( ) , outer_version) ?;
25522563 write ! ( w, "<code>" ) ?;
25532564 render_assoc_item ( w, item, link. anchor ( & id) ) ?;
2554- write ! ( w, "</code></h4>\n " ) ?;
2565+ write ! ( w, "</code>" ) ?;
2566+ render_stability_since_raw ( w, item. stable_since ( ) , outer_version) ?;
2567+ write ! ( w, "</h4>\n " ) ?;
25552568 }
25562569 }
25572570 clean:: TypedefItem ( ref tydef, _) => {
0 commit comments