@@ -723,6 +723,8 @@ fn short_item_info(
723
723
extra_info
724
724
}
725
725
726
+ // Render the list of items inside one of the sections "Trait Implementations",
727
+ // "Auto Trait Implementations," "Blanket Trait Implementations" (on struct/enum pages).
726
728
fn render_impls (
727
729
cx : & Context < ' _ > ,
728
730
w : & mut Buffer ,
@@ -745,8 +747,6 @@ fn render_impls(
745
747
containing_item,
746
748
assoc_link,
747
749
RenderMode :: Normal ,
748
- containing_item. stable_since ( tcx) . as_deref ( ) ,
749
- containing_item. const_stable_since ( tcx) . as_deref ( ) ,
750
750
true ,
751
751
None ,
752
752
false ,
@@ -1024,7 +1024,6 @@ fn render_assoc_items(
1024
1024
Some ( v) => v,
1025
1025
None => return ,
1026
1026
} ;
1027
- let tcx = cx. tcx ( ) ;
1028
1027
let cache = cx. cache ( ) ;
1029
1028
let ( non_trait, traits) : ( Vec < _ > , _ ) = v. iter ( ) . partition ( |i| i. inner_impl ( ) . trait_ . is_none ( ) ) ;
1030
1029
if !non_trait. is_empty ( ) {
@@ -1058,8 +1057,6 @@ fn render_assoc_items(
1058
1057
containing_item,
1059
1058
AssocItemLink :: Anchor ( None ) ,
1060
1059
render_mode,
1061
- containing_item. stable_since ( tcx) . as_deref ( ) ,
1062
- containing_item. const_stable_since ( tcx) . as_deref ( ) ,
1063
1060
true ,
1064
1061
None ,
1065
1062
false ,
@@ -1260,8 +1257,6 @@ fn render_impl(
1260
1257
parent : & clean:: Item ,
1261
1258
link : AssocItemLink < ' _ > ,
1262
1259
render_mode : RenderMode ,
1263
- outer_version : Option < & str > ,
1264
- outer_const_version : Option < & str > ,
1265
1260
show_def_docs : bool ,
1266
1261
use_absolute : Option < bool > ,
1267
1262
is_on_foreign_type : bool ,
@@ -1278,17 +1273,18 @@ fn render_impl(
1278
1273
// For trait implementations, the `interesting` output contains all methods that have doc
1279
1274
// comments, and the `boring` output contains all methods that do not. The distinction is
1280
1275
// 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.
1281
1278
fn doc_impl_item (
1282
1279
boring : & mut Buffer ,
1283
1280
interesting : & mut Buffer ,
1284
1281
cx : & Context < ' _ > ,
1285
1282
item : & clean:: Item ,
1286
1283
parent : & clean:: Item ,
1284
+ containing_item : & clean:: Item ,
1287
1285
link : AssocItemLink < ' _ > ,
1288
1286
render_mode : RenderMode ,
1289
1287
is_default_item : bool ,
1290
- outer_version : Option < & str > ,
1291
- outer_const_version : Option < & str > ,
1292
1288
trait_ : Option < & clean:: Trait > ,
1293
1289
show_def_docs : bool ,
1294
1290
) {
@@ -1362,7 +1358,7 @@ fn render_impl(
1362
1358
"<div id=\" {}\" class=\" {}{} has-srclink\" >" ,
1363
1359
id, item_type, in_trait_class,
1364
1360
) ;
1365
- render_rightside ( w, cx, item, outer_version , outer_const_version ) ;
1361
+ render_rightside ( w, cx, item, containing_item ) ;
1366
1362
write ! ( w, "<a href=\" #{}\" class=\" anchor\" ></a>" , id) ;
1367
1363
w. write_str ( "<code>" ) ;
1368
1364
render_assoc_item (
@@ -1406,7 +1402,7 @@ fn render_impl(
1406
1402
"<div id=\" {}\" class=\" {}{} has-srclink\" >" ,
1407
1403
id, item_type, in_trait_class
1408
1404
) ;
1409
- render_rightside ( w, cx, item, outer_version , outer_const_version ) ;
1405
+ render_rightside ( w, cx, item, containing_item ) ;
1410
1406
write ! ( w, "<a href=\" #{}\" class=\" anchor\" ></a>" , id) ;
1411
1407
w. write_str ( "<code>" ) ;
1412
1408
assoc_const (
@@ -1461,11 +1457,10 @@ fn render_impl(
1461
1457
cx,
1462
1458
trait_item,
1463
1459
if trait_. is_some ( ) { & i. impl_item } else { parent } ,
1460
+ parent,
1464
1461
link,
1465
1462
render_mode,
1466
1463
false ,
1467
- outer_version,
1468
- outer_const_version,
1469
1464
trait_. map ( |t| & t. trait_ ) ,
1470
1465
show_def_docs,
1471
1466
) ;
@@ -1478,9 +1473,8 @@ fn render_impl(
1478
1473
t : & clean:: Trait ,
1479
1474
i : & clean:: Impl ,
1480
1475
parent : & clean:: Item ,
1476
+ containing_item : & clean:: Item ,
1481
1477
render_mode : RenderMode ,
1482
- outer_version : Option < & str > ,
1483
- outer_const_version : Option < & str > ,
1484
1478
show_def_docs : bool ,
1485
1479
) {
1486
1480
for trait_item in & t. items {
@@ -1498,11 +1492,10 @@ fn render_impl(
1498
1492
cx,
1499
1493
trait_item,
1500
1494
parent,
1495
+ containing_item,
1501
1496
assoc_link,
1502
1497
render_mode,
1503
1498
true ,
1504
- outer_version,
1505
- outer_const_version,
1506
1499
Some ( t) ,
1507
1500
show_def_docs,
1508
1501
) ;
@@ -1522,9 +1515,8 @@ fn render_impl(
1522
1515
& t. trait_ ,
1523
1516
& i. inner_impl ( ) ,
1524
1517
& i. impl_item ,
1518
+ parent,
1525
1519
render_mode,
1526
- outer_version,
1527
- outer_const_version,
1528
1520
show_def_docs,
1529
1521
) ;
1530
1522
}
@@ -1541,8 +1533,7 @@ fn render_impl(
1541
1533
cx,
1542
1534
i,
1543
1535
parent,
1544
- outer_version,
1545
- outer_const_version,
1536
+ parent,
1546
1537
show_def_docs,
1547
1538
use_absolute,
1548
1539
is_on_foreign_type,
@@ -1578,12 +1569,13 @@ fn render_impl(
1578
1569
w. write_str ( & close_tags) ;
1579
1570
}
1580
1571
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]".
1581
1574
fn render_rightside (
1582
1575
w : & mut Buffer ,
1583
1576
cx : & Context < ' _ > ,
1584
1577
item : & clean:: Item ,
1585
- outer_version : Option < & str > ,
1586
- outer_const_version : Option < & str > ,
1578
+ containing_item : & clean:: Item ,
1587
1579
) {
1588
1580
let tcx = cx. tcx ( ) ;
1589
1581
@@ -1592,8 +1584,8 @@ fn render_rightside(
1592
1584
w,
1593
1585
item. stable_since ( tcx) . as_deref ( ) ,
1594
1586
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 ( ) ,
1597
1589
) ;
1598
1590
1599
1591
write_srclink ( cx, item, w) ;
@@ -1605,8 +1597,7 @@ pub(crate) fn render_impl_summary(
1605
1597
cx : & Context < ' _ > ,
1606
1598
i : & Impl ,
1607
1599
parent : & clean:: Item ,
1608
- outer_version : Option < & str > ,
1609
- outer_const_version : Option < & str > ,
1600
+ containing_item : & clean:: Item ,
1610
1601
show_def_docs : bool ,
1611
1602
use_absolute : Option < bool > ,
1612
1603
is_on_foreign_type : bool ,
@@ -1630,7 +1621,7 @@ pub(crate) fn render_impl_summary(
1630
1621
format ! ( " data-aliases=\" {}\" " , aliases. join( "," ) )
1631
1622
} ;
1632
1623
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 ) ;
1634
1625
write ! ( w, "<a href=\" #{}\" class=\" anchor\" ></a>" , id) ;
1635
1626
write ! ( w, "<code class=\" in-band\" >" ) ;
1636
1627
0 commit comments