@@ -42,7 +42,7 @@ use std::str;
42
42
use std:: string:: ToString ;
43
43
44
44
use rustc_ast_pretty:: pprust;
45
- use rustc_attr:: { Deprecation , StabilityLevel } ;
45
+ use rustc_attr:: { ConstStability , Deprecation , StabilityLevel } ;
46
46
use rustc_data_structures:: fx:: FxHashSet ;
47
47
use rustc_hir as hir;
48
48
use rustc_hir:: def:: CtorKind ;
@@ -826,20 +826,42 @@ fn assoc_type(
826
826
fn render_stability_since_raw (
827
827
w : & mut Buffer ,
828
828
ver : Option < & str > ,
829
- const_ver : Option < & str > ,
829
+ const_stability : Option < & ConstStability > ,
830
830
containing_ver : Option < & str > ,
831
831
containing_const_ver : Option < & str > ,
832
832
) {
833
833
let ver = ver. filter ( |inner| !inner. is_empty ( ) ) ;
834
- let const_ver = const_ver. filter ( |inner| !inner. is_empty ( ) ) ;
835
834
836
- match ( ver, const_ver) {
837
- ( Some ( v) , Some ( cv) ) if const_ver != containing_const_ver => {
835
+ match ( ver, const_stability) {
836
+ ( Some ( v) , Some ( ConstStability { level : StabilityLevel :: Stable { since } , .. } ) )
837
+ if Some ( since. as_str ( ) ) . as_deref ( ) != containing_const_ver =>
838
+ {
838
839
write ! (
839
840
w,
840
841
"<span class=\" since\" title=\" Stable since Rust version {0}, const since {1}\" >{0} (const: {1})</span>" ,
841
- v, cv
842
+ v,
843
+ since. as_str( )
844
+ ) ;
845
+ }
846
+ (
847
+ Some ( v) ,
848
+ Some ( ConstStability { level : StabilityLevel :: Unstable { issue, .. } , feature, .. } ) ,
849
+ ) => {
850
+ write ! (
851
+ w,
852
+ "<span class=\" since\" title=\" Stable since Rust version {0}, const unstable\" >{0} (const: " ,
853
+ v
842
854
) ;
855
+ if let Some ( n) = issue {
856
+ write ! (
857
+ w,
858
+ "<a href=\" https://github.com/rust-lang/rust/issues/{}\" title=\" Tracking issue for {}\" >unstable</a>" ,
859
+ n, feature
860
+ ) ;
861
+ } else {
862
+ write ! ( w, "unstable" ) ;
863
+ }
864
+ write ! ( w, ")</span>" ) ;
843
865
}
844
866
( Some ( v) , _) if ver != containing_ver => {
845
867
write ! (
@@ -1583,7 +1605,7 @@ fn render_rightside(
1583
1605
render_stability_since_raw (
1584
1606
w,
1585
1607
item. stable_since ( tcx) . as_deref ( ) ,
1586
- item. const_stable_since ( tcx) . as_deref ( ) ,
1608
+ item. const_stability ( tcx) ,
1587
1609
containing_item. stable_since ( tcx) . as_deref ( ) ,
1588
1610
containing_item. const_stable_since ( tcx) . as_deref ( ) ,
1589
1611
) ;
0 commit comments