@@ -723,6 +723,8 @@ fn short_item_info(
723723 extra_info
724724}
725725
726+ // Render the list of items inside one of the sections "Trait Implementations",
727+ // "Auto Trait Implementations," "Blanket Trait Implementations" (on struct/enum pages).
726728fn render_impls (
727729 cx : & Context < ' _ > ,
728730 w : & mut Buffer ,
@@ -745,8 +747,6 @@ fn render_impls(
745747 containing_item,
746748 assoc_link,
747749 RenderMode :: Normal ,
748- containing_item. stable_since ( tcx) . as_deref ( ) ,
749- containing_item. const_stable_since ( tcx) . as_deref ( ) ,
750750 true ,
751751 None ,
752752 false ,
@@ -1024,7 +1024,6 @@ fn render_assoc_items(
10241024 Some ( v) => v,
10251025 None => return ,
10261026 } ;
1027- let tcx = cx. tcx ( ) ;
10281027 let cache = cx. cache ( ) ;
10291028 let ( non_trait, traits) : ( Vec < _ > , _ ) = v. iter ( ) . partition ( |i| i. inner_impl ( ) . trait_ . is_none ( ) ) ;
10301029 if !non_trait. is_empty ( ) {
@@ -1058,8 +1057,6 @@ fn render_assoc_items(
10581057 containing_item,
10591058 AssocItemLink :: Anchor ( None ) ,
10601059 render_mode,
1061- containing_item. stable_since ( tcx) . as_deref ( ) ,
1062- containing_item. const_stable_since ( tcx) . as_deref ( ) ,
10631060 true ,
10641061 None ,
10651062 false ,
@@ -1260,8 +1257,6 @@ fn render_impl(
12601257 parent : & clean:: Item ,
12611258 link : AssocItemLink < ' _ > ,
12621259 render_mode : RenderMode ,
1263- outer_version : Option < & str > ,
1264- outer_const_version : Option < & str > ,
12651260 show_def_docs : bool ,
12661261 use_absolute : Option < bool > ,
12671262 is_on_foreign_type : bool ,
@@ -1278,17 +1273,18 @@ fn render_impl(
12781273 // For trait implementations, the `interesting` output contains all methods that have doc
12791274 // comments, and the `boring` output contains all methods that do not. The distinction is
12801275 // used to allow hiding the boring methods.
1276+ // `containing_item` is used for rendering stability info. If the parent is a trait impl,
1277+ // `containing_item` will the grandparent, since trait impls can't have stability attached.
12811278 fn doc_impl_item (
12821279 boring : & mut Buffer ,
12831280 interesting : & mut Buffer ,
12841281 cx : & Context < ' _ > ,
12851282 item : & clean:: Item ,
12861283 parent : & clean:: Item ,
1284+ containing_item : & clean:: Item ,
12871285 link : AssocItemLink < ' _ > ,
12881286 render_mode : RenderMode ,
12891287 is_default_item : bool ,
1290- outer_version : Option < & str > ,
1291- outer_const_version : Option < & str > ,
12921288 trait_ : Option < & clean:: Trait > ,
12931289 show_def_docs : bool ,
12941290 ) {
@@ -1362,7 +1358,7 @@ fn render_impl(
13621358 "<div id=\" {}\" class=\" {}{} has-srclink\" >" ,
13631359 id, item_type, in_trait_class,
13641360 ) ;
1365- render_rightside ( w, cx, item, outer_version , outer_const_version ) ;
1361+ render_rightside ( w, cx, item, containing_item ) ;
13661362 write ! ( w, "<a href=\" #{}\" class=\" anchor\" ></a>" , id) ;
13671363 w. write_str ( "<code>" ) ;
13681364 render_assoc_item (
@@ -1406,7 +1402,7 @@ fn render_impl(
14061402 "<div id=\" {}\" class=\" {}{} has-srclink\" >" ,
14071403 id, item_type, in_trait_class
14081404 ) ;
1409- render_rightside ( w, cx, item, outer_version , outer_const_version ) ;
1405+ render_rightside ( w, cx, item, containing_item ) ;
14101406 write ! ( w, "<a href=\" #{}\" class=\" anchor\" ></a>" , id) ;
14111407 w. write_str ( "<code>" ) ;
14121408 assoc_const (
@@ -1461,11 +1457,10 @@ fn render_impl(
14611457 cx,
14621458 trait_item,
14631459 if trait_. is_some ( ) { & i. impl_item } else { parent } ,
1460+ parent,
14641461 link,
14651462 render_mode,
14661463 false ,
1467- outer_version,
1468- outer_const_version,
14691464 trait_. map ( |t| & t. trait_ ) ,
14701465 show_def_docs,
14711466 ) ;
@@ -1478,9 +1473,8 @@ fn render_impl(
14781473 t : & clean:: Trait ,
14791474 i : & clean:: Impl ,
14801475 parent : & clean:: Item ,
1476+ containing_item : & clean:: Item ,
14811477 render_mode : RenderMode ,
1482- outer_version : Option < & str > ,
1483- outer_const_version : Option < & str > ,
14841478 show_def_docs : bool ,
14851479 ) {
14861480 for trait_item in & t. items {
@@ -1498,11 +1492,10 @@ fn render_impl(
14981492 cx,
14991493 trait_item,
15001494 parent,
1495+ containing_item,
15011496 assoc_link,
15021497 render_mode,
15031498 true ,
1504- outer_version,
1505- outer_const_version,
15061499 Some ( t) ,
15071500 show_def_docs,
15081501 ) ;
@@ -1522,9 +1515,8 @@ fn render_impl(
15221515 & t. trait_ ,
15231516 & i. inner_impl ( ) ,
15241517 & i. impl_item ,
1518+ parent,
15251519 render_mode,
1526- outer_version,
1527- outer_const_version,
15281520 show_def_docs,
15291521 ) ;
15301522 }
@@ -1541,8 +1533,7 @@ fn render_impl(
15411533 cx,
15421534 i,
15431535 parent,
1544- outer_version,
1545- outer_const_version,
1536+ parent,
15461537 show_def_docs,
15471538 use_absolute,
15481539 is_on_foreign_type,
@@ -1578,12 +1569,13 @@ fn render_impl(
15781569 w. write_str ( & close_tags) ;
15791570}
15801571
1572+ // Render the items that appear on the right side of methods, impls, and
1573+ // associated types. For example "1.0.0 (const: 1.39.0) [src]".
15811574fn render_rightside (
15821575 w : & mut Buffer ,
15831576 cx : & Context < ' _ > ,
15841577 item : & clean:: Item ,
1585- outer_version : Option < & str > ,
1586- outer_const_version : Option < & str > ,
1578+ containing_item : & clean:: Item ,
15871579) {
15881580 let tcx = cx. tcx ( ) ;
15891581
@@ -1592,8 +1584,8 @@ fn render_rightside(
15921584 w,
15931585 item. stable_since ( tcx) . as_deref ( ) ,
15941586 item. const_stable_since ( tcx) . as_deref ( ) ,
1595- outer_version ,
1596- outer_const_version ,
1587+ containing_item . stable_since ( tcx ) . as_deref ( ) ,
1588+ containing_item . const_stable_since ( tcx ) . as_deref ( ) ,
15971589 ) ;
15981590
15991591 write_srclink ( cx, item, w) ;
@@ -1605,8 +1597,7 @@ pub(crate) fn render_impl_summary(
16051597 cx : & Context < ' _ > ,
16061598 i : & Impl ,
16071599 parent : & clean:: Item ,
1608- outer_version : Option < & str > ,
1609- outer_const_version : Option < & str > ,
1600+ containing_item : & clean:: Item ,
16101601 show_def_docs : bool ,
16111602 use_absolute : Option < bool > ,
16121603 is_on_foreign_type : bool ,
@@ -1630,7 +1621,7 @@ pub(crate) fn render_impl_summary(
16301621 format ! ( " data-aliases=\" {}\" " , aliases. join( "," ) )
16311622 } ;
16321623 write ! ( w, "<div id=\" {}\" class=\" impl has-srclink\" {}>" , id, aliases) ;
1633- render_rightside ( w, cx, & i. impl_item , outer_version , outer_const_version ) ;
1624+ render_rightside ( w, cx, & i. impl_item , containing_item ) ;
16341625 write ! ( w, "<a href=\" #{}\" class=\" anchor\" ></a>" , id) ;
16351626 write ! ( w, "<code class=\" in-band\" >" ) ;
16361627
0 commit comments