@@ -1692,13 +1692,13 @@ fn print_item(cx: &Context, item: &clean::Item, buf: &mut Buffer, cache: &Cache)
1692
1692
debug_assert ! ( !item. is_stripped( ) ) ;
1693
1693
// Write the breadcrumb trail header for the top
1694
1694
write ! ( buf, "<h1 class=\" fqn\" ><span class=\" out-of-band\" >" ) ;
1695
- if let Some ( version ) = item . stable_since ( ) {
1696
- write ! (
1697
- buf ,
1698
- "<span class= \" since \" title= \" Stable since Rust version {0} \" >{0}</span>" ,
1699
- version
1700
- ) ;
1701
- }
1695
+ render_stability_since_raw (
1696
+ buf ,
1697
+ item . stable_since ( ) . as_deref ( ) ,
1698
+ item . const_stable_since ( ) . as_deref ( ) ,
1699
+ None ,
1700
+ None ,
1701
+ ) ;
1702
1702
write ! (
1703
1703
buf,
1704
1704
"<span id=\" render-detail\" >\
@@ -2476,6 +2476,7 @@ fn render_implementor(
2476
2476
AssocItemLink :: Anchor ( None ) ,
2477
2477
RenderMode :: Normal ,
2478
2478
implementor. impl_item . stable_since ( ) . as_deref ( ) ,
2479
+ implementor. impl_item . const_stable_since ( ) . as_deref ( ) ,
2479
2480
false ,
2480
2481
Some ( use_absolute) ,
2481
2482
false ,
@@ -2506,6 +2507,7 @@ fn render_impls(
2506
2507
assoc_link,
2507
2508
RenderMode :: Normal ,
2508
2509
containing_item. stable_since ( ) . as_deref ( ) ,
2510
+ containing_item. const_stable_since ( ) . as_deref ( ) ,
2509
2511
true ,
2510
2512
None ,
2511
2513
false ,
@@ -2756,6 +2758,7 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait,
2756
2758
assoc_link,
2757
2759
RenderMode :: Normal ,
2758
2760
implementor. impl_item . stable_since ( ) . as_deref ( ) ,
2761
+ implementor. impl_item . const_stable_since ( ) . as_deref ( ) ,
2759
2762
false ,
2760
2763
None ,
2761
2764
true ,
@@ -2898,10 +2901,40 @@ fn assoc_type(
2898
2901
}
2899
2902
}
2900
2903
2901
- fn render_stability_since_raw ( w : & mut Buffer , ver : Option < & str > , containing_ver : Option < & str > ) {
2904
+ fn render_stability_since_raw (
2905
+ w : & mut Buffer ,
2906
+ ver : Option < & str > ,
2907
+ const_ver : Option < & str > ,
2908
+ containing_ver : Option < & str > ,
2909
+ containing_const_ver : Option < & str > ,
2910
+ ) {
2911
+ let ver = ver. and_then ( |inner| if !inner. is_empty ( ) { Some ( inner) } else { None } ) ;
2912
+
2913
+ let const_ver = const_ver. and_then ( |inner| if !inner. is_empty ( ) { Some ( inner) } else { None } ) ;
2914
+
2902
2915
if let Some ( v) = ver {
2903
- if containing_ver != ver && !v. is_empty ( ) {
2904
- write ! ( w, "<span class=\" since\" title=\" Stable since Rust version {0}\" >{0}</span>" , v)
2916
+ if let Some ( cv) = const_ver {
2917
+ if const_ver != containing_const_ver {
2918
+ write ! (
2919
+ w,
2920
+ "<span class=\" since\" title=\" Stable since Rust version {0}, const since {1}\" >{0} (const: {1})</span>" ,
2921
+ v, cv
2922
+ ) ;
2923
+ } else if ver != containing_ver {
2924
+ write ! (
2925
+ w,
2926
+ "<span class=\" since\" title=\" Stable since Rust version {0}\" >{0}</span>" ,
2927
+ v
2928
+ ) ;
2929
+ }
2930
+ } else {
2931
+ if ver != containing_ver {
2932
+ write ! (
2933
+ w,
2934
+ "<span class=\" since\" title=\" Stable since Rust version {0}\" >{0}</span>" ,
2935
+ v
2936
+ ) ;
2937
+ }
2905
2938
}
2906
2939
}
2907
2940
}
@@ -2910,7 +2943,9 @@ fn render_stability_since(w: &mut Buffer, item: &clean::Item, containing_item: &
2910
2943
render_stability_since_raw (
2911
2944
w,
2912
2945
item. stable_since ( ) . as_deref ( ) ,
2946
+ item. const_stable_since ( ) . as_deref ( ) ,
2913
2947
containing_item. stable_since ( ) . as_deref ( ) ,
2948
+ containing_item. const_stable_since ( ) . as_deref ( ) ,
2914
2949
)
2915
2950
}
2916
2951
@@ -3462,6 +3497,7 @@ fn render_assoc_items(
3462
3497
AssocItemLink :: Anchor ( None ) ,
3463
3498
render_mode,
3464
3499
containing_item. stable_since ( ) . as_deref ( ) ,
3500
+ containing_item. const_stable_since ( ) . as_deref ( ) ,
3465
3501
true ,
3466
3502
None ,
3467
3503
false ,
@@ -3654,6 +3690,7 @@ fn render_impl(
3654
3690
link : AssocItemLink < ' _ > ,
3655
3691
render_mode : RenderMode ,
3656
3692
outer_version : Option < & str > ,
3693
+ outer_const_version : Option < & str > ,
3657
3694
show_def_docs : bool ,
3658
3695
use_absolute : Option < bool > ,
3659
3696
is_on_foreign_type : bool ,
@@ -3705,11 +3742,13 @@ fn render_impl(
3705
3742
) ;
3706
3743
}
3707
3744
write ! ( w, "<a href=\" #{}\" class=\" anchor\" ></a>" , id) ;
3708
- let since = i. impl_item . stability . as_ref ( ) . and_then ( |s| match s. level {
3709
- StabilityLevel :: Stable { since } => Some ( since. as_str ( ) ) ,
3710
- StabilityLevel :: Unstable { .. } => None ,
3711
- } ) ;
3712
- render_stability_since_raw ( w, since. as_deref ( ) , outer_version) ;
3745
+ render_stability_since_raw (
3746
+ w,
3747
+ i. impl_item . stable_since ( ) . as_deref ( ) ,
3748
+ i. impl_item . const_stable_since ( ) . as_deref ( ) ,
3749
+ outer_version,
3750
+ outer_const_version,
3751
+ ) ;
3713
3752
write_srclink ( cx, & i. impl_item , w, cache) ;
3714
3753
write ! ( w, "</h3>" ) ;
3715
3754
@@ -3746,6 +3785,7 @@ fn render_impl(
3746
3785
render_mode : RenderMode ,
3747
3786
is_default_item : bool ,
3748
3787
outer_version : Option < & str > ,
3788
+ outer_const_version : Option < & str > ,
3749
3789
trait_ : Option < & clean:: Trait > ,
3750
3790
show_def_docs : bool ,
3751
3791
cache : & Cache ,
@@ -3775,7 +3815,13 @@ fn render_impl(
3775
3815
write ! ( w, "<code>" ) ;
3776
3816
render_assoc_item ( w, item, link. anchor ( & id) , ItemType :: Impl ) ;
3777
3817
write ! ( w, "</code>" ) ;
3778
- render_stability_since_raw ( w, item. stable_since ( ) . as_deref ( ) , outer_version) ;
3818
+ render_stability_since_raw (
3819
+ w,
3820
+ item. stable_since ( ) . as_deref ( ) ,
3821
+ item. const_stable_since ( ) . as_deref ( ) ,
3822
+ outer_version,
3823
+ outer_const_version,
3824
+ ) ;
3779
3825
write_srclink ( cx, item, w, cache) ;
3780
3826
write ! ( w, "</h4>" ) ;
3781
3827
}
@@ -3791,7 +3837,13 @@ fn render_impl(
3791
3837
write ! ( w, "<h4 id=\" {}\" class=\" {}{}\" ><code>" , id, item_type, extra_class) ;
3792
3838
assoc_const ( w, item, ty, default. as_ref ( ) , link. anchor ( & id) , "" ) ;
3793
3839
write ! ( w, "</code>" ) ;
3794
- render_stability_since_raw ( w, item. stable_since ( ) . as_deref ( ) , outer_version) ;
3840
+ render_stability_since_raw (
3841
+ w,
3842
+ item. stable_since ( ) . as_deref ( ) ,
3843
+ item. const_stable_since ( ) . as_deref ( ) ,
3844
+ outer_version,
3845
+ outer_const_version,
3846
+ ) ;
3795
3847
write_srclink ( cx, item, w, cache) ;
3796
3848
write ! ( w, "</h4>" ) ;
3797
3849
}
@@ -3854,6 +3906,7 @@ fn render_impl(
3854
3906
render_mode,
3855
3907
false ,
3856
3908
outer_version,
3909
+ outer_const_version,
3857
3910
trait_,
3858
3911
show_def_docs,
3859
3912
cache,
@@ -3868,6 +3921,7 @@ fn render_impl(
3868
3921
parent : & clean:: Item ,
3869
3922
render_mode : RenderMode ,
3870
3923
outer_version : Option < & str > ,
3924
+ outer_const_version : Option < & str > ,
3871
3925
show_def_docs : bool ,
3872
3926
cache : & Cache ,
3873
3927
) {
@@ -3888,6 +3942,7 @@ fn render_impl(
3888
3942
render_mode,
3889
3943
true ,
3890
3944
outer_version,
3945
+ outer_const_version,
3891
3946
None ,
3892
3947
show_def_docs,
3893
3948
cache,
@@ -3909,6 +3964,7 @@ fn render_impl(
3909
3964
& i. impl_item ,
3910
3965
render_mode,
3911
3966
outer_version,
3967
+ outer_const_version,
3912
3968
show_def_docs,
3913
3969
cache,
3914
3970
) ;
0 commit comments