Feature gate is always present
This commit is contained in:
parent
20c5044465
commit
6bbf4558ac
@ -2358,7 +2358,7 @@ impl Clean<Stability> for attr::Stability {
|
|||||||
fn clean(&self, _: &DocContext<'_>) -> Stability {
|
fn clean(&self, _: &DocContext<'_>) -> Stability {
|
||||||
Stability {
|
Stability {
|
||||||
level: stability::StabilityLevel::from_attr_level(&self.level),
|
level: stability::StabilityLevel::from_attr_level(&self.level),
|
||||||
feature: Some(self.feature.to_string()).filter(|f| !f.is_empty()),
|
feature: self.feature.to_string(),
|
||||||
since: match self.level {
|
since: match self.level {
|
||||||
attr::Stable { ref since } => since.to_string(),
|
attr::Stable { ref since } => since.to_string(),
|
||||||
_ => String::new(),
|
_ => String::new(),
|
||||||
|
@ -1525,7 +1525,7 @@ pub struct ProcMacro {
|
|||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Stability {
|
pub struct Stability {
|
||||||
pub level: stability::StabilityLevel,
|
pub level: stability::StabilityLevel,
|
||||||
pub feature: Option<String>,
|
pub feature: String,
|
||||||
pub since: String,
|
pub since: String,
|
||||||
pub unstable_reason: Option<String>,
|
pub unstable_reason: Option<String>,
|
||||||
pub issue: Option<NonZeroU32>,
|
pub issue: Option<NonZeroU32>,
|
||||||
|
@ -2126,7 +2126,7 @@ fn stability_tags(item: &clean::Item) -> String {
|
|||||||
if item
|
if item
|
||||||
.stability
|
.stability
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|s| s.level == stability::Unstable && s.feature.as_deref() != Some("rustc_private"))
|
.map(|s| s.level == stability::Unstable && s.feature != "rustc_private")
|
||||||
== Some(true)
|
== Some(true)
|
||||||
{
|
{
|
||||||
tags += &tag_html("unstable", "Experimental");
|
tags += &tag_html("unstable", "Experimental");
|
||||||
@ -2177,25 +2177,25 @@ fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> {
|
|||||||
|
|
||||||
// Render unstable items. But don't render "rustc_private" crates (internal compiler crates).
|
// Render unstable items. But don't render "rustc_private" crates (internal compiler crates).
|
||||||
// Those crates are permanently unstable so it makes no sense to render "unstable" everywhere.
|
// Those crates are permanently unstable so it makes no sense to render "unstable" everywhere.
|
||||||
if let Some(stab) = item.stability.as_ref().filter(|stab| {
|
if let Some(stab) = item
|
||||||
stab.level == stability::Unstable && stab.feature.as_deref() != Some("rustc_private")
|
.stability
|
||||||
}) {
|
.as_ref()
|
||||||
|
.filter(|stab| stab.level == stability::Unstable && stab.feature != "rustc_private")
|
||||||
|
{
|
||||||
let mut message =
|
let mut message =
|
||||||
"<span class='emoji'>🔬</span> This is a nightly-only experimental API.".to_owned();
|
"<span class='emoji'>🔬</span> This is a nightly-only experimental API.".to_owned();
|
||||||
|
|
||||||
if let Some(feature) = stab.feature.as_deref() {
|
let mut feature = format!("<code>{}</code>", Escape(&stab.feature));
|
||||||
let mut feature = format!("<code>{}</code>", Escape(&feature));
|
if let (Some(url), Some(issue)) = (&cx.shared.issue_tracker_base_url, stab.issue) {
|
||||||
if let (Some(url), Some(issue)) = (&cx.shared.issue_tracker_base_url, stab.issue) {
|
feature.push_str(&format!(
|
||||||
feature.push_str(&format!(
|
" <a href=\"{url}{issue}\">#{issue}</a>",
|
||||||
" <a href=\"{url}{issue}\">#{issue}</a>",
|
url = url,
|
||||||
url = url,
|
issue = issue
|
||||||
issue = issue
|
));
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
message.push_str(&format!(" ({})", feature));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message.push_str(&format!(" ({})", feature));
|
||||||
|
|
||||||
if let Some(unstable_reason) = &stab.unstable_reason {
|
if let Some(unstable_reason) = &stab.unstable_reason {
|
||||||
let mut ids = cx.id_map.borrow_mut();
|
let mut ids = cx.id_map.borrow_mut();
|
||||||
message = format!(
|
message = format!(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user