diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 68c59612ccc44..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) ); @@ -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/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; } 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) { 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..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 '//code' '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' @@ -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[@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." diff --git a/src/test/rustdoc/assoc-types.rs b/src/test/rustdoc/assoc-types.rs index 8fda171002ba0..d9e4ffab1c7d5 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[@class="code-header"]' 'type Output: ?Sized' type Output: ?Sized; - // @has - '//*[@id="tymethod.index"]//code' \ + // @has - '//*[@id="tymethod.index"]//h4[@class="code-header"]' \ // "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[@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 9f95d9a994b17..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 - '//code' 'pub async fn f\(\)$' -// @matches - '//code' 'pub async unsafe fn g\(\)$' -// @matches - '//code' '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 6f0c15cb5aca6..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"]//code' '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 8c995b9426bbb..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"]/code' '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"]/code' '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"]/code' '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/const-generics/add-impl.rs b/src/test/rustdoc/const-generics/add-impl.rs index 8f412aa8c4026..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/code' '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 7c4c70432c762..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"]//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[@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"]/code' '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"]/code' '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 e4e504dd83b5b..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"]/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[@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"]/code' '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"]/code' '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"]/code' '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 6cc02f78c625d..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 - '//code' '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 638de3292becb..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"]//code' '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 15c3444606c15..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 - '//code' 'impl Foo' -// @has - '//code' '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 - '//code' '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 58bd650feb466..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' '//code' "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' '//code' "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 f68e10a4d092c..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 - '//code' 'fn rust0()' + // @has - '//h4[@class="code-header"]' 'fn rust0()' pub fn rust0() {} - // @has - '//code' 'fn rust1()' + // @has - '//h4[@class="code-header"]' 'fn rust1()' pub extern "Rust" fn rust1() {} - // @has - '//code' 'extern "C" fn c0()' + // @has - '//h4[@class="code-header"]' 'extern "C" fn c0()' pub extern fn c0() {} - // @has - '//code' 'extern "C" fn c1()' + // @has - '//h4[@class="code-header"]' 'extern "C" fn c1()' pub extern "C" fn c1() {} - // @has - '//code' '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 - '//code' 'impl Bar for fn()' +// @has - '//h3[@class="code-header in-band"]' 'impl Bar for fn()' impl Bar for fn() {} -// @has - '//code' '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 - '//code' '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 7fbe5fe43274d..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"]//code' 'extern "rust-call" fn foo' -// @has - '//*[@id="method.foo_"]//code' '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"]//code' '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_"]//code' '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 96ced021041ff..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"]//code' '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"]//code' '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 41940b0884e43..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 - '//code' "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>, @@ -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..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"]//code' \ +// @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"]//code' \ +// @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"]//code' \ +// @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"]//code' \ +// @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"]//code' \ +// @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 e4039eecb7132..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"]//code' \ +// @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"]//code' \ +// @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 a2adc0e63c9c0..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"]//code' "pub fn method<'a>(_x: impl Clone + Into> + 'a)" -// @!has - '//*[@id="method.method"]//code' '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 390f0b845e00b..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"]//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[@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 - '//code' 'for Foo' -// @has - '//code' 'for Wobble' -// @!has - '//code' '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 - '//code' 'for Foo' -// @has - '//code' 'for Wobble' -// @!has - '//code' '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 013e777440f1a..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"]//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[@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 - '//code' 'for Foo' -// @has - '//code' '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 82dcc2d2cc3ef..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"]//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[@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 - '//code' 'for Foo' -// @!has - '//code' 'for Wibble' -// @!has - '//code' '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 - '//code' 'for Foo' -// @!has - '//code' 'for Wibble' -// @!has - '//code' '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 5f31e6cd3ad1f..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 - '//code' "impl<'a> dyn Bar" -// @has - '//code' "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 1e633600aeff1..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 - '//code' "for &'a char" -// @has - '//code' "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 e6585449cb64e..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 - '//code' '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 a9b54fbe79edc..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 - '//code' 'impl ThisTrait for SomeStruct' -// @!has - '//code' '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 9dac49c6413d8..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"]//code' '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"]//code' '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 e53cf6451353f..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"]//code' 'fn pass()' + // @has - '//*[@id="method.pass"]//h4[@class="code-header"]' 'fn pass()' pub fn pass() {} } impl Foo { - // @has - '//*[@id="method.pass-1"]//code' '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"]//code' '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"]//code' 'type Item = T' + // @has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' 'type Item = T' type Item=T; - // @has - '//*[@id="method.quux"]//code' '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"]//code' "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"]//code' '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"]//code' "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"]//code' '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 1cbba4b663df8..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 '//code' "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 23d9e73b567d0..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']//code" "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 81450f15c2078..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 '//code' '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 '//code' '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 a688ae48d00ce..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"]//code' '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"]//code' '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"]//code' '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"]//code' '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"]//code' '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"]//code' '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"]//code' '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 4f10c04a616b3..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"]//code' '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"]//code' '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"]//code' '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"]//code' '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"]//code' '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"]//code' '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"]//code' '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 0f991cf676ff7..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 - '//code' '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 69774aa351f17..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 - '//code' 'impl Send for Switch where ::Item: Send' -// @has - '//code' '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 e01dae6c7f183..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"]//code' \ +// @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-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..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"]//code' \ +// @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"]//code' \ +// @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 b664733487b3d..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"]//code' \ +// @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"]//code' \ +// @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"]//code' \ +// @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"]//code' \ +// @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 977596e0b9088..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"]//code' \ +// @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 e0417f1a4f4b8..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"]//code' \ +// @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"]//code' \ +// @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 aebffeff5f05e..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"]//code' '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"]//code' '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 585a0864bb25d..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 - '//code' '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 618ac20ac487d..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 '//code' '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 - '//code' '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 ee65a7d5f3902..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"]//code' \ +// @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"]//code' "\ +// @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 2951f5128e074..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"]//code' '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/recursive-deref.rs b/src/test/rustdoc/recursive-deref.rs index 91db01177c581..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 '//code' '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 '//code' '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; diff --git a/src/test/rustdoc/sidebar-links-to-foreign-impl.rs b/src/test/rustdoc/sidebar-links-to-foreign-impl.rs index e73c5b4f640cf..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"]//code' '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"]//code' "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 6730c71e90f88..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"]/code' '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 1952f723465d6..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"]/code' '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"]/code' '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"]/code' '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 943596a0c8518..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 - '//code' 'impl Send for Foo where T: Send' -// @has - '//code' '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 0213142266feb..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"]//code' \ +// @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 3346ac05ffe47..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 - '//code' 'impl Banana for Peach' -// @has - '//code' 'impl Send for Peach' -// @has - '//code' '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 c2e9b6f404677..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"]//code' \ +// @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"]//code' \ +// @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 91fe6c351c5fc..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"]//code' \ +// @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"]//code' \ +// @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 16b36b56b6807..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"]//code' \ +// @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"]//code' \ +// @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 a6cf5890dcab4..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"]//code' \ +// @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"]//code' \ +// @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 5c744e3eb3c94..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"]//code' \ +// @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 546b3e07793e1..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 - '//code' "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 baf9924b1ae66..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"]//code' \ +// @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"]//code' \ +// @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 e96187e2c9632..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"]//code' \ +// @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 fc732a08ed404..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"]//code' \ +// @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 f7f6086a4cb10..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//code' '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//code' '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 0bc5eba75a12d..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//code' 'is_documented()' -// @!has - '//details[@class="rustdoc-toggle"]//summary//code' '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//code' 'is_documented_optional()' -// @!has - '//details[@class="rustdoc-toggle"]//summary//code' '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/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..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 - '//code' '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 - '//code' '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 - '//code' '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 479cd91a9dc60..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"]//code' 'impl MyAlias' -// @has - '//*[@class="impl has-srclink"]//code' '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 beb638406c4be..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' '//code' 'type Type' -// @!has 'foo/struct.FooPublic.html' '//code' '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' '//code' 'const CONST: usize' -// @!has 'foo/struct.FooPublic.html' '//code' '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' '//code' 'fn function()' -// @!has 'foo/struct.FooPublic.html' '//code' '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 f204a27d7d3c1..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"]//code' \ +// @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"]//code' \ +// @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"]//code' \ +// @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"]//code' \ +// @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"]//code' \ +// @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 {} 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");