@@ -834,12 +834,13 @@ fn assoc_method(
834834/// Note that it is possible for an unstable function to be const-stable. In that case, the span
835835/// will include the const-stable version, but no stable version will be emitted, as a natural
836836/// consequence of the above rules.
837- fn render_stability_since_raw (
837+ fn render_stability_since_raw_with_extra (
838838 w : & mut Buffer ,
839839 ver : Option < Symbol > ,
840840 const_stability : Option < ConstStability > ,
841841 containing_ver : Option < Symbol > ,
842842 containing_const_ver : Option < Symbol > ,
843+ extra_class : & str ,
843844) -> bool {
844845 let stable_version = ver. filter ( |inner| !inner. is_empty ( ) && Some ( * inner) != containing_ver) ;
845846
@@ -887,12 +888,30 @@ fn render_stability_since_raw(
887888 }
888889
889890 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>"# ) ;
891892 }
892893
893894 !stability. is_empty ( )
894895}
895896
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+
896915fn render_assoc_item (
897916 w : & mut Buffer ,
898917 item : & clean:: Item ,
@@ -1675,25 +1694,29 @@ fn render_rightside(
16751694 RenderMode :: Normal => ( item. const_stability ( tcx) , containing_item. const_stable_since ( tcx) ) ,
16761695 RenderMode :: ForDeref { .. } => ( None , None ) ,
16771696 } ;
1697+ let src_href = cx. src_href ( item) ;
1698+ let has_src_ref = src_href. is_some ( ) ;
16781699
16791700 let mut rightside = Buffer :: new ( ) ;
1680- let has_stability = render_stability_since_raw (
1701+ let has_stability = render_stability_since_raw_with_extra (
16811702 & mut rightside,
16821703 item. stable_since ( tcx) ,
16831704 const_stability,
16841705 containing_item. stable_since ( tcx) ,
16851706 const_stable_since,
1707+ if has_src_ref { "" } else { " rightside" } ,
16861708 ) ;
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+ }
16931715 }
1694- rightside. push_buffer ( srclink) ;
1695- if !rightside. is_empty ( ) {
1716+ if has_stability && has_src_ref {
16961717 write ! ( w, "<span class=\" rightside\" >{}</span>" , rightside. into_inner( ) ) ;
1718+ } else {
1719+ w. push_buffer ( rightside) ;
16971720 }
16981721}
16991722
0 commit comments