@@ -147,6 +147,7 @@ macro_rules! item_template_methods {
147
147
const ITEM_TABLE_OPEN : & str = "<ul class=\" item-table\" >" ;
148
148
const ITEM_TABLE_CLOSE : & str = "</ul>" ;
149
149
const ITEM_TABLE_ROW_OPEN : & str = "<li>" ;
150
+ const ITEM_TABLE_ROW_OPEN_UNSTABLE : & str = "<li class=\" unstable\" >" ;
150
151
const ITEM_TABLE_ROW_CLOSE : & str = "</li>" ;
151
152
152
153
// A component in a `use` path, like `string` in std::string::ToString
@@ -527,7 +528,12 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items:
527
528
_ => "" ,
528
529
} ;
529
530
530
- w. write_str ( ITEM_TABLE_ROW_OPEN ) ;
531
+ w. write_str ( if is_unstable ( myitem, tcx) {
532
+ ITEM_TABLE_ROW_OPEN_UNSTABLE
533
+ } else {
534
+ ITEM_TABLE_ROW_OPEN
535
+ } ) ;
536
+
531
537
let docs =
532
538
MarkdownSummaryLine ( & myitem. doc_value ( ) , & myitem. links ( cx) ) . into_string ( ) ;
533
539
let ( docs_before, docs_after) = if docs. is_empty ( ) {
@@ -594,11 +600,7 @@ fn extra_info_tags<'a, 'tcx: 'a>(
594
600
write ! ( f, "{}" , tag_html( "deprecated" , "" , message) ) ?;
595
601
}
596
602
597
- // The "rustc_private" crates are permanently unstable so it makes no sense
598
- // to render "unstable" everywhere.
599
- if item. stability ( tcx) . as_ref ( ) . map ( |s| s. is_unstable ( ) && s. feature != sym:: rustc_private)
600
- == Some ( true )
601
- {
603
+ if is_unstable ( item, tcx) {
602
604
write ! ( f, "{}" , tag_html( "unstable" , "" , "Experimental" ) ) ?;
603
605
}
604
606
@@ -625,6 +627,13 @@ fn extra_info_tags<'a, 'tcx: 'a>(
625
627
} )
626
628
}
627
629
630
+ fn is_unstable < ' a , ' tcx : ' a > ( item : & ' a clean:: Item , tcx : TyCtxt < ' tcx > ) -> bool {
631
+ // The "rustc_private" crates are permanently unstable so it makes no sense
632
+ // to render "unstable" everywhere.
633
+ item. stability ( tcx) . as_ref ( ) . map ( |s| s. is_unstable ( ) && s. feature != sym:: rustc_private)
634
+ == Some ( true )
635
+ }
636
+
628
637
fn item_function ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , f : & clean:: Function ) {
629
638
let tcx = cx. tcx ( ) ;
630
639
let header = it. fn_header ( tcx) . expect ( "printing a function which isn't a function" ) ;
0 commit comments