Remove more CSS classes

This commit is contained in:
Guillaume Gomez 2025-01-17 21:41:51 +01:00
parent 3c62ccdff5
commit b3865d1832
42 changed files with 146 additions and 162 deletions

View file

@ -412,14 +412,14 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
match *src {
Some(src) => write!(
w,
"<dt class=\"item-name\"><code>{}extern crate {} as {};",
"<dt><code>{}extern crate {} as {};",
visibility_print_with_space(myitem, cx),
anchor(myitem.item_id.expect_def_id(), src, cx),
EscapeBodyTextWithWbr(myitem.name.unwrap().as_str()),
),
None => write!(
w,
"<dt class=\"item-name\"><code>{}extern crate {};",
"<dt><code>{}extern crate {};",
visibility_print_with_space(myitem, cx),
anchor(myitem.item_id.expect_def_id(), myitem.name.unwrap(), cx),
),
@ -438,17 +438,11 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
}
clean::ImportKind::Glob => String::new(),
};
let (stab_tags_before, stab_tags_after) = if stab_tags.is_empty() {
("", "")
} else {
("<dd class=\"desc docblock-short\">", "</dd>")
};
write!(
w,
"<dt class=\"item-name\"{id}>\
<code>{vis}{imp}</code>\
</dt>\
{stab_tags_before}{stab_tags}{stab_tags_after}",
"<dt{id}>\
<code>{vis}{imp}</code>{stab_tags}\
</dt>",
vis = visibility_print_with_space(myitem, cx),
imp = import.print(cx),
);
@ -486,14 +480,11 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
let docs =
MarkdownSummaryLine(&myitem.doc_value(), &myitem.links(cx)).into_string();
let (docs_before, docs_after) = if docs.is_empty() {
("", "")
} else {
("<dd class=\"desc docblock-short\">", "</dd>")
};
let (docs_before, docs_after) =
if docs.is_empty() { ("", "") } else { ("<dd>", "</dd>") };
write!(
w,
"<dt class=\"item-name\">\
"<dt>\
<a class=\"{class}\" href=\"{href}\" title=\"{title}\">{name}</a>\
{visibility_and_hidden}\
{unsafety_flag}\

View file

@ -242,7 +242,7 @@ h1, h2, h3, h4, h5, h6,
.mobile-topbar,
.search-input,
.search-results .result-name,
.item-name > a,
.item-table dt > a,
.out-of-band,
.sub-heading,
span.since,
@ -385,11 +385,11 @@ details:not(.toggle) summary {
code, pre, .code-header, .type-signature {
font-family: "Source Code Pro", monospace;
}
.docblock code, .docblock-short code {
.docblock code, .item-table dd code {
border-radius: 3px;
padding: 0 0.125em;
}
.docblock pre code, .docblock-short pre code {
.docblock pre code, .item-table dd pre code {
padding: 0;
}
pre {
@ -887,13 +887,13 @@ both the code example and the line numbers, so we need to remove the radius in t
text-align: center;
}
.docblock-short {
.item-table dd {
overflow-wrap: break-word;
overflow-wrap: anywhere;
}
/* Wrap non-pre code blocks (`text`) but not (```text```). */
.docblock :not(pre) > code,
.docblock-short code {
.item-table dd code {
white-space: pre-wrap;
}
@ -938,7 +938,7 @@ rustdoc-toolbar {
min-height: 60px;
}
.docblock code, .docblock-short code,
.docblock code, .item-table dd code,
pre, .rustdoc.src .example-wrap, .example-wrap .src-line-numbers {
background-color: var(--code-block-background-color);
border-radius: var(--code-block-border-radius);
@ -964,7 +964,7 @@ pre, .rustdoc.src .example-wrap, .example-wrap .src-line-numbers {
background: var(--table-alt-row-background-color);
}
.docblock .stab, .docblock-short .stab, .docblock p code {
.docblock .stab, .item-table dd .stab, .docblock p code {
display: inline-block;
}
@ -1069,7 +1069,7 @@ because of the `[-]` element which would overlap with it. */
.example-wrap .rust a:hover,
.all-items a:hover,
.docblock a:not(.scrape-help):not(.tooltip):hover:not(.doc-anchor),
.docblock-short a:not(.scrape-help):not(.tooltip):hover,
.item-table dd a:not(.scrape-help):not(.tooltip):hover,
.item-info a {
text-decoration: underline;
}
@ -1106,7 +1106,7 @@ table,
margin: 0;
width: 100%;
}
.item-table > .item-name {
.item-table > dt {
padding-right: 1.25rem;
}
.item-table > dd {
@ -1412,7 +1412,7 @@ so that we can apply CSS-filters to change the arrow color in themes */
padding: 3px;
margin-bottom: 5px;
}
.item-name .stab {
.item-table dt .stab {
margin-left: 0.3125em;
}
.stab {
@ -2481,7 +2481,7 @@ in src-script.js and main.js
.search-results > a {
padding: 5px 0px;
}
.search-results > a > div.desc, .item-table dd.desc {
.search-results > a > div.desc, .item-table dd {
padding-left: 2em;
}
.search-results .result-name {

View file

@ -10,8 +10,8 @@ assert-count: ("dl.item-table dt", 2)
// If they don't have the same height, then it means one of the two is on two lines whereas it
// shouldn't!
compare-elements-size: (
".item-table .item-name a[href='fn.mult_vec_num.html']",
".item-table .item-name a[href='fn.subt_vec_num.html']",
".item-table dt a[href='fn.mult_vec_num.html']",
".item-table dt a[href='fn.subt_vec_num.html']",
["height"],
)

View file

@ -1,6 +1,6 @@
// This test ensures that <table> elements aren't display in items summary.
go-to: "file://" + |DOC_PATH| + "/lib2/summary_table/index.html"
// We check that we picked the right item first.
assert-text: (".item-table .item-name", "Foo")
assert-text: (".item-table dt", "Foo")
// Then we check that its summary is empty.
assert-false: ".item-table .desc"
assert-false: ".item-table dd"

View file

@ -12,59 +12,59 @@ assert: (".stab.portability")
// make sure that deprecated and portability have the right colors
assert-css: (
".item-table .item-name .stab.deprecated",
".item-table dt .stab.deprecated",
{ "background-color": "#fff5d6" },
)
assert-css: (
".item-table .item-name .stab.portability",
".item-table dt .stab.portability",
{ "background-color": "#fff5d6" },
)
// table like view
assert-css: (".desc.docblock-short", { "padding-left": "0px" })
assert-css: ("dd", { "padding-left": "0px" })
compare-elements-position-near: (
"//*[@class='item-name']//a[normalize-space()='replaced_function']",
".item-name .stab.deprecated",
"//dt//a[normalize-space()='replaced_function']",
"dt .stab.deprecated",
{"y": 2},
)
// "Unix" part is on second line
compare-elements-position-false: (
".item-name .stab.deprecated",
".item-name .stab.portability",
"dt .stab.deprecated",
"dt .stab.portability",
["y"],
)
// Ensure no wrap
compare-elements-position: (
"//*[@class='item-name']//a[normalize-space()='replaced_function']/..",
"//*[@class='desc docblock-short'][normalize-space()='a thing with a label']",
"//dt//a[normalize-space()='replaced_function']/..",
"//dd[normalize-space()='a thing with a label']",
["y"],
)
// Mobile view
set-window-size: (600, 600)
// staggered layout with 2em spacing
assert-css: (".desc.docblock-short", { "padding-left": "32px" })
assert-css: ("dd", { "padding-left": "32px" })
compare-elements-position-near: (
"//*[@class='item-name']//a[normalize-space()='replaced_function']",
".item-name .stab.deprecated",
"//dt//a[normalize-space()='replaced_function']",
"dt .stab.deprecated",
{"y": 2},
)
compare-elements-position: (
".item-name .stab.deprecated",
".item-name .stab.portability",
"dt .stab.deprecated",
"dt .stab.portability",
["y"],
)
// Ensure wrap
compare-elements-position-false: (
"//*[@class='item-name']//a[normalize-space()='replaced_function']/..",
"//*[@class='desc docblock-short'][normalize-space()='a thing with a label']",
"//dt//a[normalize-space()='replaced_function']/..",
"//dd[normalize-space()='a thing with a label']",
["y"],
)
compare-elements-position-false: (
".item-name .stab.deprecated",
"//*[@class='desc docblock-short'][normalize-space()='a thing with a label']",
"dt .stab.deprecated",
"//dd[normalize-space()='a thing with a label']",
["y"],
)

View file

@ -37,9 +37,9 @@ define-function: (
},
ALL,
)
move-cursor-to: ".desc a[href='long_code_block_link/index.html']"
move-cursor-to: "dd a[href='long_code_block_link/index.html']"
assert-css: (
".desc a[href='long_code_block_link/index.html']",
"dd a[href='long_code_block_link/index.html']",
{"text-decoration": "underline solid " + |mod|},
)
},

View file

@ -1,67 +1,67 @@
// This test checks that the correct font is used on module items (in index.html pages).
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
assert-css: (
".item-table .item-name > a",
".item-table dt > a",
{"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'},
ALL,
)
assert-css: (
".item-table .docblock-short",
".item-table dd",
{"font-family": '"Source Serif 4", NanumBarunGothic, serif'},
ALL,
)
// modules
assert-css: (
"#modules + .item-table .item-name a",
"#modules + .item-table dt a",
{"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'},
)
assert-css: (
"#modules + .item-table .desc.docblock-short",
"#modules + .item-table ",
{"font-family": '"Source Serif 4", NanumBarunGothic, serif'},
)
// structs
assert-css: (
"#structs + .item-table .item-name a",
"#structs + .item-table dt a",
{"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'},
)
assert-css: (
"#structs + .item-table .desc.docblock-short",
"#structs + .item-table dd",
{"font-family": '"Source Serif 4", NanumBarunGothic, serif'},
)
// enums
assert-css: (
"#enums + .item-table .item-name a",
"#enums + .item-table dt a",
{"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'},
)
assert-css: (
"#enums + .item-table .desc.docblock-short",
"#enums + .item-table dd",
{"font-family": '"Source Serif 4", NanumBarunGothic, serif'},
)
// traits
assert-css: (
"#traits + .item-table .item-name a",
"#traits + .item-table dt a",
{"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'},
)
assert-css: (
"#traits + .item-table .desc.docblock-short",
"#traits + .item-table dd",
{"font-family": '"Source Serif 4", NanumBarunGothic, serif'},
)
// functions
assert-css: (
"#functions + .item-table .item-name a",
"#functions + .item-table dt a",
{"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'},
)
assert-css: (
"#functions + .item-table .desc.docblock-short",
"#functions + .item-table dd",
{"font-family": '"Source Serif 4", NanumBarunGothic, serif'},
)
// keywords
assert-css: (
"#keywords + .item-table .item-name a",
"#keywords + .item-table dt a",
{"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'},
)
assert-css: (
"#keywords + .item-table .desc.docblock-short",
"#keywords + .item-table dd",
{"font-family": '"Source Serif 4", NanumBarunGothic, serif'},
)

View file

@ -65,8 +65,8 @@ assert-text: (".sidebar-elems section ul > li:nth-child(8)", "Functions")
assert-text: (".sidebar-elems section ul > li:nth-child(9)", "Type Aliases")
assert-text: (".sidebar-elems section ul > li:nth-child(10)", "Unions")
assert-text: (".sidebar-elems section ul > li:nth-child(11)", "Keywords")
assert-text: ("#structs + .item-table .item-name > a", "Foo")
click: "#structs + .item-table .item-name > a"
assert-text: ("#structs + .item-table dt > a", "Foo")
click: "#structs + .item-table dt > a"
// PAGE: struct.Foo.html
assert-count: (".sidebar .sidebar-crate", 1)
@ -101,8 +101,8 @@ assert-text: (".sidebar-elems > section ul.block > li:nth-child(2)", "Structs")
assert-text: (".sidebar-elems > section ul.block > li:nth-child(3)", "Traits")
assert-text: (".sidebar-elems > section ul.block > li:nth-child(4)", "Functions")
assert-text: (".sidebar-elems > section ul.block > li:nth-child(5)", "Type Aliases")
assert-text: ("#functions + .item-table .item-name > a", "foobar")
click: "#functions + .item-table .item-name > a"
assert-text: ("#functions + .item-table dt > a", "foobar")
click: "#functions + .item-table dt > a"
// PAGE: fn.foobar.html
// In items containing no items (like functions or constants) and in modules, we have no
@ -145,7 +145,7 @@ assert-text: (".sidebar-elems ul.block > li.current > a", "sub_sub_module")
// We check that we don't have the crate list.
assert-false: ".sidebar-elems .crate"
assert-text: (".sidebar-elems > section ul > li:nth-child(1)", "Functions")
assert-text: ("#functions + .item-table .item-name > a", "foo")
assert-text: ("#functions + .item-table dt > a", "foo")
// Links to trait implementations in the sidebar should not wrap even if they are long.
go-to: "file://" + |DOC_PATH| + "/lib2/struct.HasALongTraitWithParams.html"

View file

@ -17,7 +17,7 @@ define-function: (
[theme, color],
block {
call-function: ("switch-theme", {"theme": |theme|})
assert-css: (".item-name sup", {"color": |color|})
assert-css: ("dt sup", {"color": |color|})
},
)

View file

@ -9,7 +9,7 @@
//@ has - '//*[@id="main-content"]/h2' 'Structs'
//@ has - '//*[@id="main-content"]/h2' 'Re-exports'
// The 3 re-exports.
//@ count - '//*[@id="main-content"]//*[@class="item-table"]/dt//code' 3
//@ count - '//*[@id="main-content"]//*[@class="item-table reexports"]/dt//code' 3
// The public struct.
//@ count - '//*[@id="main-content"]//a[@class="struct"]' 1

View file

@ -11,15 +11,15 @@ mod sub {
pub fn public() {}
}
//@ matches - '//*[@class="desc docblock-short"]' '^Displayed$'
//@ matches - '//dd' '^Displayed$'
/// Displayed
#[doc(inline)]
pub use crate::bar as Bar;
//@ matches - '//*[@class="desc docblock-short"]' '^Hello\sDisplayed$'
//@ matches - '//dd' '^Hello\sDisplayed$'
#[doc(inline)]
/// Hello
pub use crate::Bar as Bar2;
//@ matches - '//*[@class="desc docblock-short"]' '^Public$'
//@ matches - '//dd' '^Public$'
/// Public
pub use crate::sub::public as Public;

View file

@ -5,8 +5,8 @@
#![no_core]
//@ has 'foo/index.html'
//@ has - '//*[@class="item-name"]/*[@class="stab portability"]' 'foobar'
//@ has - '//*[@class="item-name"]/*[@class="stab portability"]' 'bar'
//@ has - '//dt/*[@class="stab portability"]' 'foobar'
//@ has - '//dt/*[@class="stab portability"]' 'bar'
#[doc(cfg(feature = "foobar"))]
mod imp_priv {

View file

@ -1,6 +1,5 @@
//@ has deprecated/index.html '//*[@class="item-name"]/span[@class="stab deprecated"]' \
// 'Deprecated'
//@ has - '//*[@class="desc docblock-short"]' 'Deprecated docs'
//@ has deprecated/index.html '//dt/span[@class="stab deprecated"]' 'Deprecated'
//@ has - '//dd' 'Deprecated docs'
//@ has deprecated/struct.S.html '//*[@class="stab deprecated"]' \
// 'Deprecated since 1.0.0: text'
@ -8,7 +7,7 @@
#[deprecated(since = "1.0.0", note = "text")]
pub struct S;
//@ matches deprecated/index.html '//*[@class="desc docblock-short"]' '^Docs'
//@ matches deprecated/index.html '//dd' '^Docs'
/// Docs
pub struct T;

View file

@ -5,19 +5,19 @@
#![crate_name = "foo"]
//@ has 'foo/index.html'
//@ has - '//*[@class="item-name"]/span[@title="Hidden item"]' '👻'
//@ has - '//dt/span[@title="Hidden item"]' '👻'
//@ has - '//*[@id="reexport.hidden_reexport"]/code' '#[doc(hidden)] pub use hidden::inside_hidden as hidden_reexport;'
#[doc(hidden)]
pub use hidden::inside_hidden as hidden_reexport;
//@ has - '//*[@class="item-name"]/a[@class="trait"]' 'TraitHidden'
//@ has - '//dt/a[@class="trait"]' 'TraitHidden'
//@ has 'foo/trait.TraitHidden.html'
//@ has - '//code' '#[doc(hidden)] pub trait TraitHidden'
#[doc(hidden)]
pub trait TraitHidden {}
//@ has 'foo/index.html' '//*[@class="item-name"]/a[@class="trait"]' 'Trait'
//@ has 'foo/index.html' '//dt/a[@class="trait"]' 'Trait'
pub trait Trait {
//@ has 'foo/trait.Trait.html'
//@ has - '//*[@id="associatedconstant.BAR"]/*[@class="code-header"]' '#[doc(hidden)] const BAR: u32 = 0u32'
@ -29,7 +29,7 @@ pub trait Trait {
fn foo() {}
}
//@ has 'foo/index.html' '//*[@class="item-name"]/a[@class="struct"]' 'Struct'
//@ has 'foo/index.html' '//dt/a[@class="struct"]' 'Struct'
//@ has 'foo/struct.Struct.html'
pub struct Struct {
//@ has - '//*[@id="structfield.a"]/code' 'a: u32'
@ -50,7 +50,7 @@ impl Trait for Struct {
//@ has - '//*[@id="impl-TraitHidden-for-Struct"]/*[@class="code-header"]' 'impl TraitHidden for Struct'
impl TraitHidden for Struct {}
//@ has 'foo/index.html' '//*[@class="item-name"]/a[@class="enum"]' 'HiddenEnum'
//@ has 'foo/index.html' '//dt/a[@class="enum"]' 'HiddenEnum'
//@ has 'foo/enum.HiddenEnum.html'
//@ has - '//code' '#[doc(hidden)] pub enum HiddenEnum'
#[doc(hidden)]
@ -58,18 +58,18 @@ pub enum HiddenEnum {
A,
}
//@ has 'foo/index.html' '//*[@class="item-name"]/a[@class="enum"]' 'Enum'
//@ has 'foo/index.html' '//dt/a[@class="enum"]' 'Enum'
pub enum Enum {
//@ has 'foo/enum.Enum.html' '//*[@id="variant.A"]/*[@class="code-header"]' 'A'
#[doc(hidden)]
A,
}
//@ has 'foo/index.html' '//*[@class="item-name"]/a[@class="mod"]' 'hidden'
//@ has 'foo/index.html' '//dt/a[@class="mod"]' 'hidden'
#[doc(hidden)]
pub mod hidden {
//@ has 'foo/hidden/index.html'
//@ has - '//*[@class="item-name"]/a[@class="fn"]' 'inside_hidden'
//@ has - '//dt/a[@class="fn"]' 'inside_hidden'
//@ has 'foo/hidden/fn.inside_hidden.html'
pub fn inside_hidden() {}
}

View file

@ -12,7 +12,7 @@ pub struct Portable;
//@ has doc_cfg/unix_only/index.html \
// '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
// 'Available on Unix only.'
//@ matches - '//*[@class="item-name"]//*[@class="stab portability"]' '\AARM\Z'
//@ matches - '//dt//*[@class="stab portability"]' '\AARM\Z'
//@ count - '//*[@class="stab portability"]' 2
#[doc(cfg(unix))]
pub mod unix_only {
@ -42,7 +42,7 @@ pub mod unix_only {
//@ has doc_cfg/wasi_only/index.html \
// '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \
// 'Available on WASI only.'
//@ matches - '//*[@class="item-name"]//*[@class="stab portability"]' '\AWebAssembly\Z'
//@ matches - '//dt//*[@class="stab portability"]' '\AWebAssembly\Z'
//@ count - '//*[@class="stab portability"]' 2
#[doc(cfg(target_os = "wasi"))]
pub mod wasi_only {
@ -74,7 +74,7 @@ pub mod wasi_only {
// the portability header is different on the module view versus the full view
//@ has doc_cfg/index.html
//@ matches - '//*[@class="item-name"]//*[@class="stab portability"]' '\Aavx\Z'
//@ matches - '//dt//*[@class="stab portability"]' '\Aavx\Z'
//@ has doc_cfg/fn.uses_target_feature.html
//@ has - '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \

View file

@ -26,7 +26,7 @@ pub mod single_reexport {
//@ has 'foo/single_reexport/index.html'
// First we check that we have 4 type aliases.
//@ count - '//*[@id="main-content"]/*[@class="item-table"]//code' 4
//@ count - '//*[@id="main-content"]/*[@class="item-table reexports"]//code' 4
// Then we check that we have the correct link for each re-export.
@ -131,10 +131,10 @@ mod private {
pub mod doc_hidden_reexport {
//@ has 'foo/doc_hidden_reexport/index.html'
// Ensure there is only one item in this page and that it's a struct.
//@ count - '//*[@class="item-name"]' 1
//@ count - '//dt' 1
//@ has - '//a[@class="struct"]' 'Reexport'
// Check that the `#[doc(hidden)]` re-export's attributes are not taken into account.
//@ has - '//*[@class="desc docblock-short"]' 'Visible. Original.'
//@ has - '//dd' 'Visible. Original.'
/// Visible.
pub use self::Bar3 as Reexport;
/// Hidden.

View file

@ -2,7 +2,7 @@
#![crate_name = "foo"]
//@ has 'foo/index.html' '//*[@class="desc docblock-short"]' ''
//@ has 'foo/index.html' '//dd' ''
//@ has 'foo/struct.Bar.html' '//*[@class="docblock"]' ''
/// --

View file

@ -2,8 +2,8 @@
#![feature(doc_cfg)]
//@ has 'foo/index.html'
//@ matches '-' '//*[@class="item-name"]//*[@class="stab portability"]' '^sync$'
//@ has '-' '//*[@class="item-name"]//*[@class="stab portability"]/@title' 'Available on crate feature `sync` only'
//@ matches '-' '//dt//*[@class="stab portability"]' '^sync$'
//@ has '-' '//dt//*[@class="stab portability"]/@title' 'Available on crate feature `sync` only'
//@ has 'foo/struct.Foo.html'
//@ has '-' '//*[@class="stab portability"]' 'sync'

View file

@ -4,8 +4,8 @@
#![crate_name = "foo"]
//@ has 'foo/index.html'
//@ has - '//*[@class="desc docblock-short"]' 'hello bla'
//@ !has - '//*[@class="desc docblock-short"]/sup' '1'
//@ has - '//dd' 'hello bla'
//@ !has - '//dd/sup' '1'
//@ has 'foo/struct.S.html'
//@ has - '//*[@class="docblock"]//sup' '1'

View file

@ -7,9 +7,9 @@
//@ has 'foo/index.html'
// There are two items.
//@ count - '//*[@class="item-table"]/dt[@class="item-name"]' 2
//@ count - '//*[@class="item-table"]/dt' 2
// Only one of them should have an attribute.
//@ count - '//*[@class="item-table"]/dt[@class="item-name"]/*[@class="stab portability"]' 1
//@ count - '//*[@class="item-table"]/dt/*[@class="stab portability"]' 1
mod a {
#[doc(cfg(not(feature = "a")))]

View file

@ -6,9 +6,9 @@
//@ has 'foo/index.html'
// There are two items.
//@ count - '//*[@class="item-table"]/dt[@class="item-name"]' 2
//@ count - '//*[@class="item-table"]/dt' 2
// Only one of them should have an attribute.
//@ count - '//*[@class="item-table"]/dt[@class="item-name"]/*[@class="stab portability"]' 1
//@ count - '//*[@class="item-table"]/dt/*[@class="stab portability"]' 1
mod a {
#[cfg(not(feature = "a"))]

View file

@ -15,6 +15,6 @@ mod sub4 {
pub use sub4::inner::*;
//@ has 'foo/index.html'
//@ has - '//dd[@class="desc docblock-short"]' '1'
//@ !has - '//dd[@class="desc docblock-short"]' '0'
//@ has - '//dd' '1'
//@ !has - '//dd' '0'
fn main() { assert_eq!(X, 1); }

View file

@ -1,17 +1,17 @@
//@ has 'glob_shadowing/index.html'
//@ count - '//dt[@class="item-name"]' 6
//@ !has - '//dd[@class="desc docblock-short"]' 'sub1::describe'
//@ has - '//dd[@class="desc docblock-short"]' 'sub2::describe'
//@ count - '//dt' 6
//@ !has - '//dd' 'sub1::describe'
//@ has - '//dd' 'sub2::describe'
//@ !has - '//dd[@class="desc docblock-short"]' 'sub1::describe2'
//@ !has - '//dd' 'sub1::describe2'
//@ !has - '//dd[@class="desc docblock-short"]' 'sub1::prelude'
//@ has - '//dd[@class="desc docblock-short"]' 'mod::prelude'
//@ !has - '//dd' 'sub1::prelude'
//@ has - '//dd' 'mod::prelude'
//@ has - '//dd[@class="desc docblock-short"]' 'sub1::Foo (struct)'
//@ has - '//dd[@class="desc docblock-short"]' 'mod::Foo (function)'
//@ has - '//dd' 'sub1::Foo (struct)'
//@ has - '//dd' 'mod::Foo (function)'
//@ has - '//dd[@class="desc docblock-short"]' 'sub4::inner::X'
//@ has - '//dd' 'sub4::inner::X'
//@ has 'glob_shadowing/fn.describe.html'
//@ has - '//div[@class="docblock"]' 'sub2::describe'

View file

@ -2,8 +2,8 @@
//@ has 'foo/index.html'
// There should be only `type A`.
//@ count - '//*[@class="item-table"]//*[@class="item-name"]' 1
//@ has - '//*[@class="item-name"]/a[@href="type.A.html"]' 'A'
//@ count - '//*[@class="item-table"]//dt' 1
//@ has - '//dt/a[@href="type.A.html"]' 'A'
mod foo {
pub struct S;

View file

@ -9,7 +9,7 @@
//@ count - '//*[@id="main-content"]/*[@class="section-header"]' 1
//@ has - '//*[@id="main-content"]/*[@class="section-header"]' 'Structs'
//@ has - '//*[@id="main-content"]//a[@href="struct.Reexport.html"]' 'Reexport'
//@ has - '//*[@id="main-content"]//*[@class="desc docblock-short"]' 'Visible. Original.'
//@ has - '//*[@id="main-content"]//dd' 'Visible. Original.'
mod private {
/// Original.

View file

@ -11,14 +11,14 @@ extern crate rustdoc_hidden;
pub use rustdoc_hidden::Foo;
// Even if the foreign item has `doc(hidden)`, we should be able to inline it.
//@ has - '//*[@class="item-name"]/a[@class="struct"]' 'Inlined'
//@ has - '//dt/a[@class="struct"]' 'Inlined'
#[doc(inline)]
pub use rustdoc_hidden::Foo as Inlined;
// Even with this import, we should not see `Foo`.
//@ count - '//*[@class="item-name"]' 4
//@ has - '//*[@class="item-name"]/a[@class="struct"]' 'Bar'
//@ has - '//*[@class="item-name"]/a[@class="fn"]' 'foo'
//@ count - '//dt' 4
//@ has - '//dt/a[@class="struct"]' 'Bar'
//@ has - '//dt/a[@class="fn"]' 'foo'
pub use rustdoc_hidden::*;
//@ has inline_hidden/fn.foo.html

View file

@ -6,10 +6,8 @@
extern crate macros;
//@ has foo/index.html '//*[@class="item-name"]/span[@class="stab deprecated"]' \
// Deprecated
//@ has - '//*[@class="item-name"]/span[@class="stab unstable"]' \
// Experimental
//@ has foo/index.html '//dt/span[@class="stab deprecated"]' Deprecated
//@ has - '//dt/span[@class="stab unstable"]' Experimental
//@ has foo/macro.my_macro.html
//@ has - '//*[@class="docblock"]' 'docs for my_macro'

View file

@ -8,7 +8,7 @@
//@ !matches internal/index.html \
// '//*[@class="desc docblock-short"]/span[@class="stab internal"]' \
// ''
//@ matches - '//*[@class="desc docblock-short"]' 'Docs'
//@ matches - '//dd' 'Docs'
//@ !has internal/struct.S.html '//*[@class="stab unstable"]' ''
//@ !has internal/struct.S.html '//*[@class="stab internal"]' ''

View file

@ -32,8 +32,8 @@ pub mod subone {
//@ has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.foo.html"]' 'foo'
//@ has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.bar.html"]' 'bar'
// Though there should be such links later
//@ has - '//section[@id="main-content"]/dl[@class="item-table"]/dt[@class="item-name"]/a[@class="fn"][@href="fn.foo.html"]' 'foo'
//@ has - '//section[@id="main-content"]/dl[@class="item-table"]/dt[@class="item-name"]/a[@class="fn"][@href="fn.bar.html"]' 'bar'
//@ has - '//section[@id="main-content"]/dl[@class="item-table"]/dt/a[@class="fn"][@href="fn.foo.html"]' 'foo'
//@ has - '//section[@id="main-content"]/dl[@class="item-table"]/dt/a[@class="fn"][@href="fn.bar.html"]' 'bar'
/// See either [foo] or [bar].
pub mod subtwo {
@ -71,8 +71,8 @@ pub mod subthree {
// Next we go *deeper* - In order to ensure it's not just "this or parent"
// we test `crate::` and a `super::super::...` chain
//@ has foo/subfour/subfive/subsix/subseven/subeight/index.html
//@ has - '//section[@id="main-content"]/dl[@class="item-table"]/dd[@class="desc docblock-short"]//a[@href="../../../../../subone/fn.foo.html"]' 'other foo'
//@ has - '//section[@id="main-content"]/dl[@class="item-table"]/dd[@class="desc docblock-short"]//a[@href="../../../../../subtwo/fn.bar.html"]' 'other bar'
//@ has - '//section[@id="main-content"]/dl[@class="item-table"]/dd//a[@href="../../../../../subone/fn.foo.html"]' 'other foo'
//@ has - '//section[@id="main-content"]/dl[@class="item-table"]/dd//a[@href="../../../../../subtwo/fn.bar.html"]' 'other bar'
pub mod subfour {
pub mod subfive {
pub mod subsix {

View file

@ -1 +1 @@
<dl class="item-table"><dt class="item-name"><a class="constant" href="constant.MY_CONSTANT.html" title="constant item_desc_list_at_start::MY_CONSTANT">MY_<wbr />CONSTANT</a></dt><dd class="desc docblock-short">Groups: <code>SamplePatternSGIS</code>, <code>SamplePatternEXT</code></dd></dl>
<dl class="item-table"><dt><a class="constant" href="constant.MY_CONSTANT.html" title="constant item_desc_list_at_start::MY_CONSTANT">MY_<wbr />CONSTANT</a></dt><dd>Groups: <code>SamplePatternSGIS</code>, <code>SamplePatternEXT</code></dd></dl>

View file

@ -10,7 +10,7 @@
//@ has - '//*[@id="main-content"]/*[@class="section-header"]' 'Functions'
//@ has - '//*[@id="main-content"]/*[@class="section-header"]' 'Traits'
// Checking that there are only three items.
//@ count - '//*[@id="main-content"]//*[@class="item-name"]' 3
//@ count - '//*[@id="main-content"]//dt' 3
//@ has - '//*[@id="main-content"]//a[@href="struct.Bar.html"]' 'Bar'
//@ has - '//*[@id="main-content"]//a[@href="fn.foo.html"]' 'foo'
//@ has - '//*[@id="main-content"]//a[@href="trait.Foo.html"]' 'Foo'

View file

@ -5,8 +5,8 @@
#![no_std]
//@ has 'foo/index.html'
//@ has - '//*[@class="item-name"]/a[@class="type"]' 'AtomicU8'
//@ has - '//*[@class="item-name"]/a[@class="constant"]' 'AtomicU8'
//@ has - '//dt/a[@class="type"]' 'AtomicU8'
//@ has - '//dt/a[@class="constant"]' 'AtomicU8'
// We also ensure we don't have another item displayed.
//@ count - '//*[@id="main-content"]/*[@class="section-header"]' 2
//@ has - '//*[@id="main-content"]/*[@class="section-header"]' 'Type Aliases'

View file

@ -5,8 +5,8 @@
#![no_std]
//@ has 'foo/index.html'
//@ has - '//*[@class="item-name"]/a[@class="struct"]' 'AtomicU8'
//@ has - '//*[@class="item-name"]/a[@class="constant"]' 'AtomicU8'
//@ has - '//dt/a[@class="struct"]' 'AtomicU8'
//@ has - '//dt/a[@class="constant"]' 'AtomicU8'
// We also ensure we don't have another item displayed.
//@ count - '//*[@id="main-content"]/*[@class="section-header"]' 2
//@ has - '//*[@id="main-content"]/*[@class="section-header"]' 'Structs'

View file

@ -1,5 +1,5 @@
// https://github.com/rust-lang/rust/issues/95873
#![crate_name = "foo"]
//@ has foo/index.html "//*[@class='item-name']" "pub use ::std as x;"
//@ has foo/index.html "//dt" "pub use ::std as x;"
pub use ::std as x;

View file

@ -13,20 +13,18 @@ mod foo {
}
//@ has 'foo/index.html'
//@ has - '//*[@class="item-name"]' 'BabarNon-lie'
//@ has - '//dt' 'BabarNon-lie'
#[cfg(not(feature = "lie"))]
pub use crate::foo::Bar as Babar;
//@ has - '//*[@class="item-name"]' 'Babar2Non-cake'
//@ has - '//dt' 'Babar2Non-cake'
#[doc(cfg(not(feature = "cake")))]
pub use crate::foo::Bar2 as Babar2;
//@ has - '//*[@class="item-table"]/dt' 'pub use crate::Babar as Elephant;'
//@ has - '//*[@class="item-table"]/dd' 'Non-robot'
//@ has - '//*[@class="item-table reexports"]/dt' 'pub use crate::Babar as Elephant;Non-robot'
#[cfg(not(feature = "robot"))]
pub use crate::Babar as Elephant;
//@ has - '//*[@class="item-table"]/dt' 'pub use crate::Babar2 as Elephant2;'
//@ has - '//*[@class="item-table"]/dd' 'Non-cat'
//@ has - '//*[@class="item-table reexports"]/dt' 'pub use crate::Babar2 as Elephant2;Non-cat'
#[doc(cfg(not(feature = "cat")))]
pub use crate::Babar2 as Elephant2;

View file

@ -8,13 +8,13 @@ extern crate reexport_check;
#[allow(deprecated, deprecated_in_future)]
pub use std::i32;
//@ !has 'foo/index.html' '//code' 'pub use self::string::String;'
//@ has 'foo/index.html' '//dt[@class="item-name"]' 'String'
//@ has 'foo/index.html' '//dt' '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' '//dd[@class="desc docblock-short"]' 'Docs in original'
//@ has 'foo/index.html' '//dd' '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)]
pub use reexport_check::S;

View file

@ -12,5 +12,5 @@ mod private_module {
//@ has - '//*[@id="reexport.Foo"]/code' 'pub use crate::private_module::Public as Foo;'
pub use crate::private_module::Public as Foo;
// Glob re-exports with no visible items should not be displayed.
//@ count - '//*[@class="item-table"]/dt' 1
//@ count - '//*[@class="item-table reexports"]/dt' 1
pub use crate::private_module::*;

View file

@ -25,5 +25,6 @@ pub mod a {
//@ has - '//*[@id="main-content"]//*[@id="reexport.A"]' 'pub use self::a::A;'
//@ has - '//*[@id="main-content"]//*[@id="reexport.B"]' 'pub use self::a::B;'
// Should only contain "Modules" and "Re-exports".
//@ count - '//*[@id="main-content"]//*[@class="item-table"]' 2
//@ count - '//*[@id="main-content"]//*[@class="item-table"]' 1
//@ count - '//*[@id="main-content"]//*[@class="item-table reexports"]' 1
pub use self::a::{A, B};

View file

@ -5,7 +5,7 @@
#![crate_name = "foo"]
//@ has 'foo/index.html'
//@ has - '//*[@id="main-content"]//*[@class="item-name"]/a[@href="trait.Foo.html"]' 'Foo'
//@ has - '//*[@id="main-content"]//dt/a[@href="trait.Foo.html"]' 'Foo'
//@ has 'foo/trait.Foo.html'
//@ has - '//*[@id="main-content"]//*[@class="code-header"]' 'fn test()'

View file

@ -1,7 +1,7 @@
#![crate_name = "foo"]
//@ has foo/index.html '//*[@class="desc docblock-short"]' 'fooo'
//@ !has foo/index.html '//*[@class="desc docblock-short"]/h1' 'fooo'
//@ has foo/index.html '//dd' 'fooo'
//@ !has foo/index.html '//dd//h1' 'fooo'
//@ has foo/fn.foo.html '//h2[@id="fooo"]' 'fooo'
//@ has foo/fn.foo.html '//h2[@id="fooo"]/a[@href="#fooo"]' '§'
@ -10,8 +10,8 @@
/// foo
pub fn foo() {}
//@ has foo/index.html '//*[@class="desc docblock-short"]' 'mooood'
//@ !has foo/index.html '//*[@class="desc docblock-short"]/h2' 'mooood'
//@ has foo/index.html '//dd' 'mooood'
//@ !has foo/index.html '//dd//h2' 'mooood'
//@ has foo/foo/index.html '//h3[@id="mooood"]' 'mooood'
//@ has foo/foo/index.html '//h3[@id="mooood"]/a[@href="#mooood"]' '§'
@ -20,8 +20,7 @@ pub fn foo() {}
/// foo mod
pub mod foo {}
//@ has foo/index.html '//*[@class="desc docblock-short"]/a[@href=\
// "https://nougat.world"]/code' 'nougat'
//@ has foo/index.html '//dd/a[@href="https://nougat.world"]/code' 'nougat'
/// [`nougat`](https://nougat.world)
pub struct Bar;

View file

@ -4,11 +4,9 @@
#![unstable(feature = "test", issue = "32374")]
#![crate_name="issue_32374"]
//@ matches issue_32374/index.html '//*[@class="item-name"]/span[@class="stab deprecated"]' \
// 'Deprecated'
//@ matches issue_32374/index.html '//*[@class="item-name"]/span[@class="stab unstable"]' \
// 'Experimental'
//@ matches issue_32374/index.html '//*[@class="desc docblock-short"]/text()' 'Docs'
//@ matches issue_32374/index.html '//dt/span[@class="stab deprecated"]' 'Deprecated'
//@ matches issue_32374/index.html '//dt/span[@class="stab unstable"]' 'Experimental'
//@ matches issue_32374/index.html '//dd/text()' 'Docs'
//@ has issue_32374/struct.T.html '//*[@class="stab deprecated"]/span' '👎'
//@ has issue_32374/struct.T.html '//*[@class="stab deprecated"]/span' \

View file

@ -1,6 +1,6 @@
// https://github.com/rust-lang/rust/issues/46377
#![crate_name="foo"]
//@ has 'foo/index.html' '//*[@class="desc docblock-short"]' 'Check out this struct!'
//@ has 'foo/index.html' '//dd' 'Check out this struct!'
/// # Check out this struct!
pub struct SomeStruct;