]> git.lizzy.rs Git - rust.git/commitdiff
rustdoc: stop making unstable items transparent
authorMichael Howell <michael@notriddle.com>
Tue, 31 Jan 2023 18:27:09 +0000 (11:27 -0700)
committerMichael Howell <michael@notriddle.com>
Tue, 31 Jan 2023 18:27:09 +0000 (11:27 -0700)
Fixes #93393

src/librustdoc/html/render/print_item.rs
src/librustdoc/html/static/css/rustdoc.css
tests/rustdoc/inline_cross/macros.rs
tests/rustdoc/issue-32374.rs
tests/rustdoc/reexport-check.rs

index 71cde1f964cd96813e0a1da139df0e8c2a6490f4..bd7548003ad3b0cb1cd25a26dd8895d6f49cf3b8 100644 (file)
@@ -355,7 +355,7 @@ fn cmp(
             }
 
             clean::ImportItem(ref import) => {
-                let (stab, stab_tags) = if let Some(import_def_id) = import.source.did {
+                let stab_tags = if let Some(import_def_id) = import.source.did {
                     let ast_attrs = cx.tcx().get_attrs_unchecked(import_def_id);
                     let import_attrs = Box::new(clean::Attributes::from_ast(ast_attrs));
 
@@ -367,15 +367,12 @@ fn cmp(
                         ..myitem.clone()
                     };
 
-                    let stab = import_item.stability_class(cx.tcx());
                     let stab_tags = Some(extra_info_tags(&import_item, item, cx.tcx()));
-                    (stab, stab_tags)
+                    stab_tags
                 } else {
-                    (None, None)
+                    None
                 };
 
-                let add = if stab.is_some() { " " } else { "" };
-
                 w.write_str(ITEM_TABLE_ROW_OPEN);
                 let id = match import.kind {
                     clean::ImportKind::Simple(s) => {
@@ -391,11 +388,10 @@ fn cmp(
                 };
                 write!(
                     w,
-                    "<div class=\"item-left{add}{stab}\"{id}>\
+                    "<div class=\"item-left\"{id}>\
                          <code>{vis}{imp}</code>\
                      </div>\
                      {stab_tags_before}{stab_tags}{stab_tags_after}",
-                    stab = stab.unwrap_or_default(),
                     vis = visibility_print_with_space(myitem.visibility(tcx), myitem.item_id, cx),
                     imp = import.print(cx),
                 );
@@ -417,9 +413,6 @@ fn cmp(
                     _ => "",
                 };
 
-                let stab = myitem.stability_class(cx.tcx());
-                let add = if stab.is_some() { " " } else { "" };
-
                 let visibility_emoji = match myitem.visibility(tcx) {
                     Some(ty::Visibility::Restricted(_)) => {
                         "<span title=\"Restricted Visibility\">&nbsp;🔒</span> "
@@ -437,7 +430,7 @@ fn cmp(
                 };
                 write!(
                     w,
-                    "<div class=\"item-left{add}{stab}\">\
+                    "<div class=\"item-left\">\
                         <a class=\"{class}\" href=\"{href}\" title=\"{title}\">{name}</a>\
                         {visibility_emoji}\
                         {unsafety_flag}\
@@ -448,8 +441,6 @@ fn cmp(
                     visibility_emoji = visibility_emoji,
                     stab_tags = extra_info_tags(myitem, item, cx.tcx()),
                     class = myitem.type_(),
-                    add = add,
-                    stab = stab.unwrap_or_default(),
                     unsafety_flag = unsafety_flag,
                     href = item_path(myitem.type_(), myitem.name.unwrap().as_str()),
                     title = [myitem.type_().to_string(), full_path(cx, myitem)]
index c8ab3ef70d7b7e6ce8233d0048f3f6b3f1929d0c..ae7d65efa557516bdd33fa5c3ce538448bfbceaf 100644 (file)
@@ -977,10 +977,6 @@ so that we can apply CSS-filters to change the arrow color in themes */
                0 -1px 0 black;
 }
 
-.item-left.unstable {
-       opacity: 0.65;
-}
-
 .since {
        font-weight: normal;
        font-size: initial;
index d5b0de5725bce4f32502d5a7be169517a361cc67..b11d5b6c4fa2e820235f074d0554fc8bac1425b8 100644 (file)
@@ -6,9 +6,9 @@
 
 extern crate macros;
 
-// @has foo/index.html '//*[@class="item-left unstable deprecated"]/span[@class="stab deprecated"]' \
+// @has foo/index.html '//*[@class="item-left"]/span[@class="stab deprecated"]' \
 //         Deprecated
-// @has - '//*[@class="item-left unstable deprecated"]/span[@class="stab unstable"]' \
+// @has - '//*[@class="item-left"]/span[@class="stab unstable"]' \
 //         Experimental
 
 // @has foo/macro.my_macro.html
index 8296d7a81f2b1bc9c49d8d2995e8b030e6a70ca0..1153a745b0bfecfaf6c9667655346943d2711f5e 100644 (file)
@@ -2,9 +2,9 @@
 #![doc(issue_tracker_base_url = "https://issue_url/")]
 #![unstable(feature = "test", issue = "32374")]
 
-// @matches issue_32374/index.html '//*[@class="item-left unstable deprecated"]/span[@class="stab deprecated"]' \
+// @matches issue_32374/index.html '//*[@class="item-left"]/span[@class="stab deprecated"]' \
 //      'Deprecated'
-// @matches issue_32374/index.html '//*[@class="item-left unstable deprecated"]/span[@class="stab unstable"]' \
+// @matches issue_32374/index.html '//*[@class="item-left"]/span[@class="stab unstable"]' \
 //      'Experimental'
 // @matches issue_32374/index.html '//*[@class="item-right docblock-short"]/text()' 'Docs'
 
index acac0c9919716b067e8b4a7ffdc30e51beebdeba..94fa03385322adad68321606eb5eef43814cbd0a 100644 (file)
@@ -4,7 +4,6 @@
 extern crate reexport_check;
 
 // @!has 'foo/index.html' '//code' 'pub use self::i32;'
-// @has 'foo/index.html' '//div[@class="item-left deprecated"]' 'i32'
 // @has 'foo/i32/index.html'
 #[allow(deprecated, deprecated_in_future)]
 pub use std::i32;
@@ -12,6 +11,9 @@
 // @has 'foo/index.html' '//div[@class="item-left"]' 'String'
 pub use std::string::String;
 
+// i32 is deprecated, String is not
+// @count 'foo/index.html' '//span[@class="stab deprecated"]' 1
+
 // @has 'foo/index.html' '//div[@class="item-right docblock-short"]' 'Docs in original'
 // this is a no-op, but shows what happens if there's an attribute that isn't a doc-comment
 #[doc(inline)]