@@ -684,6 +684,12 @@ enum ShortItemInfo {
684
684
Portability {
685
685
message : String ,
686
686
} ,
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
+ } ,
687
693
}
688
694
689
695
/// Render the stability, deprecation and portability information that is displayed at the top of
@@ -723,10 +729,10 @@ fn short_item_info(
723
729
extra_info. push ( ShortItemInfo :: Deprecation { message } ) ;
724
730
}
725
731
732
+ let stability = item. stability ( cx. tcx ( ) ) ;
726
733
// Render unstable items. But don't render "rustc_private" crates (internal compiler crates).
727
734
// 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
730
736
. as_ref ( )
731
737
. filter ( |stab| stab. feature != sym:: rustc_private)
732
738
. map ( |stab| ( stab. level , stab. feature ) )
@@ -740,6 +746,18 @@ fn short_item_info(
740
746
extra_info. push ( ShortItemInfo :: Unstable { feature : feature. to_string ( ) , tracking } ) ;
741
747
}
742
748
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
+
743
761
if let Some ( message) = portability ( item, parent) {
744
762
extra_info. push ( ShortItemInfo :: Portability { message } ) ;
745
763
}
0 commit comments