@@ -834,12 +834,13 @@ fn assoc_method(
834
834
/// Note that it is possible for an unstable function to be const-stable. In that case, the span
835
835
/// will include the const-stable version, but no stable version will be emitted, as a natural
836
836
/// consequence of the above rules.
837
- fn render_stability_since_raw (
837
+ fn render_stability_since_raw_with_extra (
838
838
w : & mut Buffer ,
839
839
ver : Option < Symbol > ,
840
840
const_stability : Option < ConstStability > ,
841
841
containing_ver : Option < Symbol > ,
842
842
containing_const_ver : Option < Symbol > ,
843
+ extra_class : & str ,
843
844
) -> bool {
844
845
let stable_version = ver. filter ( |inner| !inner. is_empty ( ) && Some ( * inner) != containing_ver) ;
845
846
@@ -887,12 +888,30 @@ fn render_stability_since_raw(
887
888
}
888
889
889
890
if !stability. is_empty ( ) {
890
- write ! ( w, r#"<span class="since" title="{}">{}</span>"# , title , stability ) ;
891
+ write ! ( w, r#"<span class="since{extra_class} " title="{title }">{stability }</span>"# ) ;
891
892
}
892
893
893
894
!stability. is_empty ( )
894
895
}
895
896
897
+ #[ inline]
898
+ fn render_stability_since_raw (
899
+ w : & mut Buffer ,
900
+ ver : Option < Symbol > ,
901
+ const_stability : Option < ConstStability > ,
902
+ containing_ver : Option < Symbol > ,
903
+ containing_const_ver : Option < Symbol > ,
904
+ ) -> bool {
905
+ render_stability_since_raw_with_extra (
906
+ w,
907
+ ver,
908
+ const_stability,
909
+ containing_ver,
910
+ containing_const_ver,
911
+ "" ,
912
+ )
913
+ }
914
+
896
915
fn render_assoc_item (
897
916
w : & mut Buffer ,
898
917
item : & clean:: Item ,
@@ -1675,25 +1694,29 @@ fn render_rightside(
1675
1694
RenderMode :: Normal => ( item. const_stability ( tcx) , containing_item. const_stable_since ( tcx) ) ,
1676
1695
RenderMode :: ForDeref { .. } => ( None , None ) ,
1677
1696
} ;
1697
+ let src_href = cx. src_href ( item) ;
1698
+ let has_src_ref = src_href. is_some ( ) ;
1678
1699
1679
1700
let mut rightside = Buffer :: new ( ) ;
1680
- let has_stability = render_stability_since_raw (
1701
+ let has_stability = render_stability_since_raw_with_extra (
1681
1702
& mut rightside,
1682
1703
item. stable_since ( tcx) ,
1683
1704
const_stability,
1684
1705
containing_item. stable_since ( tcx) ,
1685
1706
const_stable_since,
1707
+ if has_src_ref { "" } else { " rightside" } ,
1686
1708
) ;
1687
- let mut srclink = Buffer :: empty_from ( w ) ;
1688
- if let Some ( l ) = cx . src_href ( item ) {
1689
- write ! ( srclink , "<a class=\" srclink\" href=\" {}\" >source</a>" , l)
1690
- }
1691
- if has_stability && !srclink . is_empty ( ) {
1692
- rightside . write_str ( " · " ) ;
1709
+ if let Some ( l ) = src_href {
1710
+ if has_stability {
1711
+ write ! ( rightside , " · <a class=\" srclink\" href=\" {}\" >source</a>" , l)
1712
+ } else {
1713
+ write ! ( rightside , "<a class= \" srclink rightside \" href= \" {} \" >source</a>" , l )
1714
+ }
1693
1715
}
1694
- rightside. push_buffer ( srclink) ;
1695
- if !rightside. is_empty ( ) {
1716
+ if has_stability && has_src_ref {
1696
1717
write ! ( w, "<span class=\" rightside\" >{}</span>" , rightside. into_inner( ) ) ;
1718
+ } else {
1719
+ w. push_buffer ( rightside) ;
1697
1720
}
1698
1721
}
1699
1722
0 commit comments