@@ -42,7 +42,7 @@ use std::str;
4242use std:: string:: ToString ;
4343
4444use rustc_ast_pretty:: pprust;
45- use rustc_attr:: { Deprecation , StabilityLevel } ;
45+ use rustc_attr:: { ConstStability , Deprecation , StabilityLevel } ;
4646use rustc_data_structures:: fx:: FxHashSet ;
4747use rustc_hir as hir;
4848use rustc_hir:: def:: CtorKind ;
@@ -826,20 +826,42 @@ fn assoc_type(
826826fn render_stability_since_raw (
827827 w : & mut Buffer ,
828828 ver : Option < & str > ,
829- const_ver : Option < & str > ,
829+ const_stability : Option < & ConstStability > ,
830830 containing_ver : Option < & str > ,
831831 containing_const_ver : Option < & str > ,
832832) {
833833 let ver = ver. filter ( |inner| !inner. is_empty ( ) ) ;
834- let const_ver = const_ver. filter ( |inner| !inner. is_empty ( ) ) ;
835834
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+ {
838839 write ! (
839840 w,
840841 "<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
842854 ) ;
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>" ) ;
843865 }
844866 ( Some ( v) , _) if ver != containing_ver => {
845867 write ! (
@@ -1583,7 +1605,7 @@ fn render_rightside(
15831605 render_stability_since_raw (
15841606 w,
15851607 item. stable_since ( tcx) . as_deref ( ) ,
1586- item. const_stable_since ( tcx) . as_deref ( ) ,
1608+ item. const_stability ( tcx) ,
15871609 containing_item. stable_since ( tcx) . as_deref ( ) ,
15881610 containing_item. const_stable_since ( tcx) . as_deref ( ) ,
15891611 ) ;
0 commit comments