diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2016-02-03 02:54:24 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2016-02-03 02:54:24 +0530 |
| commit | 93042f2bfb512bf979d79573dfe4ebd9e4c4cb88 (patch) | |
| tree | a16b735d7c734ede40dff08f2e12dd240bff5afd | |
| parent | ae96e51ac74ddfec533f5cd60b2bc91ec2dabcd4 (diff) | |
| parent | d59372b7aad364a287f21cfbcf12e85d8be97fc7 (diff) | |
| download | rust-93042f2bfb512bf979d79573dfe4ebd9e4c4cb88.tar.gz rust-93042f2bfb512bf979d79573dfe4ebd9e4c4cb88.zip | |
Rollup merge of #31329 - quodlibetor:no-const-doc-in-stable, r=alexcrichton
Fixes #31098 AFAICT this is the only place where rustdoc explicitly checks if we are on stable before emitting content, so I can't tell if this is the sane way to handle this, or if anything else should be done to make sure that nobody forgets to remove this check when `const` is stabilized.
| -rw-r--r-- | src/librustdoc/html/render.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 850045382e1..dfbe08a0e42 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -54,10 +54,12 @@ use externalfiles::ExternalHtml; use serialize::json::{self, ToJson}; use syntax::{abi, ast}; +use syntax::feature_gate::UnstableFeatures; use rustc::middle::cstore::LOCAL_CRATE; use rustc::middle::def_id::{CRATE_DEF_INDEX, DefId}; use rustc::middle::privacy::AccessLevels; use rustc::middle::stability; +use rustc::session::config::get_unstable_features_setting; use rustc_front::hir; use clean::{self, SelfTy}; @@ -1897,10 +1899,14 @@ fn item_static(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, fn item_function(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, f: &clean::Function) -> fmt::Result { + let vis_constness = match get_unstable_features_setting() { + UnstableFeatures::Allow => f.constness, + _ => hir::Constness::NotConst + }; try!(write!(w, "<pre class='rust fn'>{vis}{constness}{unsafety}{abi}fn \ {name}{generics}{decl}{where_clause}</pre>", vis = VisSpace(it.visibility), - constness = ConstnessSpace(f.constness), + constness = ConstnessSpace(vis_constness), unsafety = UnsafetySpace(f.unsafety), abi = AbiSpace(f.abi), name = it.name.as_ref().unwrap(), @@ -2122,9 +2128,13 @@ fn render_assoc_item(w: &mut fmt::Formatter, meth: &clean::Item, href(did).map(|p| format!("{}{}", p.0, anchor)).unwrap_or(anchor) } }; + let vis_constness = match get_unstable_features_setting() { + UnstableFeatures::Allow => constness, + _ => hir::Constness::NotConst + }; write!(w, "{}{}{}fn <a href='{href}' class='fnname'>{name}</a>\ {generics}{decl}{where_clause}", - ConstnessSpace(constness), + ConstnessSpace(vis_constness), UnsafetySpace(unsafety), match abi { Abi::Rust => String::new(), |
