@@ -147,6 +147,7 @@ macro_rules! item_template_methods {
147147const ITEM_TABLE_OPEN : & str = "<ul class=\" item-table\" >" ;
148148const ITEM_TABLE_CLOSE : & str = "</ul>" ;
149149const ITEM_TABLE_ROW_OPEN : & str = "<li>" ;
150+ const ITEM_TABLE_ROW_OPEN_UNSTABLE : & str = "<li class=\" unstable\" >" ;
150151const ITEM_TABLE_ROW_CLOSE : & str = "</li>" ;
151152
152153// 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:
527528 _ => "" ,
528529 } ;
529530
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+
531537 let docs =
532538 MarkdownSummaryLine ( & myitem. doc_value ( ) , & myitem. links ( cx) ) . into_string ( ) ;
533539 let ( docs_before, docs_after) = if docs. is_empty ( ) {
@@ -594,11 +600,7 @@ fn extra_info_tags<'a, 'tcx: 'a>(
594600 write ! ( f, "{}" , tag_html( "deprecated" , "" , message) ) ?;
595601 }
596602
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) {
602604 write ! ( f, "{}" , tag_html( "unstable" , "" , "Experimental" ) ) ?;
603605 }
604606
@@ -625,6 +627,13 @@ fn extra_info_tags<'a, 'tcx: 'a>(
625627 } )
626628}
627629
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+
628637fn item_function ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , f : & clean:: Function ) {
629638 let tcx = cx. tcx ( ) ;
630639 let header = it. fn_header ( tcx) . expect ( "printing a function which isn't a function" ) ;
0 commit comments