@@ -54,10 +54,12 @@ use externalfiles::ExternalHtml;
54
54
55
55
use serialize:: json:: { self , ToJson } ;
56
56
use syntax:: { abi, ast} ;
57
+ use syntax:: feature_gate:: UnstableFeatures ;
57
58
use rustc:: middle:: cstore:: LOCAL_CRATE ;
58
59
use rustc:: middle:: def_id:: { CRATE_DEF_INDEX , DefId } ;
59
60
use rustc:: middle:: privacy:: AccessLevels ;
60
61
use rustc:: middle:: stability;
62
+ use rustc:: session:: config:: get_unstable_features_setting;
61
63
use rustc_front:: hir;
62
64
63
65
use clean:: { self , SelfTy } ;
@@ -1897,10 +1899,14 @@ fn item_static(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
1897
1899
1898
1900
fn item_function ( w : & mut fmt:: Formatter , cx : & Context , it : & clean:: Item ,
1899
1901
f : & clean:: Function ) -> fmt:: Result {
1902
+ let vis_constness = match get_unstable_features_setting ( ) {
1903
+ UnstableFeatures :: Allow => f. constness ,
1904
+ _ => hir:: Constness :: NotConst
1905
+ } ;
1900
1906
try!( write ! ( w, "<pre class='rust fn'>{vis}{constness}{unsafety}{abi}fn \
1901
1907
{name}{generics}{decl}{where_clause}</pre>",
1902
1908
vis = VisSpace ( it. visibility) ,
1903
- constness = ConstnessSpace ( f . constness ) ,
1909
+ constness = ConstnessSpace ( vis_constness ) ,
1904
1910
unsafety = UnsafetySpace ( f. unsafety) ,
1905
1911
abi = AbiSpace ( f. abi) ,
1906
1912
name = it. name. as_ref( ) . unwrap( ) ,
@@ -2122,9 +2128,13 @@ fn render_assoc_item(w: &mut fmt::Formatter, meth: &clean::Item,
2122
2128
href ( did) . map ( |p| format ! ( "{}{}" , p. 0 , anchor) ) . unwrap_or ( anchor)
2123
2129
}
2124
2130
} ;
2131
+ let vis_constness = match get_unstable_features_setting ( ) {
2132
+ UnstableFeatures :: Allow => constness,
2133
+ _ => hir:: Constness :: NotConst
2134
+ } ;
2125
2135
write ! ( w, "{}{}{}fn <a href='{href}' class='fnname'>{name}</a>\
2126
2136
{generics}{decl}{where_clause}",
2127
- ConstnessSpace ( constness ) ,
2137
+ ConstnessSpace ( vis_constness ) ,
2128
2138
UnsafetySpace ( unsafety) ,
2129
2139
match abi {
2130
2140
Abi :: Rust => String :: new( ) ,
0 commit comments