From fe6956b7be4d619d98154a5ade5b5c21cb128732 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 18 Aug 2022 15:47:39 +0200 Subject: [PATCH 1/2] Fix item-info display --- src/librustdoc/html/render/mod.rs | 12 ++++++++---- src/librustdoc/html/static/css/rustdoc.css | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 5ed5299e09bc0..13d955c618a4f 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -569,7 +569,10 @@ fn short_item_info( message.push_str(&format!(": {}", html.into_string())); } extra_info.push(format!( - "
👎 {}
", + "
\ + 👎\ + {}\ +
", message, )); } @@ -582,8 +585,9 @@ fn short_item_info( .filter(|stab| stab.feature != sym::rustc_private) .map(|stab| (stab.level, stab.feature)) { - let mut message = - "🔬 This is a nightly-only experimental API.".to_owned(); + let mut message = "🔬\ + This is a nightly-only experimental API." + .to_owned(); let mut feature = format!("{}", Escape(feature.as_str())); if let (Some(url), Some(issue)) = (&cx.shared.issue_tracker_base_url, issue) { @@ -594,7 +598,7 @@ fn short_item_info( )); } - message.push_str(&format!(" ({})", feature)); + message.push_str(&format!(" ({})", feature)); extra_info.push(format!("
{}
", message)); } diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 710ca3ee7c7e7..52a7d04458409 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -1172,6 +1172,7 @@ so that we can apply CSS-filters to change the arrow color in themes */ .stab .emoji { font-size: 1.25rem; + margin-right: 0.3rem; } /* Black one-pixel outline around emoji shapes */ From 0df1c690231c108fcfaa3ba3e22be37fa4fb8fc4 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 18 Aug 2022 17:47:40 +0200 Subject: [PATCH 2/2] Update rustdoc test --- src/test/rustdoc/issue-32374.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/test/rustdoc/issue-32374.rs b/src/test/rustdoc/issue-32374.rs index 9c585497d354f..8d2c27cf3d77d 100644 --- a/src/test/rustdoc/issue-32374.rs +++ b/src/test/rustdoc/issue-32374.rs @@ -8,20 +8,24 @@ // 'Experimental' // @matches issue_32374/index.html '//*[@class="item-right docblock-short"]/text()' 'Docs' -// @has issue_32374/struct.T.html '//*[@class="stab deprecated"]' \ -// '👎 Deprecated since 1.0.0: text' +// @has issue_32374/struct.T.html '//*[@class="stab deprecated"]/span' '👎' +// @has issue_32374/struct.T.html '//*[@class="stab deprecated"]/span' \ +// 'Deprecated since 1.0.0: text' // @hasraw - 'test #32374' +// @matches issue_32374/struct.T.html '//*[@class="stab unstable"]' '🔬' // @matches issue_32374/struct.T.html '//*[@class="stab unstable"]' \ -// '🔬 This is a nightly-only experimental API. \(test\s#32374\)$' +// 'This is a nightly-only experimental API. \(test\s#32374\)$' /// Docs #[deprecated(since = "1.0.0", note = "text")] #[unstable(feature = "test", issue = "32374")] pub struct T; +// @has issue_32374/struct.U.html '//*[@class="stab deprecated"]' '👎' // @has issue_32374/struct.U.html '//*[@class="stab deprecated"]' \ -// '👎 Deprecated since 1.0.0: deprecated' +// 'Deprecated since 1.0.0: deprecated' +// @has issue_32374/struct.U.html '//*[@class="stab unstable"]' '🔬' // @has issue_32374/struct.U.html '//*[@class="stab unstable"]' \ -// '🔬 This is a nightly-only experimental API. (test #32374)' +// 'This is a nightly-only experimental API. (test #32374)' #[deprecated(since = "1.0.0", note = "deprecated")] #[unstable(feature = "test", issue = "32374", reason = "unstable")] pub struct U;