diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 5253c1e9b2790..e161f40b7295e 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1871,8 +1871,10 @@ fn short_stability(item: &clean::Item, cx: &Context, show_reason: bool) -> Vec 0 => format!(" ({} #{})", Escape(&stab.feature), tracker_url, issue_no, issue_no), @@ -1882,17 +1884,22 @@ fn short_stability(item: &clean::Item, cx: &Context, show_reason: bool) -> Vec format!(" ({})", Escape(&stab.feature)), _ => String::new(), + }; + if stab.unstable_reason.is_empty() { + stability.push(format!("
\ + 🔬 \ + This is a nightly-only experimental API. {}
", + unstable_extra)); + } else { + let text = format!("🔬 \ + This is a nightly-only experimental API. {}{}", + unstable_extra, MarkdownHtml(&stab.unstable_reason)); + stability.push(format!("
{}
", + text)); } } else { - String::new() - }; - let unstable_reason = if show_reason && !stab.unstable_reason.is_empty() { - format!(": {}", stab.unstable_reason) - } else { - String::new() - }; - let text = format!("Unstable{}{}", unstable_extra, MarkdownHtml(&unstable_reason)); - stability.push(format!("
{}
", text)) + stability.push(format!("
Experimental
")) + } }; } else if let Some(depr) = item.deprecation.as_ref() { let note = if show_reason && !depr.note.is_empty() { diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index 0ca4f7ea36f1b..681d2354056f6 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -535,6 +535,14 @@ body.blur > :not(#help) { display: inline; } +.stab summary { + display: list-item; +} + +.stab .microscope { + font-size: 1.5em; +} + .module-item .stab { display: inline; border-width: 0; diff --git a/src/test/rustdoc/issue-32374.rs b/src/test/rustdoc/issue-32374.rs index dea73317e5e3d..b5edf535057dd 100644 --- a/src/test/rustdoc/issue-32374.rs +++ b/src/test/rustdoc/issue-32374.rs @@ -14,14 +14,14 @@ #![unstable(feature="test", issue = "32374")] // @has issue_32374/index.html '//*[@class="docblock-short"]' \ -// '[Deprecated] [Unstable]' +// '[Deprecated] [Experimental]' // @has issue_32374/struct.T.html '//*[@class="stab deprecated"]' \ // 'Deprecated since 1.0.0: text' // @has - 'test' // @has - '#32374' // @matches issue_32374/struct.T.html '//*[@class="stab unstable"]' \ -// 'Unstable \(test #32374\)$' +// '🔬 This is a nightly-only experimental API. \(test #32374\)$' #[rustc_deprecated(since = "1.0.0", reason = "text")] #[unstable(feature = "test", issue = "32374")] pub struct T; @@ -29,7 +29,13 @@ pub struct T; // @has issue_32374/struct.U.html '//*[@class="stab deprecated"]' \ // 'Deprecated since 1.0.0: deprecated' // @has issue_32374/struct.U.html '//*[@class="stab unstable"]' \ -// 'Unstable (test #32374): unstable' +// '🔬 This is a nightly-only experimental API. (test #32374)' +// @has issue_32374/struct.U.html '//details' \ +// '🔬 This is a nightly-only experimental API. (test #32374)' +// @has issue_32374/struct.U.html '//summary' \ +// '🔬 This is a nightly-only experimental API. (test #32374)' +// @has issue_32374/struct.U.html '//details/p' \ +// 'unstable' #[rustc_deprecated(since = "1.0.0", reason = "deprecated")] #[unstable(feature = "test", issue = "32374", reason = "unstable")] pub struct U;