From 458e7219bc2a62f72368279945cfda632a016da1 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Thu, 22 Jul 2021 15:17:00 -0700 Subject: [PATCH 01/10] Rustdoc accessibility: use real headers for doc items This is a pretty annoying workaround: the specifications literally contradict each other on the matter of whether headers may be nested inside of summaries. We need the headers for people who use outline mode to browse rustdoc, mostly in screen readers, and the headers need to be inside the summary tag so that they're visible when the details tag is collapsed. HTML5 says it's okay, but the ordinary button semantics in ARIA say that headers nested in buttons are ignored, and summary is a button. Which means some screen readers, like NVDA, work, while others, like JAWS, don't. --- src/librustdoc/html/render/mod.rs | 20 ++++++++++---------- src/librustdoc/html/render/print_item.rs | 4 ++-- src/librustdoc/html/static/css/rustdoc.css | 17 ++++++++++++----- src/librustdoc/html/static/js/main.js | 3 ++- 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 68c59612ccc44..45542b53573b5 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1350,7 +1350,7 @@ fn render_impl( ); render_rightside(w, cx, item, containing_item); write!(w, "", id); - w.write_str(""); + w.write_str("

"); render_assoc_item( w, item, @@ -1358,7 +1358,7 @@ fn render_impl( ItemType::Impl, cx, ); - w.write_str(""); + w.write_str("

"); w.write_str(""); } } @@ -1371,7 +1371,7 @@ fn render_impl( id, item_type, in_trait_class ); write!(w, "", id); - w.write_str(""); + w.write_str("

"); assoc_type( w, item, @@ -1381,7 +1381,7 @@ fn render_impl( "", cx, ); - w.write_str(""); + w.write_str("

"); w.write_str(""); } clean::AssocConstItem(ref ty, ref default) => { @@ -1394,7 +1394,7 @@ fn render_impl( ); render_rightside(w, cx, item, containing_item); write!(w, "", id); - w.write_str(""); + w.write_str("

"); assoc_const( w, item, @@ -1404,7 +1404,7 @@ fn render_impl( "", cx, ); - w.write_str(""); + w.write_str("

"); w.write_str(""); } clean::AssocTypeItem(ref bounds, ref default) => { @@ -1412,7 +1412,7 @@ fn render_impl( let id = cx.derive_id(source_id.clone()); write!(w, "
", id, item_type, in_trait_class,); write!(w, "", id); - w.write_str(""); + w.write_str("

"); assoc_type( w, item, @@ -1422,7 +1422,7 @@ fn render_impl( "", cx, ); - w.write_str(""); + w.write_str("

"); w.write_str("
"); } clean::StrippedItem(..) => return, @@ -1613,7 +1613,7 @@ pub(crate) fn render_impl_summary( write!(w, "
", id, aliases); render_rightside(w, cx, &i.impl_item, containing_item); write!(w, "", id); - write!(w, ""); + write!(w, "

"); if let Some(use_absolute) = use_absolute { write!(w, "{}", i.inner_impl().print(use_absolute, cx)); @@ -1629,7 +1629,7 @@ pub(crate) fn render_impl_summary( } else { write!(w, "{}", i.inner_impl().print(false, cx)); } - write!(w, ""); + write!(w, "

"); let is_trait = i.inner_impl().trait_.is_some(); if is_trait { diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 552958d5e402b..50793acbbf0f1 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -621,9 +621,9 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra render_stability_since(w, m, t, cx.tcx()); write_srclink(cx, m, w); write!(w, "
"); - write!(w, ""); + write!(w, "

"); render_assoc_item(w, m, AssocItemLink::Anchor(Some(&id)), ItemType::Impl, cx); - w.write_str(""); + w.write_str("

"); w.write_str(""); if toggled { write!(w, ""); diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 6672093eb7bc6..f124d7aec6c1e 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -146,6 +146,13 @@ h1.fqn > .in-band > a:hover { h2, h3, h4 { border-bottom: 1px solid; } +h3.code-header, h4.code-header { + font-size: 1em; + font-weight: 600; + border: none; + padding: 0; + margin: 0; +} .impl, .impl-items .method, .methods .method, @@ -233,7 +240,7 @@ details:not(.rustdoc-toggle) summary { margin-bottom: .6em; } -code, pre, a.test-arrow { +code, pre, a.test-arrow, .code-header { font-family: "Source Code Pro", monospace; } .docblock code, .docblock-short code { @@ -520,7 +527,7 @@ nav.sub { font-weight: normal; } -.method > code, .trait-impl > code, .invisible > code { +.method > .code-header, .trait-impl > .code-header, .invisible > .code-header { max-width: calc(100% - 41px); display: block; } @@ -536,7 +543,7 @@ nav.sub { padding: 0px; } -.in-band > code { +.in-band > code, .in-band > .code-header { display: inline-block; } @@ -742,7 +749,7 @@ a { } .invisible > .srclink, -.method > code + .srclink { +.method > .code-header + .srclink { position: absolute; top: 0; right: 0; @@ -1103,7 +1110,7 @@ a.test-arrow:hover{ left: -10px; } -:target > code { +:target > code, :target > .code-header { opacity: 1; } diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index 38ddbb3ad7427..869aff5376649 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -706,8 +706,9 @@ function hideThemeButtonState() { } } - var code = document.createElement("code"); + var code = document.createElement("h3"); code.innerHTML = struct.text; + addClass(code, "code-header"); addClass(code, "in-band"); onEachLazy(code.getElementsByTagName("a"), function(elem) { From 0147ce7dcff9660f74d9d3458228ffa55d92c525 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Thu, 22 Jul 2021 15:45:04 -0700 Subject: [PATCH 02/10] Update tests for rustdoc headers patch --- src/test/rustdoc-gui/font-weight.goml | 6 +++--- src/test/rustdoc-gui/implementors.goml | 4 ++-- src/test/rustdoc/assoc-consts.rs | 4 ++-- src/test/rustdoc/assoc-types.rs | 6 +++--- src/test/rustdoc/async-fn.rs | 6 +++--- src/test/rustdoc/blanket-reexport-item.rs | 2 +- src/test/rustdoc/const-display.rs | 6 +++--- src/test/rustdoc/const-generics/add-impl.rs | 2 +- .../const-generics/const-generics-docs.rs | 12 +++++------ src/test/rustdoc/const-generics/const-impl.rs | 10 +++++----- .../const-equate-pred.rs | 2 +- src/test/rustdoc/const.rs | 2 +- .../rustdoc/duplicate_impls/issue-33054.rs | 6 +++--- src/test/rustdoc/extern-impl-trait.rs | 4 ++-- src/test/rustdoc/extern-impl.rs | 16 +++++++-------- src/test/rustdoc/extern-method.rs | 8 ++++---- src/test/rustdoc/generic-impl.rs | 4 ++-- .../rustdoc/higher-ranked-trait-bounds.rs | 4 ++-- src/test/rustdoc/impl-disambiguation.rs | 10 +++++----- src/test/rustdoc/impl-parts.rs | 4 ++-- src/test/rustdoc/inline_cross/impl_trait.rs | 4 ++-- .../rustdoc/inline_cross/issue-31948-1.rs | 20 +++++++++---------- .../rustdoc/inline_cross/issue-31948-2.rs | 12 +++++------ src/test/rustdoc/inline_cross/issue-31948.rs | 20 +++++++++---------- src/test/rustdoc/inline_cross/issue-32881.rs | 4 ++-- src/test/rustdoc/inline_cross/issue-33113.rs | 4 ++-- src/test/rustdoc/inline_cross/trait-vis.rs | 2 +- src/test/rustdoc/inline_local/trait-vis.rs | 4 ++-- src/test/rustdoc/issue-19190.rs | 4 ++-- src/test/rustdoc/issue-25001.rs | 18 ++++++++--------- src/test/rustdoc/issue-27362.rs | 2 +- src/test/rustdoc/issue-29503.rs | 2 +- src/test/rustdoc/issue-33592.rs | 4 ++-- src/test/rustdoc/issue-35169-2.rs | 14 ++++++------- src/test/rustdoc/issue-35169.rs | 14 ++++++------- src/test/rustdoc/issue-46727.rs | 2 +- src/test/rustdoc/issue-50159.rs | 4 ++-- src/test/rustdoc/issue-51236.rs | 2 +- src/test/rustdoc/issue-53689.rs | 2 +- src/test/rustdoc/issue-54705.rs | 4 ++-- src/test/rustdoc/issue-55321.rs | 8 ++++---- src/test/rustdoc/issue-56822.rs | 2 +- src/test/rustdoc/issue-60726.rs | 4 ++-- src/test/rustdoc/issue-75588.rs | 4 ++-- .../issue-80233-normalize-auto-trait.rs | 2 +- .../issue-82465-asref-for-and-of-local.rs | 4 ++-- src/test/rustdoc/negative-impl.rs | 4 ++-- src/test/rustdoc/primitive-generic-impl.rs | 2 +- src/test/rustdoc/recursive-deref.rs | 4 ++-- .../rustdoc/sidebar-links-to-foreign-impl.rs | 4 ++-- src/test/rustdoc/sized_trait.rs | 2 +- src/test/rustdoc/src-links-auto-impls.rs | 6 +++--- src/test/rustdoc/synthetic_auto/basic.rs | 4 ++-- src/test/rustdoc/synthetic_auto/complex.rs | 2 +- .../rustdoc/synthetic_auto/crate-local.rs | 6 +++--- src/test/rustdoc/synthetic_auto/lifetimes.rs | 4 ++-- src/test/rustdoc/synthetic_auto/manual.rs | 4 ++-- src/test/rustdoc/synthetic_auto/negative.rs | 4 ++-- src/test/rustdoc/synthetic_auto/nested.rs | 4 ++-- .../rustdoc/synthetic_auto/no-redundancy.rs | 2 +- src/test/rustdoc/synthetic_auto/overflow.rs | 2 +- src/test/rustdoc/synthetic_auto/project.rs | 4 ++-- .../synthetic_auto/self-referential.rs | 2 +- .../rustdoc/synthetic_auto/static-region.rs | 2 +- src/test/rustdoc/toggle-method.rs | 4 ++-- src/test/rustdoc/toggle-trait-fn.rs | 8 ++++---- src/test/rustdoc/trait-impl.rs | 2 +- src/test/rustdoc/traits-in-bodies.rs | 6 +++--- src/test/rustdoc/typedef.rs | 4 ++-- src/test/rustdoc/visibility.rs | 12 +++++------ src/test/rustdoc/where.rs | 10 +++++----- src/tools/html-checker/main.rs | 5 +++++ 72 files changed, 201 insertions(+), 196 deletions(-) diff --git a/src/test/rustdoc-gui/font-weight.goml b/src/test/rustdoc-gui/font-weight.goml index 84e898660fae7..92ad92a8c3415 100644 --- a/src/test/rustdoc-gui/font-weight.goml +++ b/src/test/rustdoc-gui/font-weight.goml @@ -2,9 +2,9 @@ goto: file://|DOC_PATH|/lib2/struct.Foo.html // This test checks that the font weight is correctly applied. assert-css: ("//*[@class='docblock type-decl']//a[text()='Alias']", {"font-weight": "400"}) assert-css: ("//*[@class='structfield small-section-header']//a[text()='Alias']", {"font-weight": "400"}) -assert-css: ("#method\.a_method > code", {"font-weight": "600"}) -assert-css: ("#associatedtype\.X > code", {"font-weight": "600"}) -assert-css: ("#associatedconstant\.Y > code", {"font-weight": "600"}) +assert-css: ("#method\.a_method > .code-header", {"font-weight": "600"}) +assert-css: ("#associatedtype\.X > .code-header", {"font-weight": "600"}) +assert-css: ("#associatedconstant\.Y > .code-header", {"font-weight": "600"}) goto: file://|DOC_PATH|/test_docs/type.SomeType.html assert-css: (".top-doc .docblock p", {"font-weight": "400"}, ALL) diff --git a/src/test/rustdoc-gui/implementors.goml b/src/test/rustdoc-gui/implementors.goml index a4db5cee7c768..87e4f2a7bd141 100644 --- a/src/test/rustdoc-gui/implementors.goml +++ b/src/test/rustdoc-gui/implementors.goml @@ -8,9 +8,9 @@ assert-count: ("#implementors-list > .impl", 2) assert: ("#implementors-list > .impl:nth-child(1) > a.anchor") assert-attribute: ("#implementors-list > .impl:nth-child(1)", {"id": "impl-Whatever"}) assert-attribute: ("#implementors-list > .impl:nth-child(1) > a.anchor", {"href": "#impl-Whatever"}) -assert: "#implementors-list > .impl:nth-child(1) > code.in-band" +assert: "#implementors-list > .impl:nth-child(1) > .code-header.in-band" assert: ("#implementors-list > .impl:nth-child(2) > a.anchor") assert-attribute: ("#implementors-list > .impl:nth-child(2)", {"id": "impl-Whatever-1"}) assert-attribute: ("#implementors-list > .impl:nth-child(2) > a.anchor", {"href": "#impl-Whatever-1"}) -assert: "#implementors-list > .impl:nth-child(2) > code.in-band" +assert: "#implementors-list > .impl:nth-child(2) > .code-header.in-band" diff --git a/src/test/rustdoc/assoc-consts.rs b/src/test/rustdoc/assoc-consts.rs index a3dd166e65171..c2c385568cea7 100644 --- a/src/test/rustdoc/assoc-consts.rs +++ b/src/test/rustdoc/assoc-consts.rs @@ -13,7 +13,7 @@ pub trait Foo { pub struct Bar; impl Foo for Bar { - // @has assoc_consts/struct.Bar.html '//code' 'impl Foo for Bar' + // @has assoc_consts/struct.Bar.html '//h3' 'impl Foo for Bar' // @has - '//*[@id="associatedconstant.FOO"]' 'const FOO: usize' const FOO: usize = 12; // @has - '//*[@id="associatedconstant.FOO_NO_DEFAULT"]' 'const FOO_NO_DEFAULT: bool' @@ -77,7 +77,7 @@ pub trait Qux { const QUX_DEFAULT2: u32 = 3; } -// @has assoc_consts/struct.Bar.html '//code' 'impl Qux for Bar' +// @has assoc_consts/struct.Bar.html '//h3' 'impl Qux for Bar' impl Qux for Bar { // @has - '//*[@id="associatedconstant.QUX0"]' 'const QUX0: u8' // @has - '//*[@class="docblock"]' "Docs for QUX0 in trait." diff --git a/src/test/rustdoc/assoc-types.rs b/src/test/rustdoc/assoc-types.rs index 8fda171002ba0..b1502be4c932e 100644 --- a/src/test/rustdoc/assoc-types.rs +++ b/src/test/rustdoc/assoc-types.rs @@ -2,11 +2,11 @@ // @has assoc_types/trait.Index.html pub trait Index { - // @has - '//*[@id="associatedtype.Output"]//code' 'type Output: ?Sized' + // @has - '//*[@id="associatedtype.Output"]//h4' 'type Output: ?Sized' type Output: ?Sized; - // @has - '//*[@id="tymethod.index"]//code' \ + // @has - '//*[@id="tymethod.index"]//h4' \ // "fn index<'a>(&'a self, index: I) -> &'a Self::Output" - // @has - '//*[@id="tymethod.index"]//code//a[@href="trait.Index.html#associatedtype.Output"]' \ + // @has - '//*[@id="tymethod.index"]//h4//a[@href="trait.Index.html#associatedtype.Output"]' \ // "Output" fn index<'a>(&'a self, index: I) -> &'a Self::Output; } diff --git a/src/test/rustdoc/async-fn.rs b/src/test/rustdoc/async-fn.rs index 9f95d9a994b17..b2c07669d9276 100644 --- a/src/test/rustdoc/async-fn.rs +++ b/src/test/rustdoc/async-fn.rs @@ -35,9 +35,9 @@ pub async fn quux() -> impl Bar { } // @has async_fn/struct.Foo.html -// @matches - '//code' 'pub async fn f\(\)$' -// @matches - '//code' 'pub async unsafe fn g\(\)$' -// @matches - '//code' 'pub async fn mut_self\(self, first: usize\)$' +// @matches - '//h4' 'pub async fn f\(\)$' +// @matches - '//h4' 'pub async unsafe fn g\(\)$' +// @matches - '//h4' 'pub async fn mut_self\(self, first: usize\)$' pub struct Foo; impl Foo { diff --git a/src/test/rustdoc/blanket-reexport-item.rs b/src/test/rustdoc/blanket-reexport-item.rs index 6f0c15cb5aca6..bad2c25b76cbe 100644 --- a/src/test/rustdoc/blanket-reexport-item.rs +++ b/src/test/rustdoc/blanket-reexport-item.rs @@ -1,6 +1,6 @@ #![crate_name = "foo"] -// @has foo/struct.S.html '//div[@id="impl-Into%3CU%3E"]//code' 'impl Into for T' +// @has foo/struct.S.html '//div[@id="impl-Into%3CU%3E"]//h3' 'impl Into for T' pub struct S2 {} mod m { pub struct S {} diff --git a/src/test/rustdoc/const-display.rs b/src/test/rustdoc/const-display.rs index 8c995b9426bbb..41e985e4855dd 100644 --- a/src/test/rustdoc/const-display.rs +++ b/src/test/rustdoc/const-display.rs @@ -49,19 +49,19 @@ pub const unsafe fn bar_not_gated() -> u32 { 42 } pub struct Foo; impl Foo { - // @has 'foo/struct.Foo.html' '//div[@id="method.gated"]/code' 'pub fn gated() -> u32' + // @has 'foo/struct.Foo.html' '//div[@id="method.gated"]/h4' 'pub fn gated() -> u32' // @has - '//span[@class="since"]' '1.0.0 (const: unstable)' #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature="foo", issue = "none")] pub const fn gated() -> u32 { 42 } - // @has 'foo/struct.Foo.html' '//div[@id="method.gated_unsafe"]/code' 'pub unsafe fn gated_unsafe() -> u32' + // @has 'foo/struct.Foo.html' '//div[@id="method.gated_unsafe"]/h4' 'pub unsafe fn gated_unsafe() -> u32' // @has - '//span[@class="since"]' '1.0.0 (const: unstable)' #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature="foo", issue = "none")] pub const unsafe fn gated_unsafe() -> u32 { 42 } - // @has 'foo/struct.Foo.html' '//div[@id="method.stable_impl"]/code' 'pub const fn stable_impl() -> u32' + // @has 'foo/struct.Foo.html' '//div[@id="method.stable_impl"]/h4' 'pub const fn stable_impl() -> u32' // @has - '//span[@class="since"]' '1.0.0 (const: 1.2.0)' #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "rust1", since = "1.2.0")] diff --git a/src/test/rustdoc/const-generics/add-impl.rs b/src/test/rustdoc/const-generics/add-impl.rs index 8f412aa8c4026..466d56c6f664d 100644 --- a/src/test/rustdoc/const-generics/add-impl.rs +++ b/src/test/rustdoc/const-generics/add-impl.rs @@ -8,7 +8,7 @@ pub struct Simd { inner: T, } -// @has foo/struct.Simd.html '//div[@id="trait-implementations-list"]//div/code' 'impl Add> for Simd' +// @has foo/struct.Simd.html '//div[@id="trait-implementations-list"]//div/h3' 'impl Add> for Simd' impl Add for Simd { type Output = Self; diff --git a/src/test/rustdoc/const-generics/const-generics-docs.rs b/src/test/rustdoc/const-generics/const-generics-docs.rs index 7c4c70432c762..e562c0d436a63 100644 --- a/src/test/rustdoc/const-generics/const-generics-docs.rs +++ b/src/test/rustdoc/const-generics/const-generics-docs.rs @@ -19,10 +19,10 @@ pub use extern_crate::WTrait; // @has foo/trait.Trait.html '//pre[@class="rust trait"]' \ // 'pub trait Trait' -// @has - '//*[@id="impl-Trait%3C1_usize%3E-for-u8"]//code' 'impl Trait<1_usize> for u8' -// @has - '//*[@id="impl-Trait%3C2_usize%3E-for-u8"]//code' 'impl Trait<2_usize> for u8' -// @has - '//*[@id="impl-Trait%3C{1%20+%202}%3E-for-u8"]//code' 'impl Trait<{1 + 2}> for u8' -// @has - '//*[@id="impl-Trait%3CN%3E-for-%5Bu8%3B%20N%5D"]//code' \ +// @has - '//*[@id="impl-Trait%3C1_usize%3E-for-u8"]//h3' 'impl Trait<1_usize> for u8' +// @has - '//*[@id="impl-Trait%3C2_usize%3E-for-u8"]//h3' 'impl Trait<2_usize> for u8' +// @has - '//*[@id="impl-Trait%3C{1%20+%202}%3E-for-u8"]//h3' 'impl Trait<{1 + 2}> for u8' +// @has - '//*[@id="impl-Trait%3CN%3E-for-%5Bu8%3B%20N%5D"]//h3' \ // 'impl Trait for [u8; N]' pub trait Trait {} impl Trait<1> for u8 {} @@ -36,7 +36,7 @@ pub struct Foo where u8: Trait; // @has foo/struct.Bar.html '//pre[@class="rust struct"]' 'pub struct Bar(_)' pub struct Bar([T; N]); -// @has foo/struct.Foo.html '//div[@id="impl"]/code' 'impl Foo where u8: Trait' +// @has foo/struct.Foo.html '//div[@id="impl"]/h3' 'impl Foo where u8: Trait' impl Foo where u8: Trait { // @has - '//*[@id="associatedconstant.FOO_ASSOC"]' 'pub const FOO_ASSOC: usize' pub const FOO_ASSOC: usize = M + 13; @@ -47,7 +47,7 @@ impl Foo where u8: Trait { } } -// @has foo/struct.Bar.html '//div[@id="impl"]/code' 'impl Bar' +// @has foo/struct.Bar.html '//div[@id="impl"]/h3' 'impl Bar' impl Bar { // @has - '//*[@id="method.hey"]' \ // 'pub fn hey(&self) -> Foo where u8: Trait' diff --git a/src/test/rustdoc/const-generics/const-impl.rs b/src/test/rustdoc/const-generics/const-impl.rs index e4e504dd83b5b..9d96936b22ff7 100644 --- a/src/test/rustdoc/const-generics/const-impl.rs +++ b/src/test/rustdoc/const-generics/const-impl.rs @@ -9,20 +9,20 @@ pub enum Order { } // @has foo/struct.VSet.html '//pre[@class="rust struct"]' 'pub struct VSet' -// @has foo/struct.VSet.html '//div[@id="impl-Send"]/code' 'impl Send for VSet' -// @has foo/struct.VSet.html '//div[@id="impl-Sync"]/code' 'impl Sync for VSet' +// @has foo/struct.VSet.html '//div[@id="impl-Send"]/h3' 'impl Send for VSet' +// @has foo/struct.VSet.html '//div[@id="impl-Sync"]/h3' 'impl Sync for VSet' pub struct VSet { inner: Vec, } -// @has foo/struct.VSet.html '//div[@id="impl"]/code' 'impl VSet' +// @has foo/struct.VSet.html '//div[@id="impl"]/h3' 'impl VSet' impl VSet { pub fn new() -> Self { Self { inner: Vec::new() } } } -// @has foo/struct.VSet.html '//div[@id="impl-1"]/code' 'impl VSet' +// @has foo/struct.VSet.html '//div[@id="impl-1"]/h3' 'impl VSet' impl VSet { pub fn new() -> Self { Self { inner: Vec::new() } @@ -31,7 +31,7 @@ impl VSet { pub struct Escape; -// @has foo/struct.Escape.html '//div[@id="impl"]/code' 'impl Escape<{ r#""# }>' +// @has foo/struct.Escape.html '//div[@id="impl"]/h3' 'impl Escape<{ r#""# }>' impl Escape<{ r#""# }> { pub fn f() {} } diff --git a/src/test/rustdoc/const-generics/lazy_normalization_consts/const-equate-pred.rs b/src/test/rustdoc/const-generics/lazy_normalization_consts/const-equate-pred.rs index 6cc02f78c625d..8a5b3275625a8 100644 --- a/src/test/rustdoc/const-generics/lazy_normalization_consts/const-equate-pred.rs +++ b/src/test/rustdoc/const-generics/lazy_normalization_consts/const-equate-pred.rs @@ -12,7 +12,7 @@ pub struct Hasher { unsafe impl Send for Hasher {} // @has foo/struct.Foo.html -// @has - '//code' 'impl Send for Foo' +// @has - '//h3' 'impl Send for Foo' pub struct Foo { hasher: Hasher<[u8; 3]>, } diff --git a/src/test/rustdoc/const.rs b/src/test/rustdoc/const.rs index 638de3292becb..d1658dac693d6 100644 --- a/src/test/rustdoc/const.rs +++ b/src/test/rustdoc/const.rs @@ -3,7 +3,7 @@ pub struct Foo; impl Foo { - // @has const/struct.Foo.html '//*[@id="method.new"]//code' 'const unsafe fn new' + // @has const/struct.Foo.html '//*[@id="method.new"]//h4' 'const unsafe fn new' pub const unsafe fn new() -> Foo { Foo } diff --git a/src/test/rustdoc/duplicate_impls/issue-33054.rs b/src/test/rustdoc/duplicate_impls/issue-33054.rs index 15c3444606c15..6bf8f7cdaddf2 100644 --- a/src/test/rustdoc/duplicate_impls/issue-33054.rs +++ b/src/test/rustdoc/duplicate_impls/issue-33054.rs @@ -1,10 +1,10 @@ // @has issue_33054/impls/struct.Foo.html -// @has - '//code' 'impl Foo' -// @has - '//code' 'impl Bar for Foo' +// @has - '//h3' 'impl Foo' +// @has - '//h3' 'impl Bar for Foo' // @count - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]' 1 // @count - '//*[@id="main"]/details/summary/*[@class="impl has-srclink"]' 1 // @has issue_33054/impls/bar/trait.Bar.html -// @has - '//code' 'impl Bar for Foo' +// @has - '//h3' 'impl Bar for Foo' // @count - '//*[@class="struct"]' 1 pub mod impls; diff --git a/src/test/rustdoc/extern-impl-trait.rs b/src/test/rustdoc/extern-impl-trait.rs index 58bd650feb466..677f77d0a51bf 100644 --- a/src/test/rustdoc/extern-impl-trait.rs +++ b/src/test/rustdoc/extern-impl-trait.rs @@ -4,8 +4,8 @@ extern crate extern_impl_trait; -// @has 'foo/struct.X.html' '//code' "impl Foo + 'a" +// @has 'foo/struct.X.html' '//h4' "impl Foo + 'a" pub use extern_impl_trait::X; -// @has 'foo/struct.Y.html' '//code' "impl ?Sized + Foo + 'a" +// @has 'foo/struct.Y.html' '//h4' "impl ?Sized + Foo + 'a" pub use extern_impl_trait::Y; diff --git a/src/test/rustdoc/extern-impl.rs b/src/test/rustdoc/extern-impl.rs index f68e10a4d092c..8a210a2d6a5db 100644 --- a/src/test/rustdoc/extern-impl.rs +++ b/src/test/rustdoc/extern-impl.rs @@ -4,24 +4,24 @@ pub struct Foo; impl Foo { - // @has - '//code' 'fn rust0()' + // @has - '//h4' 'fn rust0()' pub fn rust0() {} - // @has - '//code' 'fn rust1()' + // @has - '//h4' 'fn rust1()' pub extern "Rust" fn rust1() {} - // @has - '//code' 'extern "C" fn c0()' + // @has - '//h4' 'extern "C" fn c0()' pub extern fn c0() {} - // @has - '//code' 'extern "C" fn c1()' + // @has - '//h4' 'extern "C" fn c1()' pub extern "C" fn c1() {} - // @has - '//code' 'extern "system" fn system0()' + // @has - '//h4' 'extern "system" fn system0()' pub extern "system" fn system0() {} } // @has foo/trait.Bar.html pub trait Bar {} -// @has - '//code' 'impl Bar for fn()' +// @has - '//h3' 'impl Bar for fn()' impl Bar for fn() {} -// @has - '//code' 'impl Bar for extern "C" fn()' +// @has - '//h3' 'impl Bar for extern "C" fn()' impl Bar for extern fn() {} -// @has - '//code' 'impl Bar for extern "system" fn()' +// @has - '//h3' 'impl Bar for extern "system" fn()' impl Bar for extern "system" fn() {} diff --git a/src/test/rustdoc/extern-method.rs b/src/test/rustdoc/extern-method.rs index 7fbe5fe43274d..16529b1d4d707 100644 --- a/src/test/rustdoc/extern-method.rs +++ b/src/test/rustdoc/extern-method.rs @@ -6,14 +6,14 @@ extern crate rustdoc_extern_method as foo; // @has extern_method/trait.Foo.html //pre "pub trait Foo" -// @has - '//*[@id="tymethod.foo"]//code' 'extern "rust-call" fn foo' -// @has - '//*[@id="method.foo_"]//code' 'extern "rust-call" fn foo_' +// @has - '//*[@id="tymethod.foo"]//h4' 'extern "rust-call" fn foo' +// @has - '//*[@id="method.foo_"]//h4' 'extern "rust-call" fn foo_' pub use foo::Foo; // @has extern_method/trait.Bar.html //pre "pub trait Bar" pub trait Bar { - // @has - '//*[@id="tymethod.bar"]//code' 'extern "rust-call" fn bar' + // @has - '//*[@id="tymethod.bar"]//h4' 'extern "rust-call" fn bar' extern "rust-call" fn bar(&self, _: ()); - // @has - '//*[@id="method.bar_"]//code' 'extern "rust-call" fn bar_' + // @has - '//*[@id="method.bar_"]//h4' 'extern "rust-call" fn bar_' extern "rust-call" fn bar_(&self, _: ()) { } } diff --git a/src/test/rustdoc/generic-impl.rs b/src/test/rustdoc/generic-impl.rs index 96ced021041ff..043a7a3265488 100644 --- a/src/test/rustdoc/generic-impl.rs +++ b/src/test/rustdoc/generic-impl.rs @@ -2,10 +2,10 @@ use std::fmt; -// @!has foo/struct.Bar.html '//div[@id="impl-ToString"]//code' 'impl ToString for T' +// @!has foo/struct.Bar.html '//div[@id="impl-ToString"]//h3' 'impl ToString for T' pub struct Bar; -// @has foo/struct.Foo.html '//div[@id="impl-ToString"]//code' 'impl ToString for T' +// @has foo/struct.Foo.html '//div[@id="impl-ToString"]//h3' 'impl ToString for T' pub struct Foo; // @has foo/struct.Foo.html '//div[@class="sidebar-links"]/a[@href="#impl-ToString"]' 'ToString' diff --git a/src/test/rustdoc/higher-ranked-trait-bounds.rs b/src/test/rustdoc/higher-ranked-trait-bounds.rs index 41940b0884e43..9df0799ebf694 100644 --- a/src/test/rustdoc/higher-ranked-trait-bounds.rs +++ b/src/test/rustdoc/higher-ranked-trait-bounds.rs @@ -38,7 +38,7 @@ pub struct Foo<'a> { // @has - '//span[@id="structfield.some_trait"]' "some_trait: &'a dyn for<'b> Trait<'b>" impl<'a> Foo<'a> { - // @has - '//code' "pub fn bar() where T: Trait<'a>," + // @has - '//h4' "pub fn bar() where T: Trait<'a>," pub fn bar() where T: Trait<'a>, @@ -49,7 +49,7 @@ impl<'a> Foo<'a> { // @has foo/trait.B.html pub trait B<'x> {} -// @has - '//code[@class="in-band"]' "impl<'a> B<'a> for dyn for<'b> Trait<'b>" +// @has - '//h3[@class="code-header in-band"]' "impl<'a> B<'a> for dyn for<'b> Trait<'b>" impl<'a> B<'a> for dyn for<'b> Trait<'b> {} // @has foo/struct.Bar.html diff --git a/src/test/rustdoc/impl-disambiguation.rs b/src/test/rustdoc/impl-disambiguation.rs index 9f55318563937..2bf445a5037be 100644 --- a/src/test/rustdoc/impl-disambiguation.rs +++ b/src/test/rustdoc/impl-disambiguation.rs @@ -4,13 +4,13 @@ pub trait Foo {} pub struct Bar { field: T } -// @has foo/trait.Foo.html '//*[@class="item-list"]//code' \ +// @has foo/trait.Foo.html '//*[@class="item-list"]//h3' \ // "impl Foo for Bar" impl Foo for Bar {} -// @has foo/trait.Foo.html '//*[@class="item-list"]//code' \ +// @has foo/trait.Foo.html '//*[@class="item-list"]//h3' \ // "impl Foo for Bar" impl Foo for Bar {} -// @has foo/trait.Foo.html '//*[@class="item-list"]//code' \ +// @has foo/trait.Foo.html '//*[@class="item-list"]//h3' \ // "impl<'a> Foo for &'a Bar" impl<'a> Foo for &'a Bar {} @@ -22,9 +22,9 @@ pub mod mod2 { pub enum Baz {} } -// @has foo/trait.Foo.html '//*[@class="item-list"]//code' \ +// @has foo/trait.Foo.html '//*[@class="item-list"]//h3' \ // "impl Foo for foo::mod1::Baz" impl Foo for mod1::Baz {} -// @has foo/trait.Foo.html '//*[@class="item-list"]//code' \ +// @has foo/trait.Foo.html '//*[@class="item-list"]//h3' \ // "impl<'a> Foo for &'a foo::mod2::Baz" impl<'a> Foo for &'a mod2::Baz {} diff --git a/src/test/rustdoc/impl-parts.rs b/src/test/rustdoc/impl-parts.rs index e4039eecb7132..779b5eae705b4 100644 --- a/src/test/rustdoc/impl-parts.rs +++ b/src/test/rustdoc/impl-parts.rs @@ -5,8 +5,8 @@ pub auto trait AnAutoTrait {} pub struct Foo { field: T } -// @has impl_parts/struct.Foo.html '//*[@class="impl has-srclink"]//code' \ +// @has impl_parts/struct.Foo.html '//*[@class="impl has-srclink"]//h3' \ // "impl !AnAutoTrait for Foo where T: Sync," -// @has impl_parts/trait.AnAutoTrait.html '//*[@class="item-list"]//code' \ +// @has impl_parts/trait.AnAutoTrait.html '//*[@class="item-list"]//h3' \ // "impl !AnAutoTrait for Foo where T: Sync," impl !AnAutoTrait for Foo where T: Sync {} diff --git a/src/test/rustdoc/inline_cross/impl_trait.rs b/src/test/rustdoc/inline_cross/impl_trait.rs index a2adc0e63c9c0..dc3d2d1dbe2dd 100644 --- a/src/test/rustdoc/inline_cross/impl_trait.rs +++ b/src/test/rustdoc/inline_cross/impl_trait.rs @@ -31,8 +31,8 @@ pub use impl_trait_aux::func4; pub use impl_trait_aux::async_fn; // @has impl_trait/struct.Foo.html -// @has - '//*[@id="method.method"]//code' "pub fn method<'a>(_x: impl Clone + Into> + 'a)" -// @!has - '//*[@id="method.method"]//code' 'where' +// @has - '//*[@id="method.method"]//h4' "pub fn method<'a>(_x: impl Clone + Into> + 'a)" +// @!has - '//*[@id="method.method"]//h4' 'where' pub use impl_trait_aux::Foo; // @has impl_trait/struct.Bar.html diff --git a/src/test/rustdoc/inline_cross/issue-31948-1.rs b/src/test/rustdoc/inline_cross/issue-31948-1.rs index 390f0b845e00b..11fae9a08f2de 100644 --- a/src/test/rustdoc/inline_cross/issue-31948-1.rs +++ b/src/test/rustdoc/inline_cross/issue-31948-1.rs @@ -5,22 +5,22 @@ extern crate rustdoc_nonreachable_impls; // @has issue_31948_1/struct.Wobble.html -// @has - '//*[@class="impl has-srclink"]//code' 'Bark for' -// @has - '//*[@class="impl has-srclink"]//code' 'Woof for' -// @!has - '//*[@class="impl"]//code' 'Bar for' -// @!has - '//*[@class="impl"]//code' 'Qux for' +// @has - '//*[@class="impl has-srclink"]//h3' 'Bark for' +// @has - '//*[@class="impl has-srclink"]//h3' 'Woof for' +// @!has - '//*[@class="impl"]//h3' 'Bar for' +// @!has - '//*[@class="impl"]//h3' 'Qux for' pub use rustdoc_nonreachable_impls::hidden::Wobble; // @has issue_31948_1/trait.Bark.html -// @has - '//code' 'for Foo' -// @has - '//code' 'for Wobble' -// @!has - '//code' 'for Wibble' +// @has - '//h3' 'for Foo' +// @has - '//h3' 'for Wobble' +// @!has - '//h3' 'for Wibble' pub use rustdoc_nonreachable_impls::Bark; // @has issue_31948_1/trait.Woof.html -// @has - '//code' 'for Foo' -// @has - '//code' 'for Wobble' -// @!has - '//code' 'for Wibble' +// @has - '//h3' 'for Foo' +// @has - '//h3' 'for Wobble' +// @!has - '//h3' 'for Wibble' pub use rustdoc_nonreachable_impls::Woof; // @!has issue_31948_1/trait.Bar.html diff --git a/src/test/rustdoc/inline_cross/issue-31948-2.rs b/src/test/rustdoc/inline_cross/issue-31948-2.rs index 013e777440f1a..e7e718a8f8974 100644 --- a/src/test/rustdoc/inline_cross/issue-31948-2.rs +++ b/src/test/rustdoc/inline_cross/issue-31948-2.rs @@ -5,15 +5,15 @@ extern crate rustdoc_nonreachable_impls; // @has issue_31948_2/struct.Wobble.html -// @has - '//*[@class="impl has-srclink"]//code' 'Qux for' -// @has - '//*[@class="impl has-srclink"]//code' 'Bark for' -// @has - '//*[@class="impl has-srclink"]//code' 'Woof for' -// @!has - '//*[@class="impl"]//code' 'Bar for' +// @has - '//*[@class="impl has-srclink"]//h3' 'Qux for' +// @has - '//*[@class="impl has-srclink"]//h3' 'Bark for' +// @has - '//*[@class="impl has-srclink"]//h3' 'Woof for' +// @!has - '//*[@class="impl"]//h3' 'Bar for' pub use rustdoc_nonreachable_impls::hidden::Wobble; // @has issue_31948_2/trait.Qux.html -// @has - '//code' 'for Foo' -// @has - '//code' 'for Wobble' +// @has - '//h3' 'for Foo' +// @has - '//h3' 'for Wobble' pub use rustdoc_nonreachable_impls::hidden::Qux; // @!has issue_31948_2/trait.Bar.html diff --git a/src/test/rustdoc/inline_cross/issue-31948.rs b/src/test/rustdoc/inline_cross/issue-31948.rs index 82dcc2d2cc3ef..1e8375b24e90b 100644 --- a/src/test/rustdoc/inline_cross/issue-31948.rs +++ b/src/test/rustdoc/inline_cross/issue-31948.rs @@ -5,22 +5,22 @@ extern crate rustdoc_nonreachable_impls; // @has issue_31948/struct.Foo.html -// @has - '//*[@class="impl has-srclink"]//code' 'Bark for' -// @has - '//*[@class="impl has-srclink"]//code' 'Woof for' -// @!has - '//*[@class="impl has-srclink"]//code' 'Bar for' -// @!has - '//*[@class="impl"]//code' 'Qux for' +// @has - '//*[@class="impl has-srclink"]//h3' 'Bark for' +// @has - '//*[@class="impl has-srclink"]//h3' 'Woof for' +// @!has - '//*[@class="impl has-srclink"]//h3' 'Bar for' +// @!has - '//*[@class="impl"]//h3' 'Qux for' pub use rustdoc_nonreachable_impls::Foo; // @has issue_31948/trait.Bark.html -// @has - '//code' 'for Foo' -// @!has - '//code' 'for Wibble' -// @!has - '//code' 'for Wobble' +// @has - '//h3' 'for Foo' +// @!has - '//h3' 'for Wibble' +// @!has - '//h3' 'for Wobble' pub use rustdoc_nonreachable_impls::Bark; // @has issue_31948/trait.Woof.html -// @has - '//code' 'for Foo' -// @!has - '//code' 'for Wibble' -// @!has - '//code' 'for Wobble' +// @has - '//h3' 'for Foo' +// @!has - '//h3' 'for Wibble' +// @!has - '//h3' 'for Wobble' pub use rustdoc_nonreachable_impls::Woof; // @!has issue_31948/trait.Bar.html diff --git a/src/test/rustdoc/inline_cross/issue-32881.rs b/src/test/rustdoc/inline_cross/issue-32881.rs index 5f31e6cd3ad1f..aebfb01446ee0 100644 --- a/src/test/rustdoc/inline_cross/issue-32881.rs +++ b/src/test/rustdoc/inline_cross/issue-32881.rs @@ -5,7 +5,7 @@ extern crate rustdoc_trait_object_impl; // @has issue_32881/trait.Bar.html -// @has - '//code' "impl<'a> dyn Bar" -// @has - '//code' "impl<'a> Debug for dyn Bar" +// @has - '//h3' "impl<'a> dyn Bar" +// @has - '//h3' "impl<'a> Debug for dyn Bar" pub use rustdoc_trait_object_impl::Bar; diff --git a/src/test/rustdoc/inline_cross/issue-33113.rs b/src/test/rustdoc/inline_cross/issue-33113.rs index 1e633600aeff1..2e19e89ff31ff 100644 --- a/src/test/rustdoc/inline_cross/issue-33113.rs +++ b/src/test/rustdoc/inline_cross/issue-33113.rs @@ -5,6 +5,6 @@ extern crate bar; // @has issue_33113/trait.Bar.html -// @has - '//code' "for &'a char" -// @has - '//code' "for Foo" +// @has - '//h3' "for &'a char" +// @has - '//h3' "for Foo" pub use bar::Bar; diff --git a/src/test/rustdoc/inline_cross/trait-vis.rs b/src/test/rustdoc/inline_cross/trait-vis.rs index e6585449cb64e..beb30c8e0ddf5 100644 --- a/src/test/rustdoc/inline_cross/trait-vis.rs +++ b/src/test/rustdoc/inline_cross/trait-vis.rs @@ -3,5 +3,5 @@ extern crate inner; // @has trait_vis/struct.SomeStruct.html -// @has - '//code' 'impl Clone for SomeStruct' +// @has - '//h3' 'impl Clone for SomeStruct' pub use inner::SomeStruct; diff --git a/src/test/rustdoc/inline_local/trait-vis.rs b/src/test/rustdoc/inline_local/trait-vis.rs index a9b54fbe79edc..44af1786899b6 100644 --- a/src/test/rustdoc/inline_local/trait-vis.rs +++ b/src/test/rustdoc/inline_local/trait-vis.rs @@ -13,6 +13,6 @@ mod asdf { } // @has trait_vis/struct.SomeStruct.html -// @has - '//code' 'impl ThisTrait for SomeStruct' -// @!has - '//code' 'impl PrivateTrait for SomeStruct' +// @has - '//h3' 'impl ThisTrait for SomeStruct' +// @!has - '//h3' 'impl PrivateTrait for SomeStruct' pub use asdf::SomeStruct; diff --git a/src/test/rustdoc/issue-19190.rs b/src/test/rustdoc/issue-19190.rs index 9dac49c6413d8..38684830122e7 100644 --- a/src/test/rustdoc/issue-19190.rs +++ b/src/test/rustdoc/issue-19190.rs @@ -14,7 +14,7 @@ impl Deref for Bar { } // @has issue_19190/struct.Bar.html -// @has - '//*[@id="method.foo"]//code' 'fn foo(&self)' +// @has - '//*[@id="method.foo"]//h4' 'fn foo(&self)' // @has - '//*[@id="method.foo"]' 'fn foo(&self)' -// @!has - '//*[@id="method.static_foo"]//code' 'fn static_foo()' +// @!has - '//*[@id="method.static_foo"]//h4' 'fn static_foo()' // @!has - '//*[@id="method.static_foo"]' 'fn static_foo()' diff --git a/src/test/rustdoc/issue-25001.rs b/src/test/rustdoc/issue-25001.rs index e53cf6451353f..bcb10fb8a4c91 100644 --- a/src/test/rustdoc/issue-25001.rs +++ b/src/test/rustdoc/issue-25001.rs @@ -8,36 +8,36 @@ pub trait Bar { } impl Foo { - // @has - '//*[@id="method.pass"]//code' 'fn pass()' + // @has - '//*[@id="method.pass"]//h4' 'fn pass()' pub fn pass() {} } impl Foo { - // @has - '//*[@id="method.pass-1"]//code' 'fn pass() -> usize' + // @has - '//*[@id="method.pass-1"]//h4' 'fn pass() -> usize' pub fn pass() -> usize { 42 } } impl Foo { - // @has - '//*[@id="method.pass-2"]//code' 'fn pass() -> isize' + // @has - '//*[@id="method.pass-2"]//h4' 'fn pass() -> isize' pub fn pass() -> isize { 42 } } impl Bar for Foo { - // @has - '//*[@id="associatedtype.Item"]//code' 'type Item = T' + // @has - '//*[@id="associatedtype.Item"]//h4' 'type Item = T' type Item=T; - // @has - '//*[@id="method.quux"]//code' 'fn quux(self)' + // @has - '//*[@id="method.quux"]//h4' 'fn quux(self)' fn quux(self) {} } impl<'a, T> Bar for &'a Foo { - // @has - '//*[@id="associatedtype.Item-1"]//code' "type Item = &'a T" + // @has - '//*[@id="associatedtype.Item-1"]//h4' "type Item = &'a T" type Item=&'a T; - // @has - '//*[@id="method.quux-1"]//code' 'fn quux(self)' + // @has - '//*[@id="method.quux-1"]//h4' 'fn quux(self)' fn quux(self) {} } impl<'a, T> Bar for &'a mut Foo { - // @has - '//*[@id="associatedtype.Item-2"]//code' "type Item = &'a mut T" + // @has - '//*[@id="associatedtype.Item-2"]//h4' "type Item = &'a mut T" type Item=&'a mut T; - // @has - '//*[@id="method.quux-2"]//code' 'fn quux(self)' + // @has - '//*[@id="method.quux-2"]//h4' 'fn quux(self)' fn quux(self) {} } diff --git a/src/test/rustdoc/issue-27362.rs b/src/test/rustdoc/issue-27362.rs index 1cbba4b663df8..c3f1289114760 100644 --- a/src/test/rustdoc/issue-27362.rs +++ b/src/test/rustdoc/issue-27362.rs @@ -7,4 +7,4 @@ pub use issue_27362_aux::*; // @matches issue_27362/fn.foo.html '//pre' "pub const fn foo()" // @matches issue_27362/fn.bar.html '//pre' "pub const unsafe fn bar()" -// @matches issue_27362/struct.Foo.html '//code' "const unsafe fn baz()" +// @matches issue_27362/struct.Foo.html '//h4' "const unsafe fn baz()" diff --git a/src/test/rustdoc/issue-29503.rs b/src/test/rustdoc/issue-29503.rs index 23d9e73b567d0..4041ec770f7dd 100644 --- a/src/test/rustdoc/issue-29503.rs +++ b/src/test/rustdoc/issue-29503.rs @@ -5,7 +5,7 @@ pub trait MyTrait { fn my_string(&self) -> String; } -// @has - "//div[@id='implementors-list']//div[@id='impl-MyTrait']//code" "impl MyTrait for T where T: Debug" +// @has - "//div[@id='implementors-list']//div[@id='impl-MyTrait']//h3" "impl MyTrait for T where T: Debug" impl MyTrait for T where T: fmt::Debug { fn my_string(&self) -> String { format!("{:?}", self) diff --git a/src/test/rustdoc/issue-33592.rs b/src/test/rustdoc/issue-33592.rs index 81450f15c2078..4f41ebc19bb9e 100644 --- a/src/test/rustdoc/issue-33592.rs +++ b/src/test/rustdoc/issue-33592.rs @@ -6,8 +6,8 @@ pub struct Bar; pub struct Baz; -// @has foo/trait.Foo.html '//code' 'impl Foo for Bar' +// @has foo/trait.Foo.html '//h3' 'impl Foo for Bar' impl Foo for Bar {} -// @has foo/trait.Foo.html '//code' 'impl Foo for Baz' +// @has foo/trait.Foo.html '//h3' 'impl Foo for Baz' impl Foo for Baz {} diff --git a/src/test/rustdoc/issue-35169-2.rs b/src/test/rustdoc/issue-35169-2.rs index a688ae48d00ce..3fa6aceee8371 100644 --- a/src/test/rustdoc/issue-35169-2.rs +++ b/src/test/rustdoc/issue-35169-2.rs @@ -24,17 +24,17 @@ impl DerefMut for Bar { } // @has issue_35169_2/struct.Bar.html -// @has - '//*[@id="method.by_ref"]//code' 'fn by_ref(&self)' +// @has - '//*[@id="method.by_ref"]//h4' 'fn by_ref(&self)' // @has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)' -// @has - '//*[@id="method.by_explicit_ref"]//code' 'fn by_explicit_ref(self: &Foo)' +// @has - '//*[@id="method.by_explicit_ref"]//h4' 'fn by_explicit_ref(self: &Foo)' // @has - '//*[@id="method.by_explicit_ref"]' 'fn by_explicit_ref(self: &Foo)' -// @has - '//*[@id="method.by_mut_ref"]//code' 'fn by_mut_ref(&mut self)' +// @has - '//*[@id="method.by_mut_ref"]//h4' 'fn by_mut_ref(&mut self)' // @has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)' -// @has - '//*[@id="method.by_explicit_mut_ref"]//code' 'fn by_explicit_mut_ref(self: &mut Foo)' +// @has - '//*[@id="method.by_explicit_mut_ref"]//h4' 'fn by_explicit_mut_ref(self: &mut Foo)' // @has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)' -// @!has - '//*[@id="method.by_explicit_box"]//code' 'fn by_explicit_box(self: Box)' +// @!has - '//*[@id="method.by_explicit_box"]//h4' 'fn by_explicit_box(self: Box)' // @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box)' -// @!has - '//*[@id="method.by_explicit_self_box"]//code' 'fn by_explicit_self_box(self: Box)' +// @!has - '//*[@id="method.by_explicit_self_box"]//h4' 'fn by_explicit_self_box(self: Box)' // @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box)' -// @!has - '//*[@id="method.static_foo"]//code' 'fn static_foo()' +// @!has - '//*[@id="method.static_foo"]//h4' 'fn static_foo()' // @!has - '//*[@id="method.static_foo"]' 'fn static_foo()' diff --git a/src/test/rustdoc/issue-35169.rs b/src/test/rustdoc/issue-35169.rs index 4f10c04a616b3..cde803431755a 100644 --- a/src/test/rustdoc/issue-35169.rs +++ b/src/test/rustdoc/issue-35169.rs @@ -19,17 +19,17 @@ impl Deref for Bar { } // @has issue_35169/struct.Bar.html -// @has - '//*[@id="method.by_ref"]//code' 'fn by_ref(&self)' +// @has - '//*[@id="method.by_ref"]//h4' 'fn by_ref(&self)' // @has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)' -// @has - '//*[@id="method.by_explicit_ref"]//code' 'fn by_explicit_ref(self: &Foo)' +// @has - '//*[@id="method.by_explicit_ref"]//h4' 'fn by_explicit_ref(self: &Foo)' // @has - '//*[@id="method.by_explicit_ref"]' 'fn by_explicit_ref(self: &Foo)' -// @!has - '//*[@id="method.by_mut_ref"]//code' 'fn by_mut_ref(&mut self)' +// @!has - '//*[@id="method.by_mut_ref"]//h4' 'fn by_mut_ref(&mut self)' // @!has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)' -// @!has - '//*[@id="method.by_explicit_mut_ref"]//code' 'fn by_explicit_mut_ref(self: &mut Foo)' +// @!has - '//*[@id="method.by_explicit_mut_ref"]//h4' 'fn by_explicit_mut_ref(self: &mut Foo)' // @!has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)' -// @!has - '//*[@id="method.by_explicit_box"]//code' 'fn by_explicit_box(self: Box)' +// @!has - '//*[@id="method.by_explicit_box"]//h4' 'fn by_explicit_box(self: Box)' // @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box)' -// @!has - '//*[@id="method.by_explicit_self_box"]//code' 'fn by_explicit_self_box(self: Box)' +// @!has - '//*[@id="method.by_explicit_self_box"]//h4' 'fn by_explicit_self_box(self: Box)' // @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box)' -// @!has - '//*[@id="method.static_foo"]//code' 'fn static_foo()' +// @!has - '//*[@id="method.static_foo"]//h4' 'fn static_foo()' // @!has - '//*[@id="method.static_foo"]' 'fn static_foo()' diff --git a/src/test/rustdoc/issue-46727.rs b/src/test/rustdoc/issue-46727.rs index 0f991cf676ff7..e3ab780363860 100644 --- a/src/test/rustdoc/issue-46727.rs +++ b/src/test/rustdoc/issue-46727.rs @@ -3,5 +3,5 @@ extern crate issue_46727; // @has issue_46727/trait.Foo.html -// @has - '//code' 'impl Foo for Bar<[T; 3]>' +// @has - '//h3' 'impl Foo for Bar<[T; 3]>' pub use issue_46727::{Foo, Bar}; diff --git a/src/test/rustdoc/issue-50159.rs b/src/test/rustdoc/issue-50159.rs index 69774aa351f17..6bd7019eee07d 100644 --- a/src/test/rustdoc/issue-50159.rs +++ b/src/test/rustdoc/issue-50159.rs @@ -11,8 +11,8 @@ impl Signal2 for B where B: Signal { } // @has issue_50159/struct.Switch.html -// @has - '//code' 'impl Send for Switch where ::Item: Send' -// @has - '//code' 'impl Sync for Switch where ::Item: Sync' +// @has - '//h3' 'impl Send for Switch where ::Item: Send' +// @has - '//h3' 'impl Sync for Switch where ::Item: Sync' // @count - '//*[@id="implementations-list"]//*[@class="impl"]' 0 // @count - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]' 5 pub struct Switch { diff --git a/src/test/rustdoc/issue-51236.rs b/src/test/rustdoc/issue-51236.rs index e01dae6c7f183..1d5f558ade08e 100644 --- a/src/test/rustdoc/issue-51236.rs +++ b/src/test/rustdoc/issue-51236.rs @@ -7,7 +7,7 @@ pub mod traits { } // @has issue_51236/struct.Owned.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // "impl Send for Owned where >::Reader: Send" pub struct Owned where T: for<'a> ::traits::Owned<'a> { marker: PhantomData<>::Reader>, diff --git a/src/test/rustdoc/issue-53689.rs b/src/test/rustdoc/issue-53689.rs index 7fe962c506188..52ce4159d823e 100644 --- a/src/test/rustdoc/issue-53689.rs +++ b/src/test/rustdoc/issue-53689.rs @@ -6,7 +6,7 @@ extern crate issue_53689; // @has foo/trait.MyTrait.html // @!has - 'MyStruct' -// @count - '//*[code="impl MyTrait for T"]' 1 +// @count - '//*[h3="impl MyTrait for T"]' 1 pub trait MyTrait {} impl MyTrait for T {} diff --git a/src/test/rustdoc/issue-54705.rs b/src/test/rustdoc/issue-54705.rs index 5a94d36ed70d0..6c222445500a0 100644 --- a/src/test/rustdoc/issue-54705.rs +++ b/src/test/rustdoc/issue-54705.rs @@ -3,10 +3,10 @@ pub trait ScopeHandle<'scope> {} // @has issue_54705/struct.ScopeFutureContents.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // "impl<'scope, S> Send for ScopeFutureContents<'scope, S> where S: Sync" // -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // "impl<'scope, S> Sync for ScopeFutureContents<'scope, S> where S: Sync" pub struct ScopeFutureContents<'scope, S> where S: ScopeHandle<'scope>, diff --git a/src/test/rustdoc/issue-55321.rs b/src/test/rustdoc/issue-55321.rs index b664733487b3d..27b3699224915 100644 --- a/src/test/rustdoc/issue-55321.rs +++ b/src/test/rustdoc/issue-55321.rs @@ -1,9 +1,9 @@ #![feature(negative_impls)] // @has issue_55321/struct.A.html -// @has - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // "impl !Send for A" -// @has - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // "impl !Sync for A" pub struct A(); @@ -11,8 +11,8 @@ impl !Send for A {} impl !Sync for A {} // @has issue_55321/struct.B.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // "impl !Send for B" -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // "impl !Sync for B" pub struct B(A, Box); diff --git a/src/test/rustdoc/issue-56822.rs b/src/test/rustdoc/issue-56822.rs index 977596e0b9088..6856c5bb0324e 100644 --- a/src/test/rustdoc/issue-56822.rs +++ b/src/test/rustdoc/issue-56822.rs @@ -17,7 +17,7 @@ impl<'a, T> MyTrait for Inner<'a, T> { } // @has issue_56822/struct.Parser.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // "impl<'a> Send for Parser<'a>" pub struct Parser<'a> { field: > as MyTrait>::Output diff --git a/src/test/rustdoc/issue-60726.rs b/src/test/rustdoc/issue-60726.rs index e0417f1a4f4b8..a563a2df70dc3 100644 --- a/src/test/rustdoc/issue-60726.rs +++ b/src/test/rustdoc/issue-60726.rs @@ -26,9 +26,9 @@ where {} // @has issue_60726/struct.IntoIter.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // "impl !Send for IntoIter" -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // "impl !Sync for IntoIter" pub struct IntoIter{ hello:DynTrait>, diff --git a/src/test/rustdoc/issue-75588.rs b/src/test/rustdoc/issue-75588.rs index aebffeff5f05e..c7f2c8da7d9f1 100644 --- a/src/test/rustdoc/issue-75588.rs +++ b/src/test/rustdoc/issue-75588.rs @@ -10,8 +10,8 @@ extern crate realcore; extern crate real_gimli; // issue #74672 -// @!has foo/trait.Deref.html '//*[@id="impl-Deref-for-EndianSlice"]//code' 'impl Deref for EndianSlice' +// @!has foo/trait.Deref.html '//*[@id="impl-Deref-for-EndianSlice"]//h3' 'impl Deref for EndianSlice' pub use realcore::Deref; -// @has foo/trait.Join.html '//*[@id="impl-Join-for-Foo"]//code' 'impl Join for Foo' +// @has foo/trait.Join.html '//*[@id="impl-Join-for-Foo"]//h3' 'impl Join for Foo' pub use realcore::Join; diff --git a/src/test/rustdoc/issue-80233-normalize-auto-trait.rs b/src/test/rustdoc/issue-80233-normalize-auto-trait.rs index 585a0864bb25d..aa35715318052 100644 --- a/src/test/rustdoc/issue-80233-normalize-auto-trait.rs +++ b/src/test/rustdoc/issue-80233-normalize-auto-trait.rs @@ -31,7 +31,7 @@ impl Trait3 for Vec { pub struct Struct1 {} // @has issue_80233_normalize_auto_trait/struct.Question.html -// @has - '//code' 'impl Send for Question' +// @has - '//h3' 'impl Send for Question' pub struct Question { pub ins: < as Trait3>::Type3 as Trait2>::Type2, } diff --git a/src/test/rustdoc/issue-82465-asref-for-and-of-local.rs b/src/test/rustdoc/issue-82465-asref-for-and-of-local.rs index 618ac20ac487d..13e9aed8920bd 100644 --- a/src/test/rustdoc/issue-82465-asref-for-and-of-local.rs +++ b/src/test/rustdoc/issue-82465-asref-for-and-of-local.rs @@ -1,14 +1,14 @@ use std::convert::AsRef; pub struct Local; -// @has issue_82465_asref_for_and_of_local/struct.Local.html '//code' 'impl AsRef for Local' +// @has issue_82465_asref_for_and_of_local/struct.Local.html '//h3' 'impl AsRef for Local' impl AsRef for Local { fn as_ref(&self) -> &str { todo!() } } -// @has - '//code' 'impl AsRef for str' +// @has - '//h3' 'impl AsRef for str' impl AsRef for str { fn as_ref(&self) -> &Local { todo!() diff --git a/src/test/rustdoc/negative-impl.rs b/src/test/rustdoc/negative-impl.rs index ee65a7d5f3902..f42fa35614c42 100644 --- a/src/test/rustdoc/negative-impl.rs +++ b/src/test/rustdoc/negative-impl.rs @@ -5,10 +5,10 @@ pub struct Alpha; // @matches negative_impl/struct.Bravo.html '//pre' "pub struct Bravo" pub struct Bravo(B); -// @matches negative_impl/struct.Alpha.html '//*[@class="impl has-srclink"]//code' \ +// @matches negative_impl/struct.Alpha.html '//*[@class="impl has-srclink"]//h3' \ // "impl !Send for Alpha" impl !Send for Alpha {} -// @matches negative_impl/struct.Bravo.html '//*[@class="impl has-srclink"]//code' "\ +// @matches negative_impl/struct.Bravo.html '//*[@class="impl has-srclink"]//h3' "\ // impl !Send for Bravo" impl !Send for Bravo {} diff --git a/src/test/rustdoc/primitive-generic-impl.rs b/src/test/rustdoc/primitive-generic-impl.rs index 2951f5128e074..50a020ab71a12 100644 --- a/src/test/rustdoc/primitive-generic-impl.rs +++ b/src/test/rustdoc/primitive-generic-impl.rs @@ -2,4 +2,4 @@ include!("primitive/primitive-generic-impl.rs"); -// @has foo/primitive.i32.html '//div[@id="impl-ToString"]//code' 'impl ToString for T' +// @has foo/primitive.i32.html '//div[@id="impl-ToString"]//h3' 'impl ToString for T' diff --git a/src/test/rustdoc/recursive-deref.rs b/src/test/rustdoc/recursive-deref.rs index 91db01177c581..bd34f7338532e 100644 --- a/src/test/rustdoc/recursive-deref.rs +++ b/src/test/rustdoc/recursive-deref.rs @@ -3,7 +3,7 @@ use std::ops::Deref; pub struct A; pub struct B; -// @has recursive_deref/struct.A.html '//code' 'impl Deref for A' +// @has recursive_deref/struct.A.html '//h3' 'impl Deref for A' impl Deref for A { type Target = B; @@ -12,7 +12,7 @@ impl Deref for A { } } -// @has recursive_deref/struct.B.html '//code' 'impl Deref for B' +// @has recursive_deref/struct.B.html '//h3' 'impl Deref for B' impl Deref for B { type Target = A; diff --git a/src/test/rustdoc/sidebar-links-to-foreign-impl.rs b/src/test/rustdoc/sidebar-links-to-foreign-impl.rs index e73c5b4f640cf..bccc772d0d0d5 100644 --- a/src/test/rustdoc/sidebar-links-to-foreign-impl.rs +++ b/src/test/rustdoc/sidebar-links-to-foreign-impl.rs @@ -6,9 +6,9 @@ // @has - '//*[@class="sidebar-title"]/a[@href="#foreign-impls"]' 'Implementations on Foreign Types' // @has - '//h2[@id="foreign-impls"]' 'Implementations on Foreign Types' // @has - '//*[@class="sidebar-links"]/a[@href="#impl-Foo-for-u32"]' 'u32' -// @has - '//div[@id="impl-Foo-for-u32"]//code' 'impl Foo for u32' +// @has - '//div[@id="impl-Foo-for-u32"]//h3' 'impl Foo for u32' // @has - '//*[@class="sidebar-links"]/a[@href="#impl-Foo-for-%26%27a%20str"]' "&'a str" -// @has - '//div[@id="impl-Foo-for-%26%27a%20str"]//code' "impl<'a> Foo for &'a str" +// @has - '//div[@id="impl-Foo-for-%26%27a%20str"]//h3' "impl<'a> Foo for &'a str" pub trait Foo {} impl Foo for u32 {} diff --git a/src/test/rustdoc/sized_trait.rs b/src/test/rustdoc/sized_trait.rs index 6730c71e90f88..bbfde91157cfd 100644 --- a/src/test/rustdoc/sized_trait.rs +++ b/src/test/rustdoc/sized_trait.rs @@ -11,7 +11,7 @@ pub struct Bar { pub struct Foo(T); // @has foo/struct.Unsized.html -// @has - '//div[@id="impl-Sized"]/code' 'impl !Sized for Unsized' +// @has - '//div[@id="impl-Sized"]//h3' 'impl !Sized for Unsized' pub struct Unsized { data: [u8], } diff --git a/src/test/rustdoc/src-links-auto-impls.rs b/src/test/rustdoc/src-links-auto-impls.rs index 1952f723465d6..151aed861a6ac 100644 --- a/src/test/rustdoc/src-links-auto-impls.rs +++ b/src/test/rustdoc/src-links-auto-impls.rs @@ -1,11 +1,11 @@ #![crate_name = "foo"] // @has foo/struct.Unsized.html -// @has - '//div[@id="impl-Sized"]/code' 'impl !Sized for Unsized' +// @has - '//div[@id="impl-Sized"]/h3' 'impl !Sized for Unsized' // @!has - '//div[@id="impl-Sized"]//a[@class="srclink"]' '[src]' -// @has - '//div[@id="impl-Sync"]/code' 'impl Sync for Unsized' +// @has - '//div[@id="impl-Sync"]/h3' 'impl Sync for Unsized' // @!has - '//div[@id="impl-Sync"]//a[@class="srclink"]' '[src]' -// @has - '//div[@id="impl-Any"]/code' 'impl Any for T' +// @has - '//div[@id="impl-Any"]/h3' 'impl Any for T' // @has - '//div[@id="impl-Any"]//a[@class="srclink"]' '[src]' pub struct Unsized { data: [u8], diff --git a/src/test/rustdoc/synthetic_auto/basic.rs b/src/test/rustdoc/synthetic_auto/basic.rs index 943596a0c8518..3065898bdf0c9 100644 --- a/src/test/rustdoc/synthetic_auto/basic.rs +++ b/src/test/rustdoc/synthetic_auto/basic.rs @@ -1,6 +1,6 @@ // @has basic/struct.Foo.html -// @has - '//code' 'impl Send for Foo where T: Send' -// @has - '//code' 'impl Sync for Foo where T: Sync' +// @has - '//h3' 'impl Send for Foo where T: Send' +// @has - '//h3' 'impl Sync for Foo where T: Sync' // @count - '//*[@id="implementations-list"]//*[@class="impl has-srclink"]' 0 // @count - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]' 5 pub struct Foo { diff --git a/src/test/rustdoc/synthetic_auto/complex.rs b/src/test/rustdoc/synthetic_auto/complex.rs index 0213142266feb..16b0e2ae6a94a 100644 --- a/src/test/rustdoc/synthetic_auto/complex.rs +++ b/src/test/rustdoc/synthetic_auto/complex.rs @@ -20,7 +20,7 @@ mod foo { } // @has complex/struct.NotOuter.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // "impl<'a, T, K: ?Sized> Send for Outer<'a, T, K> where K: for<'b> Fn((&'b bool, &'a u8)) \ // -> &'b i8, T: MyTrait<'a>, >::MyItem: Copy, 'a: 'static" diff --git a/src/test/rustdoc/synthetic_auto/crate-local.rs b/src/test/rustdoc/synthetic_auto/crate-local.rs index 3346ac05ffe47..15cc12f63a20b 100644 --- a/src/test/rustdoc/synthetic_auto/crate-local.rs +++ b/src/test/rustdoc/synthetic_auto/crate-local.rs @@ -3,7 +3,7 @@ pub auto trait Banana {} // @has crate_local/struct.Peach.html -// @has - '//code' 'impl Banana for Peach' -// @has - '//code' 'impl Send for Peach' -// @has - '//code' 'impl Sync for Peach' +// @has - '//h3' 'impl Banana for Peach' +// @has - '//h3' 'impl Send for Peach' +// @has - '//h3' 'impl Sync for Peach' pub struct Peach; diff --git a/src/test/rustdoc/synthetic_auto/lifetimes.rs b/src/test/rustdoc/synthetic_auto/lifetimes.rs index c2e9b6f404677..00fd08d4e98e3 100644 --- a/src/test/rustdoc/synthetic_auto/lifetimes.rs +++ b/src/test/rustdoc/synthetic_auto/lifetimes.rs @@ -9,10 +9,10 @@ where {} // @has lifetimes/struct.Foo.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // "impl<'c, K> Send for Foo<'c, K> where K: for<'b> Fn(&'b bool) -> &'c u8, 'c: 'static" // -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // "impl<'c, K> Sync for Foo<'c, K> where K: Sync" pub struct Foo<'c, K: 'c> { inner_field: Inner<'c, K>, diff --git a/src/test/rustdoc/synthetic_auto/manual.rs b/src/test/rustdoc/synthetic_auto/manual.rs index 91fe6c351c5fc..44740e4aababd 100644 --- a/src/test/rustdoc/synthetic_auto/manual.rs +++ b/src/test/rustdoc/synthetic_auto/manual.rs @@ -1,8 +1,8 @@ // @has manual/struct.Foo.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // 'impl Sync for Foo where T: Sync' // -// @has - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // 'impl Send for Foo' // // @count - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]' 1 diff --git a/src/test/rustdoc/synthetic_auto/negative.rs b/src/test/rustdoc/synthetic_auto/negative.rs index 16b36b56b6807..e85bb1eb08571 100644 --- a/src/test/rustdoc/synthetic_auto/negative.rs +++ b/src/test/rustdoc/synthetic_auto/negative.rs @@ -3,10 +3,10 @@ pub struct Inner { } // @has negative/struct.Outer.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // "impl !Send for Outer" // -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // "impl !Sync for Outer" pub struct Outer { inner_field: Inner, diff --git a/src/test/rustdoc/synthetic_auto/nested.rs b/src/test/rustdoc/synthetic_auto/nested.rs index a6cf5890dcab4..556f4966d57d4 100644 --- a/src/test/rustdoc/synthetic_auto/nested.rs +++ b/src/test/rustdoc/synthetic_auto/nested.rs @@ -9,10 +9,10 @@ where } // @has nested/struct.Foo.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // 'impl Send for Foo where T: Copy' // -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // 'impl Sync for Foo where T: Sync' pub struct Foo { inner_field: Inner, diff --git a/src/test/rustdoc/synthetic_auto/no-redundancy.rs b/src/test/rustdoc/synthetic_auto/no-redundancy.rs index 5c744e3eb3c94..f66394c742198 100644 --- a/src/test/rustdoc/synthetic_auto/no-redundancy.rs +++ b/src/test/rustdoc/synthetic_auto/no-redundancy.rs @@ -9,7 +9,7 @@ where } // @has no_redundancy/struct.Outer.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // "impl Send for Outer where T: Copy + Send" pub struct Outer { inner_field: Inner, diff --git a/src/test/rustdoc/synthetic_auto/overflow.rs b/src/test/rustdoc/synthetic_auto/overflow.rs index 546b3e07793e1..d335d2f771fa6 100644 --- a/src/test/rustdoc/synthetic_auto/overflow.rs +++ b/src/test/rustdoc/synthetic_auto/overflow.rs @@ -21,7 +21,7 @@ enum TyData { struct VariableKind(I::InternedType); // @has overflow/struct.BoundVarsCollector.html -// @has - '//code' "impl<'tcx> Send for BoundVarsCollector<'tcx>" +// @has - '//h3' "impl<'tcx> Send for BoundVarsCollector<'tcx>" pub struct BoundVarsCollector<'tcx> { val: VariableKind> } diff --git a/src/test/rustdoc/synthetic_auto/project.rs b/src/test/rustdoc/synthetic_auto/project.rs index baf9924b1ae66..a5cdf51c9ea35 100644 --- a/src/test/rustdoc/synthetic_auto/project.rs +++ b/src/test/rustdoc/synthetic_auto/project.rs @@ -23,10 +23,10 @@ where } // @has project/struct.Foo.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // "impl<'c, K> Send for Foo<'c, K> where K: MyTrait, 'c: 'static" // -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // "impl<'c, K> Sync for Foo<'c, K> where K: MyTrait, ::MyItem: OtherTrait, \ // 'c: 'static," pub struct Foo<'c, K: 'c> { diff --git a/src/test/rustdoc/synthetic_auto/self-referential.rs b/src/test/rustdoc/synthetic_auto/self-referential.rs index e96187e2c9632..84b83a65d9065 100644 --- a/src/test/rustdoc/synthetic_auto/self-referential.rs +++ b/src/test/rustdoc/synthetic_auto/self-referential.rs @@ -23,7 +23,7 @@ impl Pattern for Wrapper { // @has self_referential/struct.WriteAndThen.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // "impl Send for WriteAndThen where ::Value: Send" pub struct WriteAndThen(pub P1::Value,pub > as Pattern>::Value) where P1: Pattern; diff --git a/src/test/rustdoc/synthetic_auto/static-region.rs b/src/test/rustdoc/synthetic_auto/static-region.rs index fc732a08ed404..2a737bdb3c636 100644 --- a/src/test/rustdoc/synthetic_auto/static-region.rs +++ b/src/test/rustdoc/synthetic_auto/static-region.rs @@ -3,7 +3,7 @@ pub trait OwnedTrait<'a> { } // @has static_region/struct.Owned.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//code' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ // "impl Send for Owned where >::Reader: Send" pub struct Owned where T: OwnedTrait<'static> { marker: >::Reader, diff --git a/src/test/rustdoc/toggle-method.rs b/src/test/rustdoc/toggle-method.rs index f7f6086a4cb10..c59b6bb8df0b3 100644 --- a/src/test/rustdoc/toggle-method.rs +++ b/src/test/rustdoc/toggle-method.rs @@ -4,9 +4,9 @@ // summary. Struct methods with no documentation should not be wrapped. // // @has foo/struct.Foo.html -// @has - '//details[@class="rustdoc-toggle method-toggle"]//summary//code' 'is_documented()' +// @has - '//details[@class="rustdoc-toggle method-toggle"]//summary//h4' 'is_documented()' // @has - '//details[@class="rustdoc-toggle method-toggle"]//*[@class="docblock"]' 'is_documented is documented' -// @!has - '//details[@class="rustdoc-toggle method-toggle"]//summary//code' 'not_documented()' +// @!has - '//details[@class="rustdoc-toggle method-toggle"]//summary//h4' 'not_documented()' pub struct Foo { } diff --git a/src/test/rustdoc/toggle-trait-fn.rs b/src/test/rustdoc/toggle-trait-fn.rs index 0bc5eba75a12d..7f235fada5081 100644 --- a/src/test/rustdoc/toggle-trait-fn.rs +++ b/src/test/rustdoc/toggle-trait-fn.rs @@ -4,11 +4,11 @@ // summary. Trait methods with no documentation should not be wrapped. // // @has foo/trait.Foo.html -// @has - '//details[@class="rustdoc-toggle"]//summary//code' 'is_documented()' -// @!has - '//details[@class="rustdoc-toggle"]//summary//code' 'not_documented()' +// @has - '//details[@class="rustdoc-toggle"]//summary//h4' 'is_documented()' +// @!has - '//details[@class="rustdoc-toggle"]//summary//h4' 'not_documented()' // @has - '//details[@class="rustdoc-toggle"]//*[@class="docblock"]' 'is_documented is documented' -// @has - '//details[@class="rustdoc-toggle"]//summary//code' 'is_documented_optional()' -// @!has - '//details[@class="rustdoc-toggle"]//summary//code' 'not_documented_optional()' +// @has - '//details[@class="rustdoc-toggle"]//summary//h4' 'is_documented_optional()' +// @!has - '//details[@class="rustdoc-toggle"]//summary//h4' 'not_documented_optional()' // @has - '//details[@class="rustdoc-toggle"]//*[@class="docblock"]' 'is_documented_optional is documented' pub trait Foo { fn not_documented(); diff --git a/src/test/rustdoc/trait-impl.rs b/src/test/rustdoc/trait-impl.rs index 931691db3e6d9..05ccc074bf110 100644 --- a/src/test/rustdoc/trait-impl.rs +++ b/src/test/rustdoc/trait-impl.rs @@ -43,5 +43,5 @@ impl Trait for Struct { // @!has - '//*[@id="method.d"]/../../div[@class="docblock"]/p/em' fn d() {} - // @has - '//*[@id="impl-Trait"]/code/a/@href' 'trait.Trait.html' + // @has - '//*[@id="impl-Trait"]/h3//a/@href' 'trait.Trait.html' } diff --git a/src/test/rustdoc/traits-in-bodies.rs b/src/test/rustdoc/traits-in-bodies.rs index 1c3727a5748e6..8d194d86f9c2f 100644 --- a/src/test/rustdoc/traits-in-bodies.rs +++ b/src/test/rustdoc/traits-in-bodies.rs @@ -4,7 +4,7 @@ pub struct Bounded(T); // @has traits_in_bodies/struct.SomeStruct.html -// @has - '//code' 'impl Clone for SomeStruct' +// @has - '//h3' 'impl Clone for SomeStruct' pub struct SomeStruct; fn asdf() -> Bounded { @@ -18,7 +18,7 @@ fn asdf() -> Bounded { } // @has traits_in_bodies/struct.Point.html -// @has - '//code' 'impl Copy for Point' +// @has - '//h3' 'impl Copy for Point' #[derive(Clone)] pub struct Point { x: i32, @@ -31,7 +31,7 @@ const _FOO: () = { }; // @has traits_in_bodies/struct.Inception.html -// @has - '//code' 'impl Clone for Inception' +// @has - '//h3' 'impl Clone for Inception' pub struct Inception; static _BAR: usize = { diff --git a/src/test/rustdoc/typedef.rs b/src/test/rustdoc/typedef.rs index 479cd91a9dc60..f8bf9acc9b686 100644 --- a/src/test/rustdoc/typedef.rs +++ b/src/test/rustdoc/typedef.rs @@ -9,8 +9,8 @@ impl MyStruct { } // @has typedef/type.MyAlias.html -// @has - '//*[@class="impl has-srclink"]//code' 'impl MyAlias' -// @has - '//*[@class="impl has-srclink"]//code' 'impl MyTrait for MyAlias' +// @has - '//*[@class="impl has-srclink"]//h3' 'impl MyAlias' +// @has - '//*[@class="impl has-srclink"]//h3' 'impl MyTrait for MyAlias' // @has - 'Alias docstring' // @has - '//*[@class="sidebar"]//*[@class="location"]' 'Type Definition MyAlias' // @has - '//*[@class="sidebar"]//a[@href="#implementations"]' 'Methods' diff --git a/src/test/rustdoc/visibility.rs b/src/test/rustdoc/visibility.rs index beb638406c4be..df11a898709f6 100644 --- a/src/test/rustdoc/visibility.rs +++ b/src/test/rustdoc/visibility.rs @@ -60,14 +60,14 @@ pub trait PubTrait { fn function(); } -// @has 'foo/struct.FooPublic.html' '//code' 'type Type' -// @!has 'foo/struct.FooPublic.html' '//code' 'pub type Type' +// @has 'foo/struct.FooPublic.html' '//h4' 'type Type' +// @!has 'foo/struct.FooPublic.html' '//h4' 'pub type Type' // -// @has 'foo/struct.FooPublic.html' '//code' 'const CONST: usize' -// @!has 'foo/struct.FooPublic.html' '//code' 'pub const CONST: usize' +// @has 'foo/struct.FooPublic.html' '//h4' 'const CONST: usize' +// @!has 'foo/struct.FooPublic.html' '//h4' 'pub const CONST: usize' // -// @has 'foo/struct.FooPublic.html' '//code' 'fn function()' -// @!has 'foo/struct.FooPublic.html' '//code' 'pub fn function()' +// @has 'foo/struct.FooPublic.html' '//h4' 'fn function()' +// @!has 'foo/struct.FooPublic.html' '//h4' 'pub fn function()' impl PubTrait for FooPublic { type Type = usize; diff --git a/src/test/rustdoc/where.rs b/src/test/rustdoc/where.rs index f204a27d7d3c1..d08abb0951f88 100644 --- a/src/test/rustdoc/where.rs +++ b/src/test/rustdoc/where.rs @@ -11,7 +11,7 @@ pub fn charlie() where C: MyTrait {} pub struct Delta(D); -// @has foo/struct.Delta.html '//*[@class="impl has-srclink"]//code' \ +// @has foo/struct.Delta.html '//*[@class="impl has-srclink"]//h3' \ // "impl Delta where D: MyTrait" impl Delta where D: MyTrait { pub fn delta() {} @@ -19,17 +19,17 @@ impl Delta where D: MyTrait { pub struct Echo(E); -// @has foo/struct.Echo.html '//*[@class="impl has-srclink"]//code' \ +// @has foo/struct.Echo.html '//*[@class="impl has-srclink"]//h3' \ // "impl MyTrait for Echo where E: MyTrait" -// @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//code' \ +// @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//h3' \ // "impl MyTrait for Echo where E: MyTrait" impl MyTrait for Echo where E: MyTrait {} pub enum Foxtrot { Foxtrot1(F) } -// @has foo/enum.Foxtrot.html '//*[@class="impl has-srclink"]//code' \ +// @has foo/enum.Foxtrot.html '//*[@class="impl has-srclink"]//h3' \ // "impl MyTrait for Foxtrot where F: MyTrait" -// @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//code' \ +// @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//h3' \ // "impl MyTrait for Foxtrot where F: MyTrait" impl MyTrait for Foxtrot where F: MyTrait {} diff --git a/src/tools/html-checker/main.rs b/src/tools/html-checker/main.rs index bf2830254e819..7bdf527d8842b 100644 --- a/src/tools/html-checker/main.rs +++ b/src/tools/html-checker/main.rs @@ -15,6 +15,11 @@ fn check_html_file(file: &Path) -> usize { "MISSING_ENDTAG_BEFORE", "INSERTING_TAG", "DISCARDING_UNEXPECTED", + // This error is caused by nesting the Notable Traits tooltip within an

tag. + // The solution is to avoid doing that, but we need to have the

tags for accessibility + // reasons, and we need the Notable Traits tooltip to help everyone understand the Iterator + // combinators + "TAG_NOT_ALLOWED_IN", ]; let to_mute_s = to_mute.join(","); let mut command = Command::new("tidy"); From 0e0ca2662c3e56f5dd0ba4c0300775a70f92c71f Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Fri, 23 Jul 2021 07:10:26 -0700 Subject: [PATCH 03/10] Update src/test/rustdoc/assoc-consts.rs Co-authored-by: Guillaume Gomez --- src/test/rustdoc/assoc-consts.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/rustdoc/assoc-consts.rs b/src/test/rustdoc/assoc-consts.rs index c2c385568cea7..8c3ee99ccd194 100644 --- a/src/test/rustdoc/assoc-consts.rs +++ b/src/test/rustdoc/assoc-consts.rs @@ -77,7 +77,7 @@ pub trait Qux { const QUX_DEFAULT2: u32 = 3; } -// @has assoc_consts/struct.Bar.html '//h3' 'impl Qux for Bar' +// @has assoc_consts/struct.Bar.html '//h3[@class="code-header"]' 'impl Qux for Bar' impl Qux for Bar { // @has - '//*[@id="associatedconstant.QUX0"]' 'const QUX0: u8' // @has - '//*[@class="docblock"]' "Docs for QUX0 in trait." From 2f4c4c3b00faf8d16f6ed1c4bb4eb66c15283f5f Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Fri, 23 Jul 2021 07:10:45 -0700 Subject: [PATCH 04/10] Update src/test/rustdoc/assoc-types.rs Co-authored-by: Guillaume Gomez --- src/test/rustdoc/assoc-types.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/rustdoc/assoc-types.rs b/src/test/rustdoc/assoc-types.rs index b1502be4c932e..fd9f4569423ca 100644 --- a/src/test/rustdoc/assoc-types.rs +++ b/src/test/rustdoc/assoc-types.rs @@ -2,7 +2,7 @@ // @has assoc_types/trait.Index.html pub trait Index { - // @has - '//*[@id="associatedtype.Output"]//h4' 'type Output: ?Sized' + // @has - '//*[@id="associatedtype.Output"]//h4[@class="code-header"]' 'type Output: ?Sized' type Output: ?Sized; // @has - '//*[@id="tymethod.index"]//h4' \ // "fn index<'a>(&'a self, index: I) -> &'a Self::Output" From ca55553b7375b6d3378da2c5842e06ff3bcc7e19 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Fri, 23 Jul 2021 08:17:59 -0700 Subject: [PATCH 05/10] Fix test case with in-band class --- src/test/rustdoc/assoc-consts.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/rustdoc/assoc-consts.rs b/src/test/rustdoc/assoc-consts.rs index 8c3ee99ccd194..0bfeac89f4d1d 100644 --- a/src/test/rustdoc/assoc-consts.rs +++ b/src/test/rustdoc/assoc-consts.rs @@ -77,7 +77,7 @@ pub trait Qux { const QUX_DEFAULT2: u32 = 3; } -// @has assoc_consts/struct.Bar.html '//h3[@class="code-header"]' 'impl Qux for Bar' +// @has assoc_consts/struct.Bar.html '//h3[@class="code-header in-band"]' 'impl Qux for Bar' impl Qux for Bar { // @has - '//*[@id="associatedconstant.QUX0"]' 'const QUX0: u8' // @has - '//*[@class="docblock"]' "Docs for QUX0 in trait." From 839693c883149c06753641ecbf4f58f2bcfdae86 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Fri, 23 Jul 2021 08:18:45 -0700 Subject: [PATCH 06/10] Commit modified GuillaumeGomez suggestion with h3 class --- src/test/rustdoc/assoc-consts.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/rustdoc/assoc-consts.rs b/src/test/rustdoc/assoc-consts.rs index 0bfeac89f4d1d..ff7fd66391628 100644 --- a/src/test/rustdoc/assoc-consts.rs +++ b/src/test/rustdoc/assoc-consts.rs @@ -13,7 +13,7 @@ pub trait Foo { pub struct Bar; impl Foo for Bar { - // @has assoc_consts/struct.Bar.html '//h3' 'impl Foo for Bar' + // @has assoc_consts/struct.Bar.html '//h3[@class="code-header in-band"]' 'impl Foo for Bar' // @has - '//*[@id="associatedconstant.FOO"]' 'const FOO: usize' const FOO: usize = 12; // @has - '//*[@id="associatedconstant.FOO_NO_DEFAULT"]' 'const FOO_NO_DEFAULT: bool' From ea6df15c24a10effeae390df24998db69315bac9 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Fri, 23 Jul 2021 08:19:58 -0700 Subject: [PATCH 07/10] Add class name to rustdoc test --- src/test/rustdoc/assoc-types.rs | 4 ++-- src/test/rustdoc/async-fn.rs | 6 +++--- src/test/rustdoc/blanket-reexport-item.rs | 2 +- src/test/rustdoc/const-display.rs | 6 +++--- src/test/rustdoc/recursive-deref.rs | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/test/rustdoc/assoc-types.rs b/src/test/rustdoc/assoc-types.rs index fd9f4569423ca..d9e4ffab1c7d5 100644 --- a/src/test/rustdoc/assoc-types.rs +++ b/src/test/rustdoc/assoc-types.rs @@ -4,9 +4,9 @@ pub trait Index { // @has - '//*[@id="associatedtype.Output"]//h4[@class="code-header"]' 'type Output: ?Sized' type Output: ?Sized; - // @has - '//*[@id="tymethod.index"]//h4' \ + // @has - '//*[@id="tymethod.index"]//h4[@class="code-header"]' \ // "fn index<'a>(&'a self, index: I) -> &'a Self::Output" - // @has - '//*[@id="tymethod.index"]//h4//a[@href="trait.Index.html#associatedtype.Output"]' \ + // @has - '//*[@id="tymethod.index"]//h4[@class="code-header"]//a[@href="trait.Index.html#associatedtype.Output"]' \ // "Output" fn index<'a>(&'a self, index: I) -> &'a Self::Output; } diff --git a/src/test/rustdoc/async-fn.rs b/src/test/rustdoc/async-fn.rs index b2c07669d9276..6d85171edf784 100644 --- a/src/test/rustdoc/async-fn.rs +++ b/src/test/rustdoc/async-fn.rs @@ -35,9 +35,9 @@ pub async fn quux() -> impl Bar { } // @has async_fn/struct.Foo.html -// @matches - '//h4' 'pub async fn f\(\)$' -// @matches - '//h4' 'pub async unsafe fn g\(\)$' -// @matches - '//h4' 'pub async fn mut_self\(self, first: usize\)$' +// @matches - '//h4[@class="code-header"]' 'pub async fn f\(\)$' +// @matches - '//h4[@class="code-header"]' 'pub async unsafe fn g\(\)$' +// @matches - '//h4[@class="code-header"]' 'pub async fn mut_self\(self, first: usize\)$' pub struct Foo; impl Foo { diff --git a/src/test/rustdoc/blanket-reexport-item.rs b/src/test/rustdoc/blanket-reexport-item.rs index bad2c25b76cbe..b934d84a9f616 100644 --- a/src/test/rustdoc/blanket-reexport-item.rs +++ b/src/test/rustdoc/blanket-reexport-item.rs @@ -1,6 +1,6 @@ #![crate_name = "foo"] -// @has foo/struct.S.html '//div[@id="impl-Into%3CU%3E"]//h3' 'impl Into for T' +// @has foo/struct.S.html '//div[@id="impl-Into%3CU%3E"]//h3[@class="code-header in-band"]' 'impl Into for T' pub struct S2 {} mod m { pub struct S {} diff --git a/src/test/rustdoc/const-display.rs b/src/test/rustdoc/const-display.rs index 41e985e4855dd..fb8ea7e33c28c 100644 --- a/src/test/rustdoc/const-display.rs +++ b/src/test/rustdoc/const-display.rs @@ -49,19 +49,19 @@ pub const unsafe fn bar_not_gated() -> u32 { 42 } pub struct Foo; impl Foo { - // @has 'foo/struct.Foo.html' '//div[@id="method.gated"]/h4' 'pub fn gated() -> u32' + // @has 'foo/struct.Foo.html' '//div[@id="method.gated"]/h4[@class="code-header"]' 'pub fn gated() -> u32' // @has - '//span[@class="since"]' '1.0.0 (const: unstable)' #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature="foo", issue = "none")] pub const fn gated() -> u32 { 42 } - // @has 'foo/struct.Foo.html' '//div[@id="method.gated_unsafe"]/h4' 'pub unsafe fn gated_unsafe() -> u32' + // @has 'foo/struct.Foo.html' '//div[@id="method.gated_unsafe"]/h4[@class="code-header"]' 'pub unsafe fn gated_unsafe() -> u32' // @has - '//span[@class="since"]' '1.0.0 (const: unstable)' #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature="foo", issue = "none")] pub const unsafe fn gated_unsafe() -> u32 { 42 } - // @has 'foo/struct.Foo.html' '//div[@id="method.stable_impl"]/h4' 'pub const fn stable_impl() -> u32' + // @has 'foo/struct.Foo.html' '//div[@id="method.stable_impl"]/h4[@class="code-header"]' 'pub const fn stable_impl() -> u32' // @has - '//span[@class="since"]' '1.0.0 (const: 1.2.0)' #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "rust1", since = "1.2.0")] diff --git a/src/test/rustdoc/recursive-deref.rs b/src/test/rustdoc/recursive-deref.rs index bd34f7338532e..3d17bce472154 100644 --- a/src/test/rustdoc/recursive-deref.rs +++ b/src/test/rustdoc/recursive-deref.rs @@ -3,7 +3,7 @@ use std::ops::Deref; pub struct A; pub struct B; -// @has recursive_deref/struct.A.html '//h3' 'impl Deref for A' +// @has recursive_deref/struct.A.html '//h3[@class="code-header in-band"]' 'impl Deref for A' impl Deref for A { type Target = B; @@ -12,7 +12,7 @@ impl Deref for A { } } -// @has recursive_deref/struct.B.html '//h3' 'impl Deref for B' +// @has recursive_deref/struct.B.html '//h3[@class="code-header in-band"]' 'impl Deref for B' impl Deref for B { type Target = A; From e2a67b9a4cc93da258b51f723d3510b617349a6c Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Fri, 23 Jul 2021 08:29:24 -0700 Subject: [PATCH 08/10] Fix highlighting in notable tooltip --- src/librustdoc/html/static/css/themes/ayu.css | 2 +- src/librustdoc/html/static/css/themes/dark.css | 2 +- src/librustdoc/html/static/css/themes/light.css | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css index 354cdd2fb035b..df386fb66a33f 100644 --- a/src/librustdoc/html/static/css/themes/ayu.css +++ b/src/librustdoc/html/static/css/themes/ayu.css @@ -334,7 +334,7 @@ a.test-arrow:hover { color: #999; } -:target, :target * { +:target, :target > * { background: rgba(255, 236, 164, 0.06); } diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css index b4f5a13c81509..c8a5dbdc66aaf 100644 --- a/src/librustdoc/html/static/css/themes/dark.css +++ b/src/librustdoc/html/static/css/themes/dark.css @@ -282,7 +282,7 @@ a.test-arrow:hover{ color: #999; } -:target, :target * { +:target, :target > * { background-color: #494a3d; } diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css index 29cbcd65ce81d..bc18a72450896 100644 --- a/src/librustdoc/html/static/css/themes/light.css +++ b/src/librustdoc/html/static/css/themes/light.css @@ -274,7 +274,7 @@ a.test-arrow:hover{ color: #999; } -:target, :target * { +:target, :target > * { background: #FDFFD3; } From 07667f9c5e81c0015741e7ad2cb315084ff8c366 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Sat, 24 Jul 2021 11:48:20 -0700 Subject: [PATCH 09/10] Update the remaining rustdoc tests with code-header --- src/test/rustdoc/const-generics/add-impl.rs | 2 +- .../const-generics/const-generics-docs.rs | 12 +++++------ src/test/rustdoc/const-generics/const-impl.rs | 10 +++++----- .../const-equate-pred.rs | 2 +- src/test/rustdoc/const.rs | 2 +- .../rustdoc/duplicate_impls/issue-33054.rs | 6 +++--- src/test/rustdoc/extern-impl-trait.rs | 4 ++-- src/test/rustdoc/extern-impl.rs | 16 +++++++-------- src/test/rustdoc/extern-method.rs | 8 ++++---- src/test/rustdoc/generic-impl.rs | 4 ++-- .../rustdoc/higher-ranked-trait-bounds.rs | 2 +- src/test/rustdoc/impl-disambiguation.rs | 10 +++++----- src/test/rustdoc/impl-parts.rs | 4 ++-- src/test/rustdoc/inline_cross/impl_trait.rs | 4 ++-- .../rustdoc/inline_cross/issue-31948-1.rs | 20 +++++++++---------- .../rustdoc/inline_cross/issue-31948-2.rs | 12 +++++------ src/test/rustdoc/inline_cross/issue-31948.rs | 20 +++++++++---------- src/test/rustdoc/inline_cross/issue-32881.rs | 4 ++-- src/test/rustdoc/inline_cross/issue-33113.rs | 4 ++-- src/test/rustdoc/inline_cross/trait-vis.rs | 2 +- src/test/rustdoc/inline_local/trait-vis.rs | 4 ++-- src/test/rustdoc/issue-19190.rs | 4 ++-- src/test/rustdoc/issue-25001.rs | 18 ++++++++--------- src/test/rustdoc/issue-27362.rs | 2 +- src/test/rustdoc/issue-29503.rs | 2 +- src/test/rustdoc/issue-33592.rs | 4 ++-- src/test/rustdoc/issue-35169-2.rs | 14 ++++++------- src/test/rustdoc/issue-35169.rs | 14 ++++++------- src/test/rustdoc/issue-46727.rs | 2 +- src/test/rustdoc/issue-50159.rs | 4 ++-- src/test/rustdoc/issue-51236.rs | 2 +- src/test/rustdoc/issue-54705.rs | 4 ++-- src/test/rustdoc/issue-55321.rs | 8 ++++---- src/test/rustdoc/issue-56822.rs | 2 +- src/test/rustdoc/issue-60726.rs | 4 ++-- src/test/rustdoc/issue-75588.rs | 4 ++-- .../issue-80233-normalize-auto-trait.rs | 2 +- .../issue-82465-asref-for-and-of-local.rs | 4 ++-- src/test/rustdoc/negative-impl.rs | 4 ++-- src/test/rustdoc/primitive-generic-impl.rs | 2 +- .../rustdoc/sidebar-links-to-foreign-impl.rs | 4 ++-- src/test/rustdoc/sized_trait.rs | 2 +- src/test/rustdoc/src-links-auto-impls.rs | 6 +++--- src/test/rustdoc/synthetic_auto/basic.rs | 4 ++-- src/test/rustdoc/synthetic_auto/complex.rs | 2 +- .../rustdoc/synthetic_auto/crate-local.rs | 6 +++--- src/test/rustdoc/synthetic_auto/lifetimes.rs | 4 ++-- src/test/rustdoc/synthetic_auto/manual.rs | 4 ++-- src/test/rustdoc/synthetic_auto/negative.rs | 4 ++-- src/test/rustdoc/synthetic_auto/nested.rs | 4 ++-- .../rustdoc/synthetic_auto/no-redundancy.rs | 2 +- src/test/rustdoc/synthetic_auto/overflow.rs | 2 +- src/test/rustdoc/synthetic_auto/project.rs | 4 ++-- .../synthetic_auto/self-referential.rs | 2 +- .../rustdoc/synthetic_auto/static-region.rs | 2 +- src/test/rustdoc/toggle-method.rs | 4 ++-- src/test/rustdoc/toggle-trait-fn.rs | 8 ++++---- src/test/rustdoc/traits-in-bodies.rs | 6 +++--- src/test/rustdoc/typedef.rs | 4 ++-- src/test/rustdoc/visibility.rs | 12 +++++------ src/test/rustdoc/where.rs | 10 +++++----- 61 files changed, 174 insertions(+), 174 deletions(-) diff --git a/src/test/rustdoc/const-generics/add-impl.rs b/src/test/rustdoc/const-generics/add-impl.rs index 466d56c6f664d..123dbaa406b83 100644 --- a/src/test/rustdoc/const-generics/add-impl.rs +++ b/src/test/rustdoc/const-generics/add-impl.rs @@ -8,7 +8,7 @@ pub struct Simd { inner: T, } -// @has foo/struct.Simd.html '//div[@id="trait-implementations-list"]//div/h3' 'impl Add> for Simd' +// @has foo/struct.Simd.html '//div[@id="trait-implementations-list"]//div/h3[@class="code-header in-band"]' 'impl Add> for Simd' impl Add for Simd { type Output = Self; diff --git a/src/test/rustdoc/const-generics/const-generics-docs.rs b/src/test/rustdoc/const-generics/const-generics-docs.rs index e562c0d436a63..92d2c4697e7ed 100644 --- a/src/test/rustdoc/const-generics/const-generics-docs.rs +++ b/src/test/rustdoc/const-generics/const-generics-docs.rs @@ -19,10 +19,10 @@ pub use extern_crate::WTrait; // @has foo/trait.Trait.html '//pre[@class="rust trait"]' \ // 'pub trait Trait' -// @has - '//*[@id="impl-Trait%3C1_usize%3E-for-u8"]//h3' 'impl Trait<1_usize> for u8' -// @has - '//*[@id="impl-Trait%3C2_usize%3E-for-u8"]//h3' 'impl Trait<2_usize> for u8' -// @has - '//*[@id="impl-Trait%3C{1%20+%202}%3E-for-u8"]//h3' 'impl Trait<{1 + 2}> for u8' -// @has - '//*[@id="impl-Trait%3CN%3E-for-%5Bu8%3B%20N%5D"]//h3' \ +// @has - '//*[@id="impl-Trait%3C1_usize%3E-for-u8"]//h3[@class="code-header in-band"]' 'impl Trait<1_usize> for u8' +// @has - '//*[@id="impl-Trait%3C2_usize%3E-for-u8"]//h3[@class="code-header in-band"]' 'impl Trait<2_usize> for u8' +// @has - '//*[@id="impl-Trait%3C{1%20+%202}%3E-for-u8"]//h3[@class="code-header in-band"]' 'impl Trait<{1 + 2}> for u8' +// @has - '//*[@id="impl-Trait%3CN%3E-for-%5Bu8%3B%20N%5D"]//h3[@class="code-header in-band"]' \ // 'impl Trait for [u8; N]' pub trait Trait {} impl Trait<1> for u8 {} @@ -36,7 +36,7 @@ pub struct Foo where u8: Trait; // @has foo/struct.Bar.html '//pre[@class="rust struct"]' 'pub struct Bar(_)' pub struct Bar([T; N]); -// @has foo/struct.Foo.html '//div[@id="impl"]/h3' 'impl Foo where u8: Trait' +// @has foo/struct.Foo.html '//div[@id="impl"]/h3[@class="code-header in-band"]' 'impl Foo where u8: Trait' impl Foo where u8: Trait { // @has - '//*[@id="associatedconstant.FOO_ASSOC"]' 'pub const FOO_ASSOC: usize' pub const FOO_ASSOC: usize = M + 13; @@ -47,7 +47,7 @@ impl Foo where u8: Trait { } } -// @has foo/struct.Bar.html '//div[@id="impl"]/h3' 'impl Bar' +// @has foo/struct.Bar.html '//div[@id="impl"]/h3[@class="code-header in-band"]' 'impl Bar' impl Bar { // @has - '//*[@id="method.hey"]' \ // 'pub fn hey(&self) -> Foo where u8: Trait' diff --git a/src/test/rustdoc/const-generics/const-impl.rs b/src/test/rustdoc/const-generics/const-impl.rs index 9d96936b22ff7..7ddcb3a29f28b 100644 --- a/src/test/rustdoc/const-generics/const-impl.rs +++ b/src/test/rustdoc/const-generics/const-impl.rs @@ -9,20 +9,20 @@ pub enum Order { } // @has foo/struct.VSet.html '//pre[@class="rust struct"]' 'pub struct VSet' -// @has foo/struct.VSet.html '//div[@id="impl-Send"]/h3' 'impl Send for VSet' -// @has foo/struct.VSet.html '//div[@id="impl-Sync"]/h3' 'impl Sync for VSet' +// @has foo/struct.VSet.html '//div[@id="impl-Send"]/h3[@class="code-header in-band"]' 'impl Send for VSet' +// @has foo/struct.VSet.html '//div[@id="impl-Sync"]/h3[@class="code-header in-band"]' 'impl Sync for VSet' pub struct VSet { inner: Vec, } -// @has foo/struct.VSet.html '//div[@id="impl"]/h3' 'impl VSet' +// @has foo/struct.VSet.html '//div[@id="impl"]/h3[@class="code-header in-band"]' 'impl VSet' impl VSet { pub fn new() -> Self { Self { inner: Vec::new() } } } -// @has foo/struct.VSet.html '//div[@id="impl-1"]/h3' 'impl VSet' +// @has foo/struct.VSet.html '//div[@id="impl-1"]/h3[@class="code-header in-band"]' 'impl VSet' impl VSet { pub fn new() -> Self { Self { inner: Vec::new() } @@ -31,7 +31,7 @@ impl VSet { pub struct Escape; -// @has foo/struct.Escape.html '//div[@id="impl"]/h3' 'impl Escape<{ r#""# }>' +// @has foo/struct.Escape.html '//div[@id="impl"]/h3[@class="code-header in-band"]' 'impl Escape<{ r#""# }>' impl Escape<{ r#""# }> { pub fn f() {} } diff --git a/src/test/rustdoc/const-generics/lazy_normalization_consts/const-equate-pred.rs b/src/test/rustdoc/const-generics/lazy_normalization_consts/const-equate-pred.rs index 8a5b3275625a8..f4c5dcc72259d 100644 --- a/src/test/rustdoc/const-generics/lazy_normalization_consts/const-equate-pred.rs +++ b/src/test/rustdoc/const-generics/lazy_normalization_consts/const-equate-pred.rs @@ -12,7 +12,7 @@ pub struct Hasher { unsafe impl Send for Hasher {} // @has foo/struct.Foo.html -// @has - '//h3' 'impl Send for Foo' +// @has - '//h3[@class="code-header in-band"]' 'impl Send for Foo' pub struct Foo { hasher: Hasher<[u8; 3]>, } diff --git a/src/test/rustdoc/const.rs b/src/test/rustdoc/const.rs index d1658dac693d6..587ad4db47829 100644 --- a/src/test/rustdoc/const.rs +++ b/src/test/rustdoc/const.rs @@ -3,7 +3,7 @@ pub struct Foo; impl Foo { - // @has const/struct.Foo.html '//*[@id="method.new"]//h4' 'const unsafe fn new' + // @has const/struct.Foo.html '//*[@id="method.new"]//h4[@class="code-header"]' 'const unsafe fn new' pub const unsafe fn new() -> Foo { Foo } diff --git a/src/test/rustdoc/duplicate_impls/issue-33054.rs b/src/test/rustdoc/duplicate_impls/issue-33054.rs index 6bf8f7cdaddf2..7ace13fe3a6b5 100644 --- a/src/test/rustdoc/duplicate_impls/issue-33054.rs +++ b/src/test/rustdoc/duplicate_impls/issue-33054.rs @@ -1,10 +1,10 @@ // @has issue_33054/impls/struct.Foo.html -// @has - '//h3' 'impl Foo' -// @has - '//h3' 'impl Bar for Foo' +// @has - '//h3[@class="code-header in-band"]' 'impl Foo' +// @has - '//h3[@class="code-header in-band"]' 'impl Bar for Foo' // @count - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]' 1 // @count - '//*[@id="main"]/details/summary/*[@class="impl has-srclink"]' 1 // @has issue_33054/impls/bar/trait.Bar.html -// @has - '//h3' 'impl Bar for Foo' +// @has - '//h3[@class="code-header in-band"]' 'impl Bar for Foo' // @count - '//*[@class="struct"]' 1 pub mod impls; diff --git a/src/test/rustdoc/extern-impl-trait.rs b/src/test/rustdoc/extern-impl-trait.rs index 677f77d0a51bf..8ab026afd1b8d 100644 --- a/src/test/rustdoc/extern-impl-trait.rs +++ b/src/test/rustdoc/extern-impl-trait.rs @@ -4,8 +4,8 @@ extern crate extern_impl_trait; -// @has 'foo/struct.X.html' '//h4' "impl Foo + 'a" +// @has 'foo/struct.X.html' '//h4[@class="code-header"]' "impl Foo + 'a" pub use extern_impl_trait::X; -// @has 'foo/struct.Y.html' '//h4' "impl ?Sized + Foo + 'a" +// @has 'foo/struct.Y.html' '//h4[@class="code-header"]' "impl ?Sized + Foo + 'a" pub use extern_impl_trait::Y; diff --git a/src/test/rustdoc/extern-impl.rs b/src/test/rustdoc/extern-impl.rs index 8a210a2d6a5db..f357d65df94be 100644 --- a/src/test/rustdoc/extern-impl.rs +++ b/src/test/rustdoc/extern-impl.rs @@ -4,24 +4,24 @@ pub struct Foo; impl Foo { - // @has - '//h4' 'fn rust0()' + // @has - '//h4[@class="code-header"]' 'fn rust0()' pub fn rust0() {} - // @has - '//h4' 'fn rust1()' + // @has - '//h4[@class="code-header"]' 'fn rust1()' pub extern "Rust" fn rust1() {} - // @has - '//h4' 'extern "C" fn c0()' + // @has - '//h4[@class="code-header"]' 'extern "C" fn c0()' pub extern fn c0() {} - // @has - '//h4' 'extern "C" fn c1()' + // @has - '//h4[@class="code-header"]' 'extern "C" fn c1()' pub extern "C" fn c1() {} - // @has - '//h4' 'extern "system" fn system0()' + // @has - '//h4[@class="code-header"]' 'extern "system" fn system0()' pub extern "system" fn system0() {} } // @has foo/trait.Bar.html pub trait Bar {} -// @has - '//h3' 'impl Bar for fn()' +// @has - '//h3[@class="code-header in-band"]' 'impl Bar for fn()' impl Bar for fn() {} -// @has - '//h3' 'impl Bar for extern "C" fn()' +// @has - '//h3[@class="code-header in-band"]' 'impl Bar for extern "C" fn()' impl Bar for extern fn() {} -// @has - '//h3' 'impl Bar for extern "system" fn()' +// @has - '//h3[@class="code-header in-band"]' 'impl Bar for extern "system" fn()' impl Bar for extern "system" fn() {} diff --git a/src/test/rustdoc/extern-method.rs b/src/test/rustdoc/extern-method.rs index 16529b1d4d707..9cf5fc190af0f 100644 --- a/src/test/rustdoc/extern-method.rs +++ b/src/test/rustdoc/extern-method.rs @@ -6,14 +6,14 @@ extern crate rustdoc_extern_method as foo; // @has extern_method/trait.Foo.html //pre "pub trait Foo" -// @has - '//*[@id="tymethod.foo"]//h4' 'extern "rust-call" fn foo' -// @has - '//*[@id="method.foo_"]//h4' 'extern "rust-call" fn foo_' +// @has - '//*[@id="tymethod.foo"]//h4[@class="code-header"]' 'extern "rust-call" fn foo' +// @has - '//*[@id="method.foo_"]//h4[@class="code-header"]' 'extern "rust-call" fn foo_' pub use foo::Foo; // @has extern_method/trait.Bar.html //pre "pub trait Bar" pub trait Bar { - // @has - '//*[@id="tymethod.bar"]//h4' 'extern "rust-call" fn bar' + // @has - '//*[@id="tymethod.bar"]//h4[@class="code-header"]' 'extern "rust-call" fn bar' extern "rust-call" fn bar(&self, _: ()); - // @has - '//*[@id="method.bar_"]//h4' 'extern "rust-call" fn bar_' + // @has - '//*[@id="method.bar_"]//h4[@class="code-header"]' 'extern "rust-call" fn bar_' extern "rust-call" fn bar_(&self, _: ()) { } } diff --git a/src/test/rustdoc/generic-impl.rs b/src/test/rustdoc/generic-impl.rs index 043a7a3265488..906316d2ebcc0 100644 --- a/src/test/rustdoc/generic-impl.rs +++ b/src/test/rustdoc/generic-impl.rs @@ -2,10 +2,10 @@ use std::fmt; -// @!has foo/struct.Bar.html '//div[@id="impl-ToString"]//h3' 'impl ToString for T' +// @!has foo/struct.Bar.html '//div[@id="impl-ToString"]//h3[@class="code-header in-band"]' 'impl ToString for T' pub struct Bar; -// @has foo/struct.Foo.html '//div[@id="impl-ToString"]//h3' 'impl ToString for T' +// @has foo/struct.Foo.html '//div[@id="impl-ToString"]//h3[@class="code-header in-band"]' 'impl ToString for T' pub struct Foo; // @has foo/struct.Foo.html '//div[@class="sidebar-links"]/a[@href="#impl-ToString"]' 'ToString' diff --git a/src/test/rustdoc/higher-ranked-trait-bounds.rs b/src/test/rustdoc/higher-ranked-trait-bounds.rs index 9df0799ebf694..b75b8de52f9cb 100644 --- a/src/test/rustdoc/higher-ranked-trait-bounds.rs +++ b/src/test/rustdoc/higher-ranked-trait-bounds.rs @@ -38,7 +38,7 @@ pub struct Foo<'a> { // @has - '//span[@id="structfield.some_trait"]' "some_trait: &'a dyn for<'b> Trait<'b>" impl<'a> Foo<'a> { - // @has - '//h4' "pub fn bar() where T: Trait<'a>," + // @has - '//h4[@class="code-header"]' "pub fn bar() where T: Trait<'a>," pub fn bar() where T: Trait<'a>, diff --git a/src/test/rustdoc/impl-disambiguation.rs b/src/test/rustdoc/impl-disambiguation.rs index 2bf445a5037be..d1d39ccff328f 100644 --- a/src/test/rustdoc/impl-disambiguation.rs +++ b/src/test/rustdoc/impl-disambiguation.rs @@ -4,13 +4,13 @@ pub trait Foo {} pub struct Bar { field: T } -// @has foo/trait.Foo.html '//*[@class="item-list"]//h3' \ +// @has foo/trait.Foo.html '//*[@class="item-list"]//h3[@class="code-header in-band"]' \ // "impl Foo for Bar" impl Foo for Bar {} -// @has foo/trait.Foo.html '//*[@class="item-list"]//h3' \ +// @has foo/trait.Foo.html '//*[@class="item-list"]//h3[@class="code-header in-band"]' \ // "impl Foo for Bar" impl Foo for Bar {} -// @has foo/trait.Foo.html '//*[@class="item-list"]//h3' \ +// @has foo/trait.Foo.html '//*[@class="item-list"]//h3[@class="code-header in-band"]' \ // "impl<'a> Foo for &'a Bar" impl<'a> Foo for &'a Bar {} @@ -22,9 +22,9 @@ pub mod mod2 { pub enum Baz {} } -// @has foo/trait.Foo.html '//*[@class="item-list"]//h3' \ +// @has foo/trait.Foo.html '//*[@class="item-list"]//h3[@class="code-header in-band"]' \ // "impl Foo for foo::mod1::Baz" impl Foo for mod1::Baz {} -// @has foo/trait.Foo.html '//*[@class="item-list"]//h3' \ +// @has foo/trait.Foo.html '//*[@class="item-list"]//h3[@class="code-header in-band"]' \ // "impl<'a> Foo for &'a foo::mod2::Baz" impl<'a> Foo for &'a mod2::Baz {} diff --git a/src/test/rustdoc/impl-parts.rs b/src/test/rustdoc/impl-parts.rs index 779b5eae705b4..249158c1a1f89 100644 --- a/src/test/rustdoc/impl-parts.rs +++ b/src/test/rustdoc/impl-parts.rs @@ -5,8 +5,8 @@ pub auto trait AnAutoTrait {} pub struct Foo { field: T } -// @has impl_parts/struct.Foo.html '//*[@class="impl has-srclink"]//h3' \ +// @has impl_parts/struct.Foo.html '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl !AnAutoTrait for Foo where T: Sync," -// @has impl_parts/trait.AnAutoTrait.html '//*[@class="item-list"]//h3' \ +// @has impl_parts/trait.AnAutoTrait.html '//*[@class="item-list"]//h3[@class="code-header in-band"]' \ // "impl !AnAutoTrait for Foo where T: Sync," impl !AnAutoTrait for Foo where T: Sync {} diff --git a/src/test/rustdoc/inline_cross/impl_trait.rs b/src/test/rustdoc/inline_cross/impl_trait.rs index dc3d2d1dbe2dd..ef615472b0e98 100644 --- a/src/test/rustdoc/inline_cross/impl_trait.rs +++ b/src/test/rustdoc/inline_cross/impl_trait.rs @@ -31,8 +31,8 @@ pub use impl_trait_aux::func4; pub use impl_trait_aux::async_fn; // @has impl_trait/struct.Foo.html -// @has - '//*[@id="method.method"]//h4' "pub fn method<'a>(_x: impl Clone + Into> + 'a)" -// @!has - '//*[@id="method.method"]//h4' 'where' +// @has - '//*[@id="method.method"]//h4[@class="code-header"]' "pub fn method<'a>(_x: impl Clone + Into> + 'a)" +// @!has - '//*[@id="method.method"]//h4[@class="code-header"]' 'where' pub use impl_trait_aux::Foo; // @has impl_trait/struct.Bar.html diff --git a/src/test/rustdoc/inline_cross/issue-31948-1.rs b/src/test/rustdoc/inline_cross/issue-31948-1.rs index 11fae9a08f2de..be8585dd16e17 100644 --- a/src/test/rustdoc/inline_cross/issue-31948-1.rs +++ b/src/test/rustdoc/inline_cross/issue-31948-1.rs @@ -5,22 +5,22 @@ extern crate rustdoc_nonreachable_impls; // @has issue_31948_1/struct.Wobble.html -// @has - '//*[@class="impl has-srclink"]//h3' 'Bark for' -// @has - '//*[@class="impl has-srclink"]//h3' 'Woof for' -// @!has - '//*[@class="impl"]//h3' 'Bar for' -// @!has - '//*[@class="impl"]//h3' 'Qux for' +// @has - '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' 'Bark for' +// @has - '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' 'Woof for' +// @!has - '//*[@class="impl"]//h3[@class="code-header in-band"]' 'Bar for' +// @!has - '//*[@class="impl"]//h3[@class="code-header in-band"]' 'Qux for' pub use rustdoc_nonreachable_impls::hidden::Wobble; // @has issue_31948_1/trait.Bark.html -// @has - '//h3' 'for Foo' -// @has - '//h3' 'for Wobble' -// @!has - '//h3' 'for Wibble' +// @has - '//h3[@class="code-header in-band"]' 'for Foo' +// @has - '//h3[@class="code-header in-band"]' 'for Wobble' +// @!has - '//h3[@class="code-header in-band"]' 'for Wibble' pub use rustdoc_nonreachable_impls::Bark; // @has issue_31948_1/trait.Woof.html -// @has - '//h3' 'for Foo' -// @has - '//h3' 'for Wobble' -// @!has - '//h3' 'for Wibble' +// @has - '//h3[@class="code-header in-band"]' 'for Foo' +// @has - '//h3[@class="code-header in-band"]' 'for Wobble' +// @!has - '//h3[@class="code-header in-band"]' 'for Wibble' pub use rustdoc_nonreachable_impls::Woof; // @!has issue_31948_1/trait.Bar.html diff --git a/src/test/rustdoc/inline_cross/issue-31948-2.rs b/src/test/rustdoc/inline_cross/issue-31948-2.rs index e7e718a8f8974..7aa994f19d6f1 100644 --- a/src/test/rustdoc/inline_cross/issue-31948-2.rs +++ b/src/test/rustdoc/inline_cross/issue-31948-2.rs @@ -5,15 +5,15 @@ extern crate rustdoc_nonreachable_impls; // @has issue_31948_2/struct.Wobble.html -// @has - '//*[@class="impl has-srclink"]//h3' 'Qux for' -// @has - '//*[@class="impl has-srclink"]//h3' 'Bark for' -// @has - '//*[@class="impl has-srclink"]//h3' 'Woof for' -// @!has - '//*[@class="impl"]//h3' 'Bar for' +// @has - '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' 'Qux for' +// @has - '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' 'Bark for' +// @has - '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' 'Woof for' +// @!has - '//*[@class="impl"]//h3[@class="code-header in-band"]' 'Bar for' pub use rustdoc_nonreachable_impls::hidden::Wobble; // @has issue_31948_2/trait.Qux.html -// @has - '//h3' 'for Foo' -// @has - '//h3' 'for Wobble' +// @has - '//h3[@class="code-header in-band"]' 'for Foo' +// @has - '//h3[@class="code-header in-band"]' 'for Wobble' pub use rustdoc_nonreachable_impls::hidden::Qux; // @!has issue_31948_2/trait.Bar.html diff --git a/src/test/rustdoc/inline_cross/issue-31948.rs b/src/test/rustdoc/inline_cross/issue-31948.rs index 1e8375b24e90b..7bf4110d32ac1 100644 --- a/src/test/rustdoc/inline_cross/issue-31948.rs +++ b/src/test/rustdoc/inline_cross/issue-31948.rs @@ -5,22 +5,22 @@ extern crate rustdoc_nonreachable_impls; // @has issue_31948/struct.Foo.html -// @has - '//*[@class="impl has-srclink"]//h3' 'Bark for' -// @has - '//*[@class="impl has-srclink"]//h3' 'Woof for' -// @!has - '//*[@class="impl has-srclink"]//h3' 'Bar for' -// @!has - '//*[@class="impl"]//h3' 'Qux for' +// @has - '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' 'Bark for' +// @has - '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' 'Woof for' +// @!has - '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' 'Bar for' +// @!has - '//*[@class="impl"]//h3[@class="code-header in-band"]' 'Qux for' pub use rustdoc_nonreachable_impls::Foo; // @has issue_31948/trait.Bark.html -// @has - '//h3' 'for Foo' -// @!has - '//h3' 'for Wibble' -// @!has - '//h3' 'for Wobble' +// @has - '//h3[@class="code-header in-band"]' 'for Foo' +// @!has - '//h3[@class="code-header in-band"]' 'for Wibble' +// @!has - '//h3[@class="code-header in-band"]' 'for Wobble' pub use rustdoc_nonreachable_impls::Bark; // @has issue_31948/trait.Woof.html -// @has - '//h3' 'for Foo' -// @!has - '//h3' 'for Wibble' -// @!has - '//h3' 'for Wobble' +// @has - '//h3[@class="code-header in-band"]' 'for Foo' +// @!has - '//h3[@class="code-header in-band"]' 'for Wibble' +// @!has - '//h3[@class="code-header in-band"]' 'for Wobble' pub use rustdoc_nonreachable_impls::Woof; // @!has issue_31948/trait.Bar.html diff --git a/src/test/rustdoc/inline_cross/issue-32881.rs b/src/test/rustdoc/inline_cross/issue-32881.rs index aebfb01446ee0..8052339a83b6d 100644 --- a/src/test/rustdoc/inline_cross/issue-32881.rs +++ b/src/test/rustdoc/inline_cross/issue-32881.rs @@ -5,7 +5,7 @@ extern crate rustdoc_trait_object_impl; // @has issue_32881/trait.Bar.html -// @has - '//h3' "impl<'a> dyn Bar" -// @has - '//h3' "impl<'a> Debug for dyn Bar" +// @has - '//h3[@class="code-header in-band"]' "impl<'a> dyn Bar" +// @has - '//h3[@class="code-header in-band"]' "impl<'a> Debug for dyn Bar" pub use rustdoc_trait_object_impl::Bar; diff --git a/src/test/rustdoc/inline_cross/issue-33113.rs b/src/test/rustdoc/inline_cross/issue-33113.rs index 2e19e89ff31ff..c60859bbcea98 100644 --- a/src/test/rustdoc/inline_cross/issue-33113.rs +++ b/src/test/rustdoc/inline_cross/issue-33113.rs @@ -5,6 +5,6 @@ extern crate bar; // @has issue_33113/trait.Bar.html -// @has - '//h3' "for &'a char" -// @has - '//h3' "for Foo" +// @has - '//h3[@class="code-header in-band"]' "for &'a char" +// @has - '//h3[@class="code-header in-band"]' "for Foo" pub use bar::Bar; diff --git a/src/test/rustdoc/inline_cross/trait-vis.rs b/src/test/rustdoc/inline_cross/trait-vis.rs index beb30c8e0ddf5..363c52a336e42 100644 --- a/src/test/rustdoc/inline_cross/trait-vis.rs +++ b/src/test/rustdoc/inline_cross/trait-vis.rs @@ -3,5 +3,5 @@ extern crate inner; // @has trait_vis/struct.SomeStruct.html -// @has - '//h3' 'impl Clone for SomeStruct' +// @has - '//h3[@class="code-header in-band"]' 'impl Clone for SomeStruct' pub use inner::SomeStruct; diff --git a/src/test/rustdoc/inline_local/trait-vis.rs b/src/test/rustdoc/inline_local/trait-vis.rs index 44af1786899b6..e7b08088f4032 100644 --- a/src/test/rustdoc/inline_local/trait-vis.rs +++ b/src/test/rustdoc/inline_local/trait-vis.rs @@ -13,6 +13,6 @@ mod asdf { } // @has trait_vis/struct.SomeStruct.html -// @has - '//h3' 'impl ThisTrait for SomeStruct' -// @!has - '//h3' 'impl PrivateTrait for SomeStruct' +// @has - '//h3[@class="code-header in-band"]' 'impl ThisTrait for SomeStruct' +// @!has - '//h3[@class="code-header in-band"]' 'impl PrivateTrait for SomeStruct' pub use asdf::SomeStruct; diff --git a/src/test/rustdoc/issue-19190.rs b/src/test/rustdoc/issue-19190.rs index 38684830122e7..2046273e2c1ba 100644 --- a/src/test/rustdoc/issue-19190.rs +++ b/src/test/rustdoc/issue-19190.rs @@ -14,7 +14,7 @@ impl Deref for Bar { } // @has issue_19190/struct.Bar.html -// @has - '//*[@id="method.foo"]//h4' 'fn foo(&self)' +// @has - '//*[@id="method.foo"]//h4[@class="code-header"]' 'fn foo(&self)' // @has - '//*[@id="method.foo"]' 'fn foo(&self)' -// @!has - '//*[@id="method.static_foo"]//h4' 'fn static_foo()' +// @!has - '//*[@id="method.static_foo"]//h4[@class="code-header"]' 'fn static_foo()' // @!has - '//*[@id="method.static_foo"]' 'fn static_foo()' diff --git a/src/test/rustdoc/issue-25001.rs b/src/test/rustdoc/issue-25001.rs index bcb10fb8a4c91..c97b35adaf22e 100644 --- a/src/test/rustdoc/issue-25001.rs +++ b/src/test/rustdoc/issue-25001.rs @@ -8,36 +8,36 @@ pub trait Bar { } impl Foo { - // @has - '//*[@id="method.pass"]//h4' 'fn pass()' + // @has - '//*[@id="method.pass"]//h4[@class="code-header"]' 'fn pass()' pub fn pass() {} } impl Foo { - // @has - '//*[@id="method.pass-1"]//h4' 'fn pass() -> usize' + // @has - '//*[@id="method.pass-1"]//h4[@class="code-header"]' 'fn pass() -> usize' pub fn pass() -> usize { 42 } } impl Foo { - // @has - '//*[@id="method.pass-2"]//h4' 'fn pass() -> isize' + // @has - '//*[@id="method.pass-2"]//h4[@class="code-header"]' 'fn pass() -> isize' pub fn pass() -> isize { 42 } } impl Bar for Foo { - // @has - '//*[@id="associatedtype.Item"]//h4' 'type Item = T' + // @has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' 'type Item = T' type Item=T; - // @has - '//*[@id="method.quux"]//h4' 'fn quux(self)' + // @has - '//*[@id="method.quux"]//h4[@class="code-header"]' 'fn quux(self)' fn quux(self) {} } impl<'a, T> Bar for &'a Foo { - // @has - '//*[@id="associatedtype.Item-1"]//h4' "type Item = &'a T" + // @has - '//*[@id="associatedtype.Item-1"]//h4[@class="code-header"]' "type Item = &'a T" type Item=&'a T; - // @has - '//*[@id="method.quux-1"]//h4' 'fn quux(self)' + // @has - '//*[@id="method.quux-1"]//h4[@class="code-header"]' 'fn quux(self)' fn quux(self) {} } impl<'a, T> Bar for &'a mut Foo { - // @has - '//*[@id="associatedtype.Item-2"]//h4' "type Item = &'a mut T" + // @has - '//*[@id="associatedtype.Item-2"]//h4[@class="code-header"]' "type Item = &'a mut T" type Item=&'a mut T; - // @has - '//*[@id="method.quux-2"]//h4' 'fn quux(self)' + // @has - '//*[@id="method.quux-2"]//h4[@class="code-header"]' 'fn quux(self)' fn quux(self) {} } diff --git a/src/test/rustdoc/issue-27362.rs b/src/test/rustdoc/issue-27362.rs index c3f1289114760..097e4e3b03d9d 100644 --- a/src/test/rustdoc/issue-27362.rs +++ b/src/test/rustdoc/issue-27362.rs @@ -7,4 +7,4 @@ pub use issue_27362_aux::*; // @matches issue_27362/fn.foo.html '//pre' "pub const fn foo()" // @matches issue_27362/fn.bar.html '//pre' "pub const unsafe fn bar()" -// @matches issue_27362/struct.Foo.html '//h4' "const unsafe fn baz()" +// @matches issue_27362/struct.Foo.html '//h4[@class="code-header"]' "const unsafe fn baz()" diff --git a/src/test/rustdoc/issue-29503.rs b/src/test/rustdoc/issue-29503.rs index 4041ec770f7dd..90a2b76eab67b 100644 --- a/src/test/rustdoc/issue-29503.rs +++ b/src/test/rustdoc/issue-29503.rs @@ -5,7 +5,7 @@ pub trait MyTrait { fn my_string(&self) -> String; } -// @has - "//div[@id='implementors-list']//div[@id='impl-MyTrait']//h3" "impl MyTrait for T where T: Debug" +// @has - "//div[@id='implementors-list']//div[@id='impl-MyTrait']//h3[@class='code-header in-band']" "impl MyTrait for T where T: Debug" impl MyTrait for T where T: fmt::Debug { fn my_string(&self) -> String { format!("{:?}", self) diff --git a/src/test/rustdoc/issue-33592.rs b/src/test/rustdoc/issue-33592.rs index 4f41ebc19bb9e..815439db9bfd2 100644 --- a/src/test/rustdoc/issue-33592.rs +++ b/src/test/rustdoc/issue-33592.rs @@ -6,8 +6,8 @@ pub struct Bar; pub struct Baz; -// @has foo/trait.Foo.html '//h3' 'impl Foo for Bar' +// @has foo/trait.Foo.html '//h3[@class="code-header in-band"]' 'impl Foo for Bar' impl Foo for Bar {} -// @has foo/trait.Foo.html '//h3' 'impl Foo for Baz' +// @has foo/trait.Foo.html '//h3[@class="code-header in-band"]' 'impl Foo for Baz' impl Foo for Baz {} diff --git a/src/test/rustdoc/issue-35169-2.rs b/src/test/rustdoc/issue-35169-2.rs index 3fa6aceee8371..f08466baf8b05 100644 --- a/src/test/rustdoc/issue-35169-2.rs +++ b/src/test/rustdoc/issue-35169-2.rs @@ -24,17 +24,17 @@ impl DerefMut for Bar { } // @has issue_35169_2/struct.Bar.html -// @has - '//*[@id="method.by_ref"]//h4' 'fn by_ref(&self)' +// @has - '//*[@id="method.by_ref"]//h4[@class="code-header"]' 'fn by_ref(&self)' // @has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)' -// @has - '//*[@id="method.by_explicit_ref"]//h4' 'fn by_explicit_ref(self: &Foo)' +// @has - '//*[@id="method.by_explicit_ref"]//h4[@class="code-header"]' 'fn by_explicit_ref(self: &Foo)' // @has - '//*[@id="method.by_explicit_ref"]' 'fn by_explicit_ref(self: &Foo)' -// @has - '//*[@id="method.by_mut_ref"]//h4' 'fn by_mut_ref(&mut self)' +// @has - '//*[@id="method.by_mut_ref"]//h4[@class="code-header"]' 'fn by_mut_ref(&mut self)' // @has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)' -// @has - '//*[@id="method.by_explicit_mut_ref"]//h4' 'fn by_explicit_mut_ref(self: &mut Foo)' +// @has - '//*[@id="method.by_explicit_mut_ref"]//h4[@class="code-header"]' 'fn by_explicit_mut_ref(self: &mut Foo)' // @has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)' -// @!has - '//*[@id="method.by_explicit_box"]//h4' 'fn by_explicit_box(self: Box)' +// @!has - '//*[@id="method.by_explicit_box"]//h4[@class="code-header"]' 'fn by_explicit_box(self: Box)' // @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box)' -// @!has - '//*[@id="method.by_explicit_self_box"]//h4' 'fn by_explicit_self_box(self: Box)' +// @!has - '//*[@id="method.by_explicit_self_box"]//h4[@class="code-header"]' 'fn by_explicit_self_box(self: Box)' // @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box)' -// @!has - '//*[@id="method.static_foo"]//h4' 'fn static_foo()' +// @!has - '//*[@id="method.static_foo"]//h4[@class="code-header"]' 'fn static_foo()' // @!has - '//*[@id="method.static_foo"]' 'fn static_foo()' diff --git a/src/test/rustdoc/issue-35169.rs b/src/test/rustdoc/issue-35169.rs index cde803431755a..70a2265c80632 100644 --- a/src/test/rustdoc/issue-35169.rs +++ b/src/test/rustdoc/issue-35169.rs @@ -19,17 +19,17 @@ impl Deref for Bar { } // @has issue_35169/struct.Bar.html -// @has - '//*[@id="method.by_ref"]//h4' 'fn by_ref(&self)' +// @has - '//*[@id="method.by_ref"]//h4[@class="code-header"]' 'fn by_ref(&self)' // @has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)' -// @has - '//*[@id="method.by_explicit_ref"]//h4' 'fn by_explicit_ref(self: &Foo)' +// @has - '//*[@id="method.by_explicit_ref"]//h4[@class="code-header"]' 'fn by_explicit_ref(self: &Foo)' // @has - '//*[@id="method.by_explicit_ref"]' 'fn by_explicit_ref(self: &Foo)' -// @!has - '//*[@id="method.by_mut_ref"]//h4' 'fn by_mut_ref(&mut self)' +// @!has - '//*[@id="method.by_mut_ref"]//h4[@class="code-header"]' 'fn by_mut_ref(&mut self)' // @!has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)' -// @!has - '//*[@id="method.by_explicit_mut_ref"]//h4' 'fn by_explicit_mut_ref(self: &mut Foo)' +// @!has - '//*[@id="method.by_explicit_mut_ref"]//h4[@class="code-header"]' 'fn by_explicit_mut_ref(self: &mut Foo)' // @!has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)' -// @!has - '//*[@id="method.by_explicit_box"]//h4' 'fn by_explicit_box(self: Box)' +// @!has - '//*[@id="method.by_explicit_box"]//h4[@class="code-header"]' 'fn by_explicit_box(self: Box)' // @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box)' -// @!has - '//*[@id="method.by_explicit_self_box"]//h4' 'fn by_explicit_self_box(self: Box)' +// @!has - '//*[@id="method.by_explicit_self_box"]//h4[@class="code-header"]' 'fn by_explicit_self_box(self: Box)' // @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box)' -// @!has - '//*[@id="method.static_foo"]//h4' 'fn static_foo()' +// @!has - '//*[@id="method.static_foo"]//h4[@class="code-header"]' 'fn static_foo()' // @!has - '//*[@id="method.static_foo"]' 'fn static_foo()' diff --git a/src/test/rustdoc/issue-46727.rs b/src/test/rustdoc/issue-46727.rs index e3ab780363860..00e9127a34d20 100644 --- a/src/test/rustdoc/issue-46727.rs +++ b/src/test/rustdoc/issue-46727.rs @@ -3,5 +3,5 @@ extern crate issue_46727; // @has issue_46727/trait.Foo.html -// @has - '//h3' 'impl Foo for Bar<[T; 3]>' +// @has - '//h3[@class="code-header in-band"]' 'impl Foo for Bar<[T; 3]>' pub use issue_46727::{Foo, Bar}; diff --git a/src/test/rustdoc/issue-50159.rs b/src/test/rustdoc/issue-50159.rs index 6bd7019eee07d..d88c29217023a 100644 --- a/src/test/rustdoc/issue-50159.rs +++ b/src/test/rustdoc/issue-50159.rs @@ -11,8 +11,8 @@ impl Signal2 for B where B: Signal { } // @has issue_50159/struct.Switch.html -// @has - '//h3' 'impl Send for Switch where ::Item: Send' -// @has - '//h3' 'impl Sync for Switch where ::Item: Sync' +// @has - '//h3[@class="code-header in-band"]' 'impl Send for Switch where ::Item: Send' +// @has - '//h3[@class="code-header in-band"]' 'impl Sync for Switch where ::Item: Sync' // @count - '//*[@id="implementations-list"]//*[@class="impl"]' 0 // @count - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]' 5 pub struct Switch { diff --git a/src/test/rustdoc/issue-51236.rs b/src/test/rustdoc/issue-51236.rs index 1d5f558ade08e..ee11ccc681163 100644 --- a/src/test/rustdoc/issue-51236.rs +++ b/src/test/rustdoc/issue-51236.rs @@ -7,7 +7,7 @@ pub mod traits { } // @has issue_51236/struct.Owned.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl Send for Owned where >::Reader: Send" pub struct Owned where T: for<'a> ::traits::Owned<'a> { marker: PhantomData<>::Reader>, diff --git a/src/test/rustdoc/issue-54705.rs b/src/test/rustdoc/issue-54705.rs index 6c222445500a0..bedaf5c4ddc36 100644 --- a/src/test/rustdoc/issue-54705.rs +++ b/src/test/rustdoc/issue-54705.rs @@ -3,10 +3,10 @@ pub trait ScopeHandle<'scope> {} // @has issue_54705/struct.ScopeFutureContents.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl<'scope, S> Send for ScopeFutureContents<'scope, S> where S: Sync" // -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl<'scope, S> Sync for ScopeFutureContents<'scope, S> where S: Sync" pub struct ScopeFutureContents<'scope, S> where S: ScopeHandle<'scope>, diff --git a/src/test/rustdoc/issue-55321.rs b/src/test/rustdoc/issue-55321.rs index 27b3699224915..ee2420d86d236 100644 --- a/src/test/rustdoc/issue-55321.rs +++ b/src/test/rustdoc/issue-55321.rs @@ -1,9 +1,9 @@ #![feature(negative_impls)] // @has issue_55321/struct.A.html -// @has - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl !Send for A" -// @has - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl !Sync for A" pub struct A(); @@ -11,8 +11,8 @@ impl !Send for A {} impl !Sync for A {} // @has issue_55321/struct.B.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl !Send for B" -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl !Sync for B" pub struct B(A, Box); diff --git a/src/test/rustdoc/issue-56822.rs b/src/test/rustdoc/issue-56822.rs index 6856c5bb0324e..aef6ddd8d23bc 100644 --- a/src/test/rustdoc/issue-56822.rs +++ b/src/test/rustdoc/issue-56822.rs @@ -17,7 +17,7 @@ impl<'a, T> MyTrait for Inner<'a, T> { } // @has issue_56822/struct.Parser.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl<'a> Send for Parser<'a>" pub struct Parser<'a> { field: > as MyTrait>::Output diff --git a/src/test/rustdoc/issue-60726.rs b/src/test/rustdoc/issue-60726.rs index a563a2df70dc3..167f0f039c15e 100644 --- a/src/test/rustdoc/issue-60726.rs +++ b/src/test/rustdoc/issue-60726.rs @@ -26,9 +26,9 @@ where {} // @has issue_60726/struct.IntoIter.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl !Send for IntoIter" -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl !Sync for IntoIter" pub struct IntoIter{ hello:DynTrait>, diff --git a/src/test/rustdoc/issue-75588.rs b/src/test/rustdoc/issue-75588.rs index c7f2c8da7d9f1..ac97b94fb351b 100644 --- a/src/test/rustdoc/issue-75588.rs +++ b/src/test/rustdoc/issue-75588.rs @@ -10,8 +10,8 @@ extern crate realcore; extern crate real_gimli; // issue #74672 -// @!has foo/trait.Deref.html '//*[@id="impl-Deref-for-EndianSlice"]//h3' 'impl Deref for EndianSlice' +// @!has foo/trait.Deref.html '//*[@id="impl-Deref-for-EndianSlice"]//h3[@class="code-header in-band"]' 'impl Deref for EndianSlice' pub use realcore::Deref; -// @has foo/trait.Join.html '//*[@id="impl-Join-for-Foo"]//h3' 'impl Join for Foo' +// @has foo/trait.Join.html '//*[@id="impl-Join-for-Foo"]//h3[@class="code-header in-band"]' 'impl Join for Foo' pub use realcore::Join; diff --git a/src/test/rustdoc/issue-80233-normalize-auto-trait.rs b/src/test/rustdoc/issue-80233-normalize-auto-trait.rs index aa35715318052..515e617b4f4ce 100644 --- a/src/test/rustdoc/issue-80233-normalize-auto-trait.rs +++ b/src/test/rustdoc/issue-80233-normalize-auto-trait.rs @@ -31,7 +31,7 @@ impl Trait3 for Vec { pub struct Struct1 {} // @has issue_80233_normalize_auto_trait/struct.Question.html -// @has - '//h3' 'impl Send for Question' +// @has - '//h3[@class="code-header in-band"]' 'impl Send for Question' pub struct Question { pub ins: < as Trait3>::Type3 as Trait2>::Type2, } diff --git a/src/test/rustdoc/issue-82465-asref-for-and-of-local.rs b/src/test/rustdoc/issue-82465-asref-for-and-of-local.rs index 13e9aed8920bd..8999e6a889bda 100644 --- a/src/test/rustdoc/issue-82465-asref-for-and-of-local.rs +++ b/src/test/rustdoc/issue-82465-asref-for-and-of-local.rs @@ -1,14 +1,14 @@ use std::convert::AsRef; pub struct Local; -// @has issue_82465_asref_for_and_of_local/struct.Local.html '//h3' 'impl AsRef for Local' +// @has issue_82465_asref_for_and_of_local/struct.Local.html '//h3[@class="code-header in-band"]' 'impl AsRef for Local' impl AsRef for Local { fn as_ref(&self) -> &str { todo!() } } -// @has - '//h3' 'impl AsRef for str' +// @has - '//h3[@class="code-header in-band"]' 'impl AsRef for str' impl AsRef for str { fn as_ref(&self) -> &Local { todo!() diff --git a/src/test/rustdoc/negative-impl.rs b/src/test/rustdoc/negative-impl.rs index f42fa35614c42..61a2398686230 100644 --- a/src/test/rustdoc/negative-impl.rs +++ b/src/test/rustdoc/negative-impl.rs @@ -5,10 +5,10 @@ pub struct Alpha; // @matches negative_impl/struct.Bravo.html '//pre' "pub struct Bravo" pub struct Bravo(B); -// @matches negative_impl/struct.Alpha.html '//*[@class="impl has-srclink"]//h3' \ +// @matches negative_impl/struct.Alpha.html '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl !Send for Alpha" impl !Send for Alpha {} -// @matches negative_impl/struct.Bravo.html '//*[@class="impl has-srclink"]//h3' "\ +// @matches negative_impl/struct.Bravo.html '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' "\ // impl !Send for Bravo" impl !Send for Bravo {} diff --git a/src/test/rustdoc/primitive-generic-impl.rs b/src/test/rustdoc/primitive-generic-impl.rs index 50a020ab71a12..0bf6157fed348 100644 --- a/src/test/rustdoc/primitive-generic-impl.rs +++ b/src/test/rustdoc/primitive-generic-impl.rs @@ -2,4 +2,4 @@ include!("primitive/primitive-generic-impl.rs"); -// @has foo/primitive.i32.html '//div[@id="impl-ToString"]//h3' 'impl ToString for T' +// @has foo/primitive.i32.html '//div[@id="impl-ToString"]//h3[@class="code-header in-band"]' 'impl ToString for T' diff --git a/src/test/rustdoc/sidebar-links-to-foreign-impl.rs b/src/test/rustdoc/sidebar-links-to-foreign-impl.rs index bccc772d0d0d5..d1083c487642d 100644 --- a/src/test/rustdoc/sidebar-links-to-foreign-impl.rs +++ b/src/test/rustdoc/sidebar-links-to-foreign-impl.rs @@ -6,9 +6,9 @@ // @has - '//*[@class="sidebar-title"]/a[@href="#foreign-impls"]' 'Implementations on Foreign Types' // @has - '//h2[@id="foreign-impls"]' 'Implementations on Foreign Types' // @has - '//*[@class="sidebar-links"]/a[@href="#impl-Foo-for-u32"]' 'u32' -// @has - '//div[@id="impl-Foo-for-u32"]//h3' 'impl Foo for u32' +// @has - '//div[@id="impl-Foo-for-u32"]//h3[@class="code-header in-band"]' 'impl Foo for u32' // @has - '//*[@class="sidebar-links"]/a[@href="#impl-Foo-for-%26%27a%20str"]' "&'a str" -// @has - '//div[@id="impl-Foo-for-%26%27a%20str"]//h3' "impl<'a> Foo for &'a str" +// @has - '//div[@id="impl-Foo-for-%26%27a%20str"]//h3[@class="code-header in-band"]' "impl<'a> Foo for &'a str" pub trait Foo {} impl Foo for u32 {} diff --git a/src/test/rustdoc/sized_trait.rs b/src/test/rustdoc/sized_trait.rs index bbfde91157cfd..ac4a4ad394c1b 100644 --- a/src/test/rustdoc/sized_trait.rs +++ b/src/test/rustdoc/sized_trait.rs @@ -11,7 +11,7 @@ pub struct Bar { pub struct Foo(T); // @has foo/struct.Unsized.html -// @has - '//div[@id="impl-Sized"]//h3' 'impl !Sized for Unsized' +// @has - '//div[@id="impl-Sized"]//h3[@class="code-header in-band"]' 'impl !Sized for Unsized' pub struct Unsized { data: [u8], } diff --git a/src/test/rustdoc/src-links-auto-impls.rs b/src/test/rustdoc/src-links-auto-impls.rs index 151aed861a6ac..f9ac836c9b18f 100644 --- a/src/test/rustdoc/src-links-auto-impls.rs +++ b/src/test/rustdoc/src-links-auto-impls.rs @@ -1,11 +1,11 @@ #![crate_name = "foo"] // @has foo/struct.Unsized.html -// @has - '//div[@id="impl-Sized"]/h3' 'impl !Sized for Unsized' +// @has - '//div[@id="impl-Sized"]/h3[@class="code-header in-band"]' 'impl !Sized for Unsized' // @!has - '//div[@id="impl-Sized"]//a[@class="srclink"]' '[src]' -// @has - '//div[@id="impl-Sync"]/h3' 'impl Sync for Unsized' +// @has - '//div[@id="impl-Sync"]/h3[@class="code-header in-band"]' 'impl Sync for Unsized' // @!has - '//div[@id="impl-Sync"]//a[@class="srclink"]' '[src]' -// @has - '//div[@id="impl-Any"]/h3' 'impl Any for T' +// @has - '//div[@id="impl-Any"]/h3[@class="code-header in-band"]' 'impl Any for T' // @has - '//div[@id="impl-Any"]//a[@class="srclink"]' '[src]' pub struct Unsized { data: [u8], diff --git a/src/test/rustdoc/synthetic_auto/basic.rs b/src/test/rustdoc/synthetic_auto/basic.rs index 3065898bdf0c9..54c54fdbf68a8 100644 --- a/src/test/rustdoc/synthetic_auto/basic.rs +++ b/src/test/rustdoc/synthetic_auto/basic.rs @@ -1,6 +1,6 @@ // @has basic/struct.Foo.html -// @has - '//h3' 'impl Send for Foo where T: Send' -// @has - '//h3' 'impl Sync for Foo where T: Sync' +// @has - '//h3[@class="code-header in-band"]' 'impl Send for Foo where T: Send' +// @has - '//h3[@class="code-header in-band"]' 'impl Sync for Foo where T: Sync' // @count - '//*[@id="implementations-list"]//*[@class="impl has-srclink"]' 0 // @count - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]' 5 pub struct Foo { diff --git a/src/test/rustdoc/synthetic_auto/complex.rs b/src/test/rustdoc/synthetic_auto/complex.rs index 16b0e2ae6a94a..f9017b90caee7 100644 --- a/src/test/rustdoc/synthetic_auto/complex.rs +++ b/src/test/rustdoc/synthetic_auto/complex.rs @@ -20,7 +20,7 @@ mod foo { } // @has complex/struct.NotOuter.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl<'a, T, K: ?Sized> Send for Outer<'a, T, K> where K: for<'b> Fn((&'b bool, &'a u8)) \ // -> &'b i8, T: MyTrait<'a>, >::MyItem: Copy, 'a: 'static" diff --git a/src/test/rustdoc/synthetic_auto/crate-local.rs b/src/test/rustdoc/synthetic_auto/crate-local.rs index 15cc12f63a20b..58b787dfafc7c 100644 --- a/src/test/rustdoc/synthetic_auto/crate-local.rs +++ b/src/test/rustdoc/synthetic_auto/crate-local.rs @@ -3,7 +3,7 @@ pub auto trait Banana {} // @has crate_local/struct.Peach.html -// @has - '//h3' 'impl Banana for Peach' -// @has - '//h3' 'impl Send for Peach' -// @has - '//h3' 'impl Sync for Peach' +// @has - '//h3[@class="code-header in-band"]' 'impl Banana for Peach' +// @has - '//h3[@class="code-header in-band"]' 'impl Send for Peach' +// @has - '//h3[@class="code-header in-band"]' 'impl Sync for Peach' pub struct Peach; diff --git a/src/test/rustdoc/synthetic_auto/lifetimes.rs b/src/test/rustdoc/synthetic_auto/lifetimes.rs index 00fd08d4e98e3..ee1393f9729c1 100644 --- a/src/test/rustdoc/synthetic_auto/lifetimes.rs +++ b/src/test/rustdoc/synthetic_auto/lifetimes.rs @@ -9,10 +9,10 @@ where {} // @has lifetimes/struct.Foo.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl<'c, K> Send for Foo<'c, K> where K: for<'b> Fn(&'b bool) -> &'c u8, 'c: 'static" // -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl<'c, K> Sync for Foo<'c, K> where K: Sync" pub struct Foo<'c, K: 'c> { inner_field: Inner<'c, K>, diff --git a/src/test/rustdoc/synthetic_auto/manual.rs b/src/test/rustdoc/synthetic_auto/manual.rs index 44740e4aababd..49bad162211b7 100644 --- a/src/test/rustdoc/synthetic_auto/manual.rs +++ b/src/test/rustdoc/synthetic_auto/manual.rs @@ -1,8 +1,8 @@ // @has manual/struct.Foo.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // 'impl Sync for Foo where T: Sync' // -// @has - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // 'impl Send for Foo' // // @count - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]' 1 diff --git a/src/test/rustdoc/synthetic_auto/negative.rs b/src/test/rustdoc/synthetic_auto/negative.rs index e85bb1eb08571..66e749ac38d96 100644 --- a/src/test/rustdoc/synthetic_auto/negative.rs +++ b/src/test/rustdoc/synthetic_auto/negative.rs @@ -3,10 +3,10 @@ pub struct Inner { } // @has negative/struct.Outer.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl !Send for Outer" // -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl !Sync for Outer" pub struct Outer { inner_field: Inner, diff --git a/src/test/rustdoc/synthetic_auto/nested.rs b/src/test/rustdoc/synthetic_auto/nested.rs index 556f4966d57d4..69edbee619e31 100644 --- a/src/test/rustdoc/synthetic_auto/nested.rs +++ b/src/test/rustdoc/synthetic_auto/nested.rs @@ -9,10 +9,10 @@ where } // @has nested/struct.Foo.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // 'impl Send for Foo where T: Copy' // -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // 'impl Sync for Foo where T: Sync' pub struct Foo { inner_field: Inner, diff --git a/src/test/rustdoc/synthetic_auto/no-redundancy.rs b/src/test/rustdoc/synthetic_auto/no-redundancy.rs index f66394c742198..f727c9a47f268 100644 --- a/src/test/rustdoc/synthetic_auto/no-redundancy.rs +++ b/src/test/rustdoc/synthetic_auto/no-redundancy.rs @@ -9,7 +9,7 @@ where } // @has no_redundancy/struct.Outer.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl Send for Outer where T: Copy + Send" pub struct Outer { inner_field: Inner, diff --git a/src/test/rustdoc/synthetic_auto/overflow.rs b/src/test/rustdoc/synthetic_auto/overflow.rs index d335d2f771fa6..c132ab6fb1b3e 100644 --- a/src/test/rustdoc/synthetic_auto/overflow.rs +++ b/src/test/rustdoc/synthetic_auto/overflow.rs @@ -21,7 +21,7 @@ enum TyData { struct VariableKind(I::InternedType); // @has overflow/struct.BoundVarsCollector.html -// @has - '//h3' "impl<'tcx> Send for BoundVarsCollector<'tcx>" +// @has - '//h3[@class="code-header in-band"]' "impl<'tcx> Send for BoundVarsCollector<'tcx>" pub struct BoundVarsCollector<'tcx> { val: VariableKind> } diff --git a/src/test/rustdoc/synthetic_auto/project.rs b/src/test/rustdoc/synthetic_auto/project.rs index a5cdf51c9ea35..8b020582563f3 100644 --- a/src/test/rustdoc/synthetic_auto/project.rs +++ b/src/test/rustdoc/synthetic_auto/project.rs @@ -23,10 +23,10 @@ where } // @has project/struct.Foo.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl<'c, K> Send for Foo<'c, K> where K: MyTrait, 'c: 'static" // -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl<'c, K> Sync for Foo<'c, K> where K: MyTrait, ::MyItem: OtherTrait, \ // 'c: 'static," pub struct Foo<'c, K: 'c> { diff --git a/src/test/rustdoc/synthetic_auto/self-referential.rs b/src/test/rustdoc/synthetic_auto/self-referential.rs index 84b83a65d9065..ccef901b18da3 100644 --- a/src/test/rustdoc/synthetic_auto/self-referential.rs +++ b/src/test/rustdoc/synthetic_auto/self-referential.rs @@ -23,7 +23,7 @@ impl Pattern for Wrapper { // @has self_referential/struct.WriteAndThen.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl Send for WriteAndThen where ::Value: Send" pub struct WriteAndThen(pub P1::Value,pub > as Pattern>::Value) where P1: Pattern; diff --git a/src/test/rustdoc/synthetic_auto/static-region.rs b/src/test/rustdoc/synthetic_auto/static-region.rs index 2a737bdb3c636..36e985144b0e0 100644 --- a/src/test/rustdoc/synthetic_auto/static-region.rs +++ b/src/test/rustdoc/synthetic_auto/static-region.rs @@ -3,7 +3,7 @@ pub trait OwnedTrait<'a> { } // @has static_region/struct.Owned.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl Send for Owned where >::Reader: Send" pub struct Owned where T: OwnedTrait<'static> { marker: >::Reader, diff --git a/src/test/rustdoc/toggle-method.rs b/src/test/rustdoc/toggle-method.rs index c59b6bb8df0b3..1aa74e5965960 100644 --- a/src/test/rustdoc/toggle-method.rs +++ b/src/test/rustdoc/toggle-method.rs @@ -4,9 +4,9 @@ // summary. Struct methods with no documentation should not be wrapped. // // @has foo/struct.Foo.html -// @has - '//details[@class="rustdoc-toggle method-toggle"]//summary//h4' 'is_documented()' +// @has - '//details[@class="rustdoc-toggle method-toggle"]//summary//h4[@class="code-header"]' 'is_documented()' // @has - '//details[@class="rustdoc-toggle method-toggle"]//*[@class="docblock"]' 'is_documented is documented' -// @!has - '//details[@class="rustdoc-toggle method-toggle"]//summary//h4' 'not_documented()' +// @!has - '//details[@class="rustdoc-toggle method-toggle"]//summary//h4[@class="code-header"]' 'not_documented()' pub struct Foo { } diff --git a/src/test/rustdoc/toggle-trait-fn.rs b/src/test/rustdoc/toggle-trait-fn.rs index 7f235fada5081..65e8daeb06619 100644 --- a/src/test/rustdoc/toggle-trait-fn.rs +++ b/src/test/rustdoc/toggle-trait-fn.rs @@ -4,11 +4,11 @@ // summary. Trait methods with no documentation should not be wrapped. // // @has foo/trait.Foo.html -// @has - '//details[@class="rustdoc-toggle"]//summary//h4' 'is_documented()' -// @!has - '//details[@class="rustdoc-toggle"]//summary//h4' 'not_documented()' +// @has - '//details[@class="rustdoc-toggle"]//summary//h4[@class="code-header"]' 'is_documented()' +// @!has - '//details[@class="rustdoc-toggle"]//summary//h4[@class="code-header"]' 'not_documented()' // @has - '//details[@class="rustdoc-toggle"]//*[@class="docblock"]' 'is_documented is documented' -// @has - '//details[@class="rustdoc-toggle"]//summary//h4' 'is_documented_optional()' -// @!has - '//details[@class="rustdoc-toggle"]//summary//h4' 'not_documented_optional()' +// @has - '//details[@class="rustdoc-toggle"]//summary//h4[@class="code-header"]' 'is_documented_optional()' +// @!has - '//details[@class="rustdoc-toggle"]//summary//h4[@class="code-header"]' 'not_documented_optional()' // @has - '//details[@class="rustdoc-toggle"]//*[@class="docblock"]' 'is_documented_optional is documented' pub trait Foo { fn not_documented(); diff --git a/src/test/rustdoc/traits-in-bodies.rs b/src/test/rustdoc/traits-in-bodies.rs index 8d194d86f9c2f..6d450a625d0bf 100644 --- a/src/test/rustdoc/traits-in-bodies.rs +++ b/src/test/rustdoc/traits-in-bodies.rs @@ -4,7 +4,7 @@ pub struct Bounded(T); // @has traits_in_bodies/struct.SomeStruct.html -// @has - '//h3' 'impl Clone for SomeStruct' +// @has - '//h3[@class="code-header in-band"]' 'impl Clone for SomeStruct' pub struct SomeStruct; fn asdf() -> Bounded { @@ -18,7 +18,7 @@ fn asdf() -> Bounded { } // @has traits_in_bodies/struct.Point.html -// @has - '//h3' 'impl Copy for Point' +// @has - '//h3[@class="code-header in-band"]' 'impl Copy for Point' #[derive(Clone)] pub struct Point { x: i32, @@ -31,7 +31,7 @@ const _FOO: () = { }; // @has traits_in_bodies/struct.Inception.html -// @has - '//h3' 'impl Clone for Inception' +// @has - '//h3[@class="code-header in-band"]' 'impl Clone for Inception' pub struct Inception; static _BAR: usize = { diff --git a/src/test/rustdoc/typedef.rs b/src/test/rustdoc/typedef.rs index f8bf9acc9b686..1fb28ee99702f 100644 --- a/src/test/rustdoc/typedef.rs +++ b/src/test/rustdoc/typedef.rs @@ -9,8 +9,8 @@ impl MyStruct { } // @has typedef/type.MyAlias.html -// @has - '//*[@class="impl has-srclink"]//h3' 'impl MyAlias' -// @has - '//*[@class="impl has-srclink"]//h3' 'impl MyTrait for MyAlias' +// @has - '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' 'impl MyAlias' +// @has - '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' 'impl MyTrait for MyAlias' // @has - 'Alias docstring' // @has - '//*[@class="sidebar"]//*[@class="location"]' 'Type Definition MyAlias' // @has - '//*[@class="sidebar"]//a[@href="#implementations"]' 'Methods' diff --git a/src/test/rustdoc/visibility.rs b/src/test/rustdoc/visibility.rs index df11a898709f6..cd284dad390e7 100644 --- a/src/test/rustdoc/visibility.rs +++ b/src/test/rustdoc/visibility.rs @@ -60,14 +60,14 @@ pub trait PubTrait { fn function(); } -// @has 'foo/struct.FooPublic.html' '//h4' 'type Type' -// @!has 'foo/struct.FooPublic.html' '//h4' 'pub type Type' +// @has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'type Type' +// @!has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'pub type Type' // -// @has 'foo/struct.FooPublic.html' '//h4' 'const CONST: usize' -// @!has 'foo/struct.FooPublic.html' '//h4' 'pub const CONST: usize' +// @has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'const CONST: usize' +// @!has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'pub const CONST: usize' // -// @has 'foo/struct.FooPublic.html' '//h4' 'fn function()' -// @!has 'foo/struct.FooPublic.html' '//h4' 'pub fn function()' +// @has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'fn function()' +// @!has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'pub fn function()' impl PubTrait for FooPublic { type Type = usize; diff --git a/src/test/rustdoc/where.rs b/src/test/rustdoc/where.rs index d08abb0951f88..549cfff96cb6d 100644 --- a/src/test/rustdoc/where.rs +++ b/src/test/rustdoc/where.rs @@ -11,7 +11,7 @@ pub fn charlie() where C: MyTrait {} pub struct Delta(D); -// @has foo/struct.Delta.html '//*[@class="impl has-srclink"]//h3' \ +// @has foo/struct.Delta.html '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl Delta where D: MyTrait" impl Delta where D: MyTrait { pub fn delta() {} @@ -19,17 +19,17 @@ impl Delta where D: MyTrait { pub struct Echo(E); -// @has foo/struct.Echo.html '//*[@class="impl has-srclink"]//h3' \ +// @has foo/struct.Echo.html '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl MyTrait for Echo where E: MyTrait" -// @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//h3' \ +// @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//h3[@class="code-header in-band"]' \ // "impl MyTrait for Echo where E: MyTrait" impl MyTrait for Echo where E: MyTrait {} pub enum Foxtrot { Foxtrot1(F) } -// @has foo/enum.Foxtrot.html '//*[@class="impl has-srclink"]//h3' \ +// @has foo/enum.Foxtrot.html '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ // "impl MyTrait for Foxtrot where F: MyTrait" -// @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//h3' \ +// @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//h3[@class="code-header in-band"]' \ // "impl MyTrait for Foxtrot where F: MyTrait" impl MyTrait for Foxtrot where F: MyTrait {} From 7e888bdc7c4f85c3b97a07c95074bfe560f1a123 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Sun, 25 Jul 2021 10:45:03 -0700 Subject: [PATCH 10/10] Do not nest headers inside of other headers Tidy hates that, and it gives very confusing error messages when you do it. --- src/librustdoc/html/render/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 45542b53573b5..2b7f7aa3691bd 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1194,7 +1194,7 @@ fn notable_traits_decl(decl: &clean::FnDecl, cx: &Context<'_>) -> String { if out.is_empty() { write!( &mut out, - "

Notable traits for {}

\ + "
Notable traits for {}
\ ", impl_.for_.print(cx) );