Skip to content

Commit 9390b50

Browse files
Rollup merge of #91075 - jsha:chill-item-info, r=GuillaumeGomez
Reduce prominence of item-infos Fixes #59853 - Remove border. - Reduce size of emoji slightly. - Remove details disclosure for unstable reason. This was inconsistent with our other details disclosures, and the detail revealed was usually better explained by clicking on the issue link. Demo: https://rustdoc.crud.net/jsha/chill-item-info/std/mem/union.MaybeUninit.html#method.slice_assume_init_ref Compare vs: https://doc.rust-lang.org/nightly/std/mem/union.MaybeUninit.html#method.slice_assume_init_ref <img src="https://user-images.githubusercontent.com/220205/142717815-09828c9e-6ff4-445a-8ccc-31e028fd4985.png" width=700>
2 parents a6a1d7c + e6ab982 commit 9390b50

File tree

4 files changed

+4
-29
lines changed

4 files changed

+4
-29
lines changed

src/librustdoc/html/render/mod.rs

+1-17
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ fn short_item_info(
682682

683683
// Render unstable items. But don't render "rustc_private" crates (internal compiler crates).
684684
// Those crates are permanently unstable so it makes no sense to render "unstable" everywhere.
685-
if let Some((StabilityLevel::Unstable { reason, issue, .. }, feature)) = item
685+
if let Some((StabilityLevel::Unstable { reason: _, issue, .. }, feature)) = item
686686
.stability(cx.tcx())
687687
.as_ref()
688688
.filter(|stab| stab.feature != sym::rustc_private)
@@ -702,22 +702,6 @@ fn short_item_info(
702702

703703
message.push_str(&format!(" ({})", feature));
704704

705-
if let Some(unstable_reason) = reason {
706-
let mut ids = cx.id_map.borrow_mut();
707-
message = format!(
708-
"<details><summary>{}</summary>{}</details>",
709-
message,
710-
MarkdownHtml(
711-
&unstable_reason.as_str(),
712-
&mut ids,
713-
error_codes,
714-
cx.shared.edition(),
715-
&cx.shared.playground,
716-
)
717-
.into_string()
718-
);
719-
}
720-
721705
extra_info.push(format!("<div class=\"stab unstable\">{}</div>", message));
722706
}
723707

src/librustdoc/html/static/css/rustdoc.css

+1-3
Original file line numberDiff line numberDiff line change
@@ -964,8 +964,6 @@ body.blur > :not(#help) {
964964
display: table;
965965
}
966966
.stab {
967-
border-width: 1px;
968-
border-style: solid;
969967
padding: 3px;
970968
margin-bottom: 5px;
971969
font-size: 90%;
@@ -976,7 +974,7 @@ body.blur > :not(#help) {
976974
}
977975

978976
.stab .emoji {
979-
font-size: 1.5em;
977+
font-size: 1.2em;
980978
}
981979

982980
/* Black one-pixel outline around emoji shapes */

src/test/rustdoc-gui/item-info-width.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ goto: file://|DOC_PATH|/lib2/struct.Foo.html
44
size: (1100, 800)
55
// We check that ".item-info" is bigger than its content.
66
assert-css: (".item-info", {"width": "807px"})
7-
assert-css: (".item-info .stab", {"width": "343px"})
7+
assert-css: (".item-info .stab", {"width": "341px"})

src/test/rustdoc/issue-32374.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#![feature(staged_api)]
22
#![doc(issue_tracker_base_url = "https://issue_url/")]
3-
4-
#![unstable(feature="test", issue = "32374")]
3+
#![unstable(feature = "test", issue = "32374")]
54

65
// @matches issue_32374/index.html '//*[@class="item-left unstable deprecated module-item"]/span[@class="stab deprecated"]' \
76
// 'Deprecated'
@@ -23,12 +22,6 @@ pub struct T;
2322
// '👎 Deprecated since 1.0.0: deprecated'
2423
// @has issue_32374/struct.U.html '//*[@class="stab unstable"]' \
2524
// '🔬 This is a nightly-only experimental API. (test #32374)'
26-
// @has issue_32374/struct.U.html '//details' \
27-
// '🔬 This is a nightly-only experimental API. (test #32374)'
28-
// @has issue_32374/struct.U.html '//summary' \
29-
// '🔬 This is a nightly-only experimental API. (test #32374)'
30-
// @has issue_32374/struct.U.html '//details/p' \
31-
// 'unstable'
3225
#[rustc_deprecated(since = "1.0.0", reason = "deprecated")]
3326
#[unstable(feature = "test", issue = "32374", reason = "unstable")]
3427
pub struct U;

0 commit comments

Comments
 (0)