@@ -804,17 +804,17 @@ fn assoc_type(
804804
805805fn render_stability_since_raw (
806806 w : & mut Buffer ,
807- ver : Option < & str > ,
808- const_stability : Option < & ConstStability > ,
809- containing_ver : Option < & str > ,
810- containing_const_ver : Option < & str > ,
807+ ver : Option < Symbol > ,
808+ const_stability : Option < ConstStability > ,
809+ containing_ver : Option < Symbol > ,
810+ containing_const_ver : Option < Symbol > ,
811811) {
812812 let ver = ver. filter ( |inner| !inner. is_empty ( ) ) ;
813813
814814 match ( ver, const_stability) {
815815 // stable and const stable
816816 ( Some ( v) , Some ( ConstStability { level : StabilityLevel :: Stable { since } , .. } ) )
817- if Some ( since. as_str ( ) ) . as_deref ( ) != containing_const_ver =>
817+ if Some ( since) != containing_const_ver =>
818818 {
819819 write ! (
820820 w,
@@ -861,6 +861,7 @@ fn render_assoc_item(
861861 link : AssocItemLink < ' _ > ,
862862 parent : ItemType ,
863863 cx : & Context < ' _ > ,
864+ render_mode : RenderMode ,
864865) {
865866 fn method (
866867 w : & mut Buffer ,
@@ -871,6 +872,7 @@ fn render_assoc_item(
871872 link : AssocItemLink < ' _ > ,
872873 parent : ItemType ,
873874 cx : & Context < ' _ > ,
875+ render_mode : RenderMode ,
874876 ) {
875877 let name = meth. name . as_ref ( ) . unwrap ( ) ;
876878 let href = match link {
@@ -893,8 +895,14 @@ fn render_assoc_item(
893895 }
894896 } ;
895897 let vis = meth. visibility . print_with_space ( meth. def_id , cx) . to_string ( ) ;
896- let constness =
897- print_constness_with_space ( & header. constness , meth. const_stability ( cx. tcx ( ) ) ) ;
898+ // FIXME: Once https://github.com/rust-lang/rust/issues/67792 is implemented, we can remove
899+ // this condition.
900+ let constness = match render_mode {
901+ RenderMode :: Normal => {
902+ print_constness_with_space ( & header. constness , meth. const_stability ( cx. tcx ( ) ) )
903+ }
904+ RenderMode :: ForDeref { .. } => "" ,
905+ } ;
898906 let asyncness = header. asyncness . print_with_space ( ) ;
899907 let unsafety = header. unsafety . print_with_space ( ) ;
900908 let defaultness = print_default_space ( meth. is_default ( ) ) ;
@@ -945,10 +953,10 @@ fn render_assoc_item(
945953 match * item. kind {
946954 clean:: StrippedItem ( ..) => { }
947955 clean:: TyMethodItem ( ref m) => {
948- method ( w, item, m. header , & m. generics , & m. decl , link, parent, cx)
956+ method ( w, item, m. header , & m. generics , & m. decl , link, parent, cx, render_mode )
949957 }
950958 clean:: MethodItem ( ref m, _) => {
951- method ( w, item, m. header , & m. generics , & m. decl , link, parent, cx)
959+ method ( w, item, m. header , & m. generics , & m. decl , link, parent, cx, render_mode )
952960 }
953961 clean:: AssocConstItem ( ref ty, ref default) => assoc_const (
954962 w,
@@ -1422,7 +1430,7 @@ fn render_impl(
14221430 "<div id=\" {}\" class=\" {}{} has-srclink\" >" ,
14231431 id, item_type, in_trait_class,
14241432 ) ;
1425- render_rightside ( w, cx, item, containing_item) ;
1433+ render_rightside ( w, cx, item, containing_item, render_mode ) ;
14261434 write ! ( w, "<a href=\" #{}\" class=\" anchor\" ></a>" , id) ;
14271435 w. write_str ( "<h4 class=\" code-header\" >" ) ;
14281436 render_assoc_item (
@@ -1431,6 +1439,7 @@ fn render_impl(
14311439 link. anchor ( source_id. as_ref ( ) . unwrap_or ( & id) ) ,
14321440 ItemType :: Impl ,
14331441 cx,
1442+ render_mode,
14341443 ) ;
14351444 w. write_str ( "</h4>" ) ;
14361445 w. write_str ( "</div>" ) ;
@@ -1466,7 +1475,7 @@ fn render_impl(
14661475 "<div id=\" {}\" class=\" {}{} has-srclink\" >" ,
14671476 id, item_type, in_trait_class
14681477 ) ;
1469- render_rightside ( w, cx, item, containing_item) ;
1478+ render_rightside ( w, cx, item, containing_item, render_mode ) ;
14701479 write ! ( w, "<a href=\" #{}\" class=\" anchor\" ></a>" , id) ;
14711480 w. write_str ( "<h4 class=\" code-header\" >" ) ;
14721481 assoc_const (
@@ -1645,16 +1654,24 @@ fn render_rightside(
16451654 cx : & Context < ' _ > ,
16461655 item : & clean:: Item ,
16471656 containing_item : & clean:: Item ,
1657+ render_mode : RenderMode ,
16481658) {
16491659 let tcx = cx. tcx ( ) ;
16501660
1661+ // FIXME: Once https://github.com/rust-lang/rust/issues/67792 is implemented, we can remove
1662+ // this condition.
1663+ let ( const_stability, const_stable_since) = match render_mode {
1664+ RenderMode :: Normal => ( item. const_stability ( tcx) , containing_item. const_stable_since ( tcx) ) ,
1665+ RenderMode :: ForDeref { .. } => ( None , None ) ,
1666+ } ;
1667+
16511668 write ! ( w, "<div class=\" rightside\" >" ) ;
16521669 render_stability_since_raw (
16531670 w,
1654- item. stable_since ( tcx) . as_deref ( ) ,
1655- item . const_stability ( tcx ) ,
1656- containing_item. stable_since ( tcx) . as_deref ( ) ,
1657- containing_item . const_stable_since ( tcx ) . as_deref ( ) ,
1671+ item. stable_since ( tcx) ,
1672+ const_stability,
1673+ containing_item. stable_since ( tcx) ,
1674+ const_stable_since,
16581675 ) ;
16591676
16601677 write_srclink ( cx, item, w) ;
@@ -1690,7 +1707,7 @@ pub(crate) fn render_impl_summary(
16901707 format ! ( " data-aliases=\" {}\" " , aliases. join( "," ) )
16911708 } ;
16921709 write ! ( w, "<div id=\" {}\" class=\" impl has-srclink\" {}>" , id, aliases) ;
1693- render_rightside ( w, cx, & i. impl_item , containing_item) ;
1710+ render_rightside ( w, cx, & i. impl_item , containing_item, RenderMode :: Normal ) ;
16941711 write ! ( w, "<a href=\" #{}\" class=\" anchor\" ></a>" , id) ;
16951712 write ! ( w, "<h3 class=\" code-header in-band\" >" ) ;
16961713
0 commit comments