@@ -1640,8 +1640,8 @@ fn plain_summary_line(s: Option<&str>) -> String {
1640
1640
}
1641
1641
1642
1642
fn 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 ) ?;
1645
1645
}
1646
1646
if let Some ( s) = item. doc_value ( ) {
1647
1647
write ! ( w, "<div class='docblock'>{}</div>" , Markdown ( s) ) ?;
@@ -1739,16 +1739,19 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
1739
1739
1740
1740
match myitem. inner {
1741
1741
clean:: ExternCrateItem ( ref name, ref src) => {
1742
+ use html:: format:: HRef ;
1743
+
1742
1744
match * src {
1743
1745
Some ( ref src) => {
1744
1746
write ! ( w, "<tr><td><code>{}extern crate {} as {};" ,
1745
1747
VisSpace ( & myitem. visibility) ,
1746
- src,
1748
+ HRef :: new ( myitem . def_id , src) ,
1747
1749
name) ?
1748
1750
}
1749
1751
None => {
1750
1752
write ! ( w, "<tr><td><code>{}extern crate {};" ,
1751
- VisSpace ( & myitem. visibility) , name) ?
1753
+ VisSpace ( & myitem. visibility) ,
1754
+ HRef :: new( myitem. def_id, name) ) ?
1752
1755
}
1753
1756
}
1754
1757
write ! ( w, "</code></td></tr>" ) ?;
@@ -1761,8 +1764,15 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
1761
1764
1762
1765
_ => {
1763
1766
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 ( " " )
1766
1776
} else {
1767
1777
String :: new ( )
1768
1778
} ;
@@ -1789,21 +1799,26 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
1789
1799
write ! ( w, "</table>" )
1790
1800
}
1791
1801
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 ( ) {
1794
1806
let reason = if show_reason && !stab. reason . is_empty ( ) {
1795
1807
format ! ( ": {}" , stab. reason)
1796
1808
} else {
1797
1809
String :: new ( )
1798
1810
} ;
1799
- let text = if !stab. deprecated_since . is_empty ( ) {
1811
+ if !stab. deprecated_since . is_empty ( ) {
1800
1812
let since = if show_reason {
1801
1813
format ! ( " since {}" , Escape ( & stab. deprecated_since) )
1802
1814
} else {
1803
1815
String :: new ( )
1804
1816
} ;
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 {
1807
1822
let unstable_extra = if show_reason {
1808
1823
match ( !stab. feature . is_empty ( ) , & cx. shared . issue_tracker_base_url , stab. issue ) {
1809
1824
( 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
1819
1834
} else {
1820
1835
String :: new ( )
1821
1836
} ;
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)
1823
1843
} 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 ( )
1825
1850
} ;
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
- } ;
1840
1851
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
1845
1857
}
1846
1858
1847
1859
struct Initializer < ' a > ( & ' a str ) ;
@@ -2548,10 +2560,11 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
2548
2560
if !is_static || render_static {
2549
2561
let id = derive_id ( format ! ( "{}.{}" , shortty, name) ) ;
2550
2562
write ! ( w, "<h4 id='{}' class='{}'>" , id, shortty) ?;
2551
- render_stability_since_raw ( w, item. stable_since ( ) , outer_version) ?;
2552
2563
write ! ( w, "<code>" ) ?;
2553
2564
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 " ) ?;
2555
2568
}
2556
2569
}
2557
2570
clean:: TypedefItem ( ref tydef, _) => {
0 commit comments