Skip to content

Commit f75b350

Browse files
committed
rustdoc: stop making unstable items transparent
Fixes #93393
1 parent a64ef7d commit f75b350

File tree

5 files changed

+12
-23
lines changed

5 files changed

+12
-23
lines changed

src/librustdoc/html/render/print_item.rs

+5-14
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items:
355355
}
356356

357357
clean::ImportItem(ref import) => {
358-
let (stab, stab_tags) = if let Some(import_def_id) = import.source.did {
358+
let stab_tags = if let Some(import_def_id) = import.source.did {
359359
let ast_attrs = cx.tcx().get_attrs_unchecked(import_def_id);
360360
let import_attrs = Box::new(clean::Attributes::from_ast(ast_attrs));
361361

@@ -367,15 +367,12 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items:
367367
..myitem.clone()
368368
};
369369

370-
let stab = import_item.stability_class(cx.tcx());
371370
let stab_tags = Some(extra_info_tags(&import_item, item, cx.tcx()));
372-
(stab, stab_tags)
371+
stab_tags
373372
} else {
374-
(None, None)
373+
None
375374
};
376375

377-
let add = if stab.is_some() { " " } else { "" };
378-
379376
w.write_str(ITEM_TABLE_ROW_OPEN);
380377
let id = match import.kind {
381378
clean::ImportKind::Simple(s) => {
@@ -391,11 +388,10 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items:
391388
};
392389
write!(
393390
w,
394-
"<div class=\"item-left{add}{stab}\"{id}>\
391+
"<div class=\"item-left\"{id}>\
395392
<code>{vis}{imp}</code>\
396393
</div>\
397394
{stab_tags_before}{stab_tags}{stab_tags_after}",
398-
stab = stab.unwrap_or_default(),
399395
vis = visibility_print_with_space(myitem.visibility(tcx), myitem.item_id, cx),
400396
imp = import.print(cx),
401397
);
@@ -417,9 +413,6 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items:
417413
_ => "",
418414
};
419415

420-
let stab = myitem.stability_class(cx.tcx());
421-
let add = if stab.is_some() { " " } else { "" };
422-
423416
let visibility_emoji = match myitem.visibility(tcx) {
424417
Some(ty::Visibility::Restricted(_)) => {
425418
"<span title=\"Restricted Visibility\">&nbsp;🔒</span> "
@@ -437,7 +430,7 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items:
437430
};
438431
write!(
439432
w,
440-
"<div class=\"item-left{add}{stab}\">\
433+
"<div class=\"item-left\">\
441434
<a class=\"{class}\" href=\"{href}\" title=\"{title}\">{name}</a>\
442435
{visibility_emoji}\
443436
{unsafety_flag}\
@@ -448,8 +441,6 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items:
448441
visibility_emoji = visibility_emoji,
449442
stab_tags = extra_info_tags(myitem, item, cx.tcx()),
450443
class = myitem.type_(),
451-
add = add,
452-
stab = stab.unwrap_or_default(),
453444
unsafety_flag = unsafety_flag,
454445
href = item_path(myitem.type_(), myitem.name.unwrap().as_str()),
455446
title = [myitem.type_().to_string(), full_path(cx, myitem)]

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

-4
Original file line numberDiff line numberDiff line change
@@ -977,10 +977,6 @@ so that we can apply CSS-filters to change the arrow color in themes */
977977
0 -1px 0 black;
978978
}
979979

980-
.item-left.unstable {
981-
opacity: 0.65;
982-
}
983-
984980
.since {
985981
font-weight: normal;
986982
font-size: initial;

tests/rustdoc/inline_cross/macros.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
extern crate macros;
88

9-
// @has foo/index.html '//*[@class="item-left unstable deprecated"]/span[@class="stab deprecated"]' \
9+
// @has foo/index.html '//*[@class="item-left"]/span[@class="stab deprecated"]' \
1010
// Deprecated
11-
// @has - '//*[@class="item-left unstable deprecated"]/span[@class="stab unstable"]' \
11+
// @has - '//*[@class="item-left"]/span[@class="stab unstable"]' \
1212
// Experimental
1313

1414
// @has foo/macro.my_macro.html

tests/rustdoc/issue-32374.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#![doc(issue_tracker_base_url = "https://issue_url/")]
33
#![unstable(feature = "test", issue = "32374")]
44

5-
// @matches issue_32374/index.html '//*[@class="item-left unstable deprecated"]/span[@class="stab deprecated"]' \
5+
// @matches issue_32374/index.html '//*[@class="item-left"]/span[@class="stab deprecated"]' \
66
// 'Deprecated'
7-
// @matches issue_32374/index.html '//*[@class="item-left unstable deprecated"]/span[@class="stab unstable"]' \
7+
// @matches issue_32374/index.html '//*[@class="item-left"]/span[@class="stab unstable"]' \
88
// 'Experimental'
99
// @matches issue_32374/index.html '//*[@class="item-right docblock-short"]/text()' 'Docs'
1010

tests/rustdoc/reexport-check.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@
44
extern crate reexport_check;
55

66
// @!has 'foo/index.html' '//code' 'pub use self::i32;'
7-
// @has 'foo/index.html' '//div[@class="item-left deprecated"]' 'i32'
87
// @has 'foo/i32/index.html'
98
#[allow(deprecated, deprecated_in_future)]
109
pub use std::i32;
1110
// @!has 'foo/index.html' '//code' 'pub use self::string::String;'
1211
// @has 'foo/index.html' '//div[@class="item-left"]' 'String'
1312
pub use std::string::String;
1413

14+
// i32 is deprecated, String is not
15+
// @count 'foo/index.html' '//span[@class="stab deprecated"]' 1
16+
1517
// @has 'foo/index.html' '//div[@class="item-right docblock-short"]' 'Docs in original'
1618
// this is a no-op, but shows what happens if there's an attribute that isn't a doc-comment
1719
#[doc(inline)]

0 commit comments

Comments
 (0)