@@ -684,6 +684,12 @@ enum ShortItemInfo {
684684 Portability {
685685 message : String ,
686686 } ,
687+ /// The feature corresponding to a const unstable item, and optionally
688+ /// a tracking issue URL and number.
689+ ConstUnstable {
690+ feature : String ,
691+ tracking : Option < u32 > ,
692+ } ,
687693}
688694
689695/// Render the stability, deprecation and portability information that is displayed at the top of
@@ -723,10 +729,10 @@ fn short_item_info(
723729 extra_info. push ( ShortItemInfo :: Deprecation { message } ) ;
724730 }
725731
732+ let stability = item. stability ( cx. tcx ( ) ) ;
726733 // Render unstable items. But don't render "rustc_private" crates (internal compiler crates).
727734 // Those crates are permanently unstable so it makes no sense to render "unstable" everywhere.
728- if let Some ( ( StabilityLevel :: Unstable { reason : _, issue, .. } , feature) ) = item
729- . stability ( cx. tcx ( ) )
735+ if let Some ( ( StabilityLevel :: Unstable { reason : _, issue, .. } , feature) ) = stability
730736 . as_ref ( )
731737 . filter ( |stab| stab. feature != sym:: rustc_private)
732738 . map ( |stab| ( stab. level , stab. feature ) )
@@ -740,6 +746,18 @@ fn short_item_info(
740746 extra_info. push ( ShortItemInfo :: Unstable { feature : feature. to_string ( ) , tracking } ) ;
741747 }
742748
749+ // Only display const unstable if NOT entirely unstable.
750+ if stability. and_then ( |stability| stability. stable_since ( ) ) . is_some ( )
751+ && let Some ( ConstStability {
752+ level : StabilityLevel :: Unstable { issue, .. } , feature, ..
753+ } ) = item. const_stability ( cx. tcx ( ) )
754+ {
755+ extra_info. push ( ShortItemInfo :: ConstUnstable {
756+ feature : feature. to_string ( ) ,
757+ tracking : issue. map ( |issue| issue. get ( ) ) ,
758+ } ) ;
759+ }
760+
743761 if let Some ( message) = portability ( item, parent) {
744762 extra_info. push ( ShortItemInfo :: Portability { message } ) ;
745763 }
0 commit comments