Auto merge of #87390 - notriddle:notriddle/rustdoc-headers-patch, r=GuillaumeGomez

Rustdoc accessibility: use real headers for doc items

Part of #87059

Partially reverts #84703

Preview at: https://notriddle.com/notriddle-rustdoc-test/real-headers/std/index.html
This commit is contained in:
bors 2021-07-25 21:41:57 +00:00
commit 5782f01a51
79 changed files with 231 additions and 218 deletions

View File

@ -1194,7 +1194,7 @@ fn notable_traits_decl(decl: &clean::FnDecl, cx: &Context<'_>) -> String {
if out.is_empty() {
write!(
&mut out,
"<h3 class=\"notable\">Notable traits for {}</h3>\
"<div class=\"notable\">Notable traits for {}</div>\
<code class=\"content\">",
impl_.for_.print(cx)
);
@ -1350,7 +1350,7 @@ fn render_impl(
);
render_rightside(w, cx, item, containing_item);
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
w.write_str("<code>");
w.write_str("<h4 class=\"code-header\">");
render_assoc_item(
w,
item,
@ -1358,7 +1358,7 @@ fn render_impl(
ItemType::Impl,
cx,
);
w.write_str("</code>");
w.write_str("</h4>");
w.write_str("</div>");
}
}
@ -1371,7 +1371,7 @@ fn render_impl(
id, item_type, in_trait_class
);
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
w.write_str("<code>");
w.write_str("<h4 class=\"code-header\">");
assoc_type(
w,
item,
@ -1381,7 +1381,7 @@ fn render_impl(
"",
cx,
);
w.write_str("</code>");
w.write_str("</h4>");
w.write_str("</div>");
}
clean::AssocConstItem(ref ty, ref default) => {
@ -1394,7 +1394,7 @@ fn render_impl(
);
render_rightside(w, cx, item, containing_item);
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
w.write_str("<code>");
w.write_str("<h4 class=\"code-header\">");
assoc_const(
w,
item,
@ -1404,7 +1404,7 @@ fn render_impl(
"",
cx,
);
w.write_str("</code>");
w.write_str("</h4>");
w.write_str("</div>");
}
clean::AssocTypeItem(ref bounds, ref default) => {
@ -1412,7 +1412,7 @@ fn render_impl(
let id = cx.derive_id(source_id.clone());
write!(w, "<div id=\"{}\" class=\"{}{}\">", id, item_type, in_trait_class,);
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
w.write_str("<code>");
w.write_str("<h4 class=\"code-header\">");
assoc_type(
w,
item,
@ -1422,7 +1422,7 @@ fn render_impl(
"",
cx,
);
w.write_str("</code>");
w.write_str("</h4>");
w.write_str("</div>");
}
clean::StrippedItem(..) => return,
@ -1613,7 +1613,7 @@ pub(crate) fn render_impl_summary(
write!(w, "<div id=\"{}\" class=\"impl has-srclink\"{}>", id, aliases);
render_rightside(w, cx, &i.impl_item, containing_item);
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
write!(w, "<code class=\"in-band\">");
write!(w, "<h3 class=\"code-header in-band\">");
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, "</code>");
write!(w, "</h3>");
let is_trait = i.inner_impl().trait_.is_some();
if is_trait {

View File

@ -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, "</div>");
write!(w, "<code>");
write!(w, "<h4 class=\"code-header\">");
render_assoc_item(w, m, AssocItemLink::Anchor(Some(&id)), ItemType::Impl, cx);
w.write_str("</code>");
w.write_str("</h4>");
w.write_str("</div>");
if toggled {
write!(w, "</summary>");

View File

@ -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 {
@ -521,7 +528,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;
}
@ -537,7 +544,7 @@ nav.sub {
padding: 0px;
}
.in-band > code {
.in-band > code, .in-band > .code-header {
display: inline-block;
}
@ -743,7 +750,7 @@ a {
}
.invisible > .srclink,
.method > code + .srclink {
.method > .code-header + .srclink {
position: absolute;
top: 0;
right: 0;
@ -1104,7 +1111,7 @@ a.test-arrow:hover{
left: -10px;
}
:target > code {
:target > code, :target > .code-header {
opacity: 1;
}

View File

@ -334,7 +334,7 @@ a.test-arrow:hover {
color: #999;
}
:target, :target * {
:target, :target > * {
background: rgba(255, 236, 164, 0.06);
}

View File

@ -282,7 +282,7 @@ a.test-arrow:hover{
color: #999;
}
:target, :target * {
:target, :target > * {
background-color: #494a3d;
}

View File

@ -274,7 +274,7 @@ a.test-arrow:hover{
color: #999;
}
:target, :target * {
:target, :target > * {
background: #FDFFD3;
}

View File

@ -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) {

View File

@ -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)

View File

@ -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"

View File

@ -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."

View File

@ -2,11 +2,11 @@
// @has assoc_types/trait.Index.html
pub trait Index<I: ?Sized> {
// @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;
}

View File

@ -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 {

View File

@ -1,6 +1,6 @@
#![crate_name = "foo"]
// @has foo/struct.S.html '//div[@id="impl-Into%3CU%3E"]//code' 'impl<T, U> Into<U> for T'
// @has foo/struct.S.html '//div[@id="impl-Into%3CU%3E"]//h3[@class="code-header in-band"]' 'impl<T, U> Into<U> for T'
pub struct S2 {}
mod m {
pub struct S {}

View File

@ -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")]

View File

@ -8,7 +8,7 @@ pub struct Simd<T, const WIDTH: usize> {
inner: T,
}
// @has foo/struct.Simd.html '//div[@id="trait-implementations-list"]//div/code' 'impl Add<Simd<u8, 16_usize>> for Simd<u8, 16>'
// @has foo/struct.Simd.html '//div[@id="trait-implementations-list"]//div/h3[@class="code-header in-band"]' 'impl Add<Simd<u8, 16_usize>> for Simd<u8, 16>'
impl Add for Simd<u8, 16> {
type Output = Self;

View File

@ -19,10 +19,10 @@ pub use extern_crate::WTrait;
// @has foo/trait.Trait.html '//pre[@class="rust trait"]' \
// 'pub trait Trait<const N: usize>'
// @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<const N: usize> Trait<N> for [u8; N]'
pub trait Trait<const N: usize> {}
impl Trait<1> for u8 {}
@ -36,7 +36,7 @@ pub struct Foo<const N: usize> where u8: Trait<N>;
// @has foo/struct.Bar.html '//pre[@class="rust struct"]' 'pub struct Bar<T, const N: usize>(_)'
pub struct Bar<T, const N: usize>([T; N]);
// @has foo/struct.Foo.html '//div[@id="impl"]/code' 'impl<const M: usize> Foo<M> where u8: Trait<M>'
// @has foo/struct.Foo.html '//div[@id="impl"]/h3[@class="code-header in-band"]' 'impl<const M: usize> Foo<M> where u8: Trait<M>'
impl<const M: usize> Foo<M> where u8: Trait<M> {
// @has - '//*[@id="associatedconstant.FOO_ASSOC"]' 'pub const FOO_ASSOC: usize'
pub const FOO_ASSOC: usize = M + 13;
@ -47,7 +47,7 @@ impl<const M: usize> Foo<M> where u8: Trait<M> {
}
}
// @has foo/struct.Bar.html '//div[@id="impl"]/code' 'impl<const M: usize> Bar<u8, M>'
// @has foo/struct.Bar.html '//div[@id="impl"]/h3[@class="code-header in-band"]' 'impl<const M: usize> Bar<u8, M>'
impl<const M: usize> Bar<u8, M> {
// @has - '//*[@id="method.hey"]' \
// 'pub fn hey<const N: usize>(&self) -> Foo<N> where u8: Trait<N>'

View File

@ -9,20 +9,20 @@ pub enum Order {
}
// @has foo/struct.VSet.html '//pre[@class="rust struct"]' 'pub struct VSet<T, const ORDER: Order>'
// @has foo/struct.VSet.html '//div[@id="impl-Send"]/code' 'impl<T, const ORDER: Order> Send for VSet<T, ORDER>'
// @has foo/struct.VSet.html '//div[@id="impl-Sync"]/code' 'impl<T, const ORDER: Order> Sync for VSet<T, ORDER>'
// @has foo/struct.VSet.html '//div[@id="impl-Send"]/h3[@class="code-header in-band"]' 'impl<T, const ORDER: Order> Send for VSet<T, ORDER>'
// @has foo/struct.VSet.html '//div[@id="impl-Sync"]/h3[@class="code-header in-band"]' 'impl<T, const ORDER: Order> Sync for VSet<T, ORDER>'
pub struct VSet<T, const ORDER: Order> {
inner: Vec<T>,
}
// @has foo/struct.VSet.html '//div[@id="impl"]/code' 'impl<T> VSet<T, {Order::Sorted}>'
// @has foo/struct.VSet.html '//div[@id="impl"]/h3[@class="code-header in-band"]' 'impl<T> VSet<T, {Order::Sorted}>'
impl <T> VSet<T, {Order::Sorted}> {
pub fn new() -> Self {
Self { inner: Vec::new() }
}
}
// @has foo/struct.VSet.html '//div[@id="impl-1"]/code' 'impl<T> VSet<T, {Order::Unsorted}>'
// @has foo/struct.VSet.html '//div[@id="impl-1"]/h3[@class="code-header in-band"]' 'impl<T> VSet<T, {Order::Unsorted}>'
impl <T> VSet<T, {Order::Unsorted}> {
pub fn new() -> Self {
Self { inner: Vec::new() }
@ -31,7 +31,7 @@ impl <T> VSet<T, {Order::Unsorted}> {
pub struct Escape<const S: &'static str>;
// @has foo/struct.Escape.html '//div[@id="impl"]/code' 'impl Escape<{ r#"<script>alert("Escape");</script>"# }>'
// @has foo/struct.Escape.html '//div[@id="impl"]/h3[@class="code-header in-band"]' 'impl Escape<{ r#"<script>alert("Escape");</script>"# }>'
impl Escape<{ r#"<script>alert("Escape");</script>"# }> {
pub fn f() {}
}

View File

@ -12,7 +12,7 @@ pub struct Hasher<T> {
unsafe impl<T: Default> Send for Hasher<T> {}
// @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]>,
}

View File

@ -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
}

View File

@ -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;

View File

@ -4,8 +4,8 @@
extern crate extern_impl_trait;
// @has 'foo/struct.X.html' '//code' "impl Foo<Associated = ()> + 'a"
// @has 'foo/struct.X.html' '//h4[@class="code-header"]' "impl Foo<Associated = ()> + 'a"
pub use extern_impl_trait::X;
// @has 'foo/struct.Y.html' '//code' "impl ?Sized + Foo<Associated = ()> + 'a"
// @has 'foo/struct.Y.html' '//h4[@class="code-header"]' "impl ?Sized + Foo<Associated = ()> + 'a"
pub use extern_impl_trait::Y;

View File

@ -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() {}

View File

@ -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, _: ()) { }
}

View File

@ -2,10 +2,10 @@
use std::fmt;
// @!has foo/struct.Bar.html '//div[@id="impl-ToString"]//code' 'impl<T> ToString for T'
// @!has foo/struct.Bar.html '//div[@id="impl-ToString"]//h3[@class="code-header in-band"]' 'impl<T> ToString for T'
pub struct Bar;
// @has foo/struct.Foo.html '//div[@id="impl-ToString"]//code' 'impl<T> ToString for T'
// @has foo/struct.Foo.html '//div[@id="impl-ToString"]//h3[@class="code-header in-band"]' 'impl<T> ToString for T'
pub struct Foo;
// @has foo/struct.Foo.html '//div[@class="sidebar-links"]/a[@href="#impl-ToString"]' 'ToString'

View File

@ -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<T>() where T: Trait<'a>,"
// @has - '//h4[@class="code-header"]' "pub fn bar<T>() where T: Trait<'a>,"
pub fn bar<T>()
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

View File

@ -4,13 +4,13 @@ pub trait Foo {}
pub struct Bar<T> { 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<u8>"
impl Foo for Bar<u8> {}
// @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<u16>"
impl Foo for Bar<u16> {}
// @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<u8>"
impl<'a> Foo for &'a Bar<u8> {}
@ -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 {}

View File

@ -5,8 +5,8 @@ pub auto trait AnAutoTrait {}
pub struct Foo<T> { 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<T: Clone> !AnAutoTrait for Foo<T> 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<T: Clone> !AnAutoTrait for Foo<T> where T: Sync,"
impl<T: Clone> !AnAutoTrait for Foo<T> where T: Sync {}

View File

@ -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<Vec<u8, Global>> + 'a)"
// @!has - '//*[@id="method.method"]//code' 'where'
// @has - '//*[@id="method.method"]//h4[@class="code-header"]' "pub fn method<'a>(_x: impl Clone + Into<Vec<u8, Global>> + 'a)"
// @!has - '//*[@id="method.method"]//h4[@class="code-header"]' 'where'
pub use impl_trait_aux::Foo;
// @has impl_trait/struct.Bar.html

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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()'

View File

@ -8,36 +8,36 @@ pub trait Bar {
}
impl Foo<u8> {
// @has - '//*[@id="method.pass"]//code' 'fn pass()'
// @has - '//*[@id="method.pass"]//h4[@class="code-header"]' 'fn pass()'
pub fn pass() {}
}
impl Foo<u16> {
// @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<u32> {
// @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<T> Bar for Foo<T> {
// @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<T> {
// @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<T> {
// @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) {}
}

View File

@ -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()"

View File

@ -5,7 +5,7 @@ pub trait MyTrait {
fn my_string(&self) -> String;
}
// @has - "//div[@id='implementors-list']//div[@id='impl-MyTrait']//code" "impl<T> MyTrait for T where T: Debug"
// @has - "//div[@id='implementors-list']//div[@id='impl-MyTrait']//h3[@class='code-header in-band']" "impl<T> MyTrait for T where T: Debug"
impl<T> MyTrait for T where T: fmt::Debug {
fn my_string(&self) -> String {
format!("{:?}", self)

View File

@ -6,8 +6,8 @@ pub struct Bar;
pub struct Baz;
// @has foo/trait.Foo.html '//code' 'impl Foo<i32> for Bar'
// @has foo/trait.Foo.html '//h3[@class="code-header in-band"]' 'impl Foo<i32> for Bar'
impl Foo<i32> for Bar {}
// @has foo/trait.Foo.html '//code' 'impl<T> Foo<T> for Baz'
// @has foo/trait.Foo.html '//h3[@class="code-header in-band"]' 'impl<T> Foo<T> for Baz'
impl<T> Foo<T> for Baz {}

View File

@ -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<Foo>)'
// @!has - '//*[@id="method.by_explicit_box"]//h4[@class="code-header"]' 'fn by_explicit_box(self: Box<Foo>)'
// @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box<Foo>)'
// @!has - '//*[@id="method.by_explicit_self_box"]//code' 'fn by_explicit_self_box(self: Box<Self>)'
// @!has - '//*[@id="method.by_explicit_self_box"]//h4[@class="code-header"]' 'fn by_explicit_self_box(self: Box<Self>)'
// @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box<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()'

View File

@ -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<Foo>)'
// @!has - '//*[@id="method.by_explicit_box"]//h4[@class="code-header"]' 'fn by_explicit_box(self: Box<Foo>)'
// @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box<Foo>)'
// @!has - '//*[@id="method.by_explicit_self_box"]//code' 'fn by_explicit_self_box(self: Box<Self>)'
// @!has - '//*[@id="method.by_explicit_self_box"]//h4[@class="code-header"]' 'fn by_explicit_self_box(self: Box<Self>)'
// @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box<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()'

View File

@ -3,5 +3,5 @@
extern crate issue_46727;
// @has issue_46727/trait.Foo.html
// @has - '//code' 'impl<T> Foo for Bar<[T; 3]>'
// @has - '//h3[@class="code-header in-band"]' 'impl<T> Foo for Bar<[T; 3]>'
pub use issue_46727::{Foo, Bar};

View File

@ -11,8 +11,8 @@ impl<B, C> Signal2 for B where B: Signal<Item = C> {
}
// @has issue_50159/struct.Switch.html
// @has - '//code' 'impl<B> Send for Switch<B> where <B as Signal>::Item: Send'
// @has - '//code' 'impl<B> Sync for Switch<B> where <B as Signal>::Item: Sync'
// @has - '//h3[@class="code-header in-band"]' 'impl<B> Send for Switch<B> where <B as Signal>::Item: Send'
// @has - '//h3[@class="code-header in-band"]' 'impl<B> Sync for Switch<B> where <B as Signal>::Item: Sync'
// @count - '//*[@id="implementations-list"]//*[@class="impl"]' 0
// @count - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]' 5
pub struct Switch<B: Signal> {

View File

@ -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<T> Send for Owned<T> where <T as Owned<'static>>::Reader: Send"
pub struct Owned<T> where T: for<'a> ::traits::Owned<'a> {
marker: PhantomData<<T as ::traits::Owned<'static>>::Reader>,

View File

@ -6,7 +6,7 @@ extern crate issue_53689;
// @has foo/trait.MyTrait.html
// @!has - 'MyStruct'
// @count - '//*[code="impl<T> MyTrait for T"]' 1
// @count - '//*[h3="impl<T> MyTrait for T"]' 1
pub trait MyTrait {}
impl<T> MyTrait for T {}

View File

@ -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>,

View File

@ -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<T> !Send for B<T>"
// @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<T> !Sync for B<T>"
pub struct B<T: ?Sized>(A, Box<T>);

View File

@ -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: <Wrapper<Inner<'a, u8>> as MyTrait>::Output

View File

@ -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<T> !Send for IntoIter<T>"
// @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<T> !Sync for IntoIter<T>"
pub struct IntoIter<T>{
hello:DynTrait<FooInterface<T>>,

View File

@ -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;

View File

@ -31,7 +31,7 @@ impl<T: Trait3> Trait3 for Vec<T> {
pub struct Struct1 {}
// @has issue_80233_normalize_auto_trait/struct.Question.html
// @has - '//code' 'impl<T> Send for Question<T>'
// @has - '//h3[@class="code-header in-band"]' 'impl<T> Send for Question<T>'
pub struct Question<T: Trait1> {
pub ins: <<Vec<T> as Trait3>::Type3 as Trait2>::Type2,
}

View File

@ -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<str> for Local'
// @has issue_82465_asref_for_and_of_local/struct.Local.html '//h3[@class="code-header in-band"]' 'impl AsRef<str> for Local'
impl AsRef<str> for Local {
fn as_ref(&self) -> &str {
todo!()
}
}
// @has - '//code' 'impl AsRef<Local> for str'
// @has - '//h3[@class="code-header in-band"]' 'impl AsRef<Local> for str'
impl AsRef<Local> for str {
fn as_ref(&self) -> &Local {
todo!()

View File

@ -5,10 +5,10 @@ pub struct Alpha;
// @matches negative_impl/struct.Bravo.html '//pre' "pub struct Bravo<B>"
pub struct Bravo<B>(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<B> !Send for Bravo<B>"
impl<B> !Send for Bravo<B> {}

View File

@ -2,4 +2,4 @@
include!("primitive/primitive-generic-impl.rs");
// @has foo/primitive.i32.html '//div[@id="impl-ToString"]//code' 'impl<T> ToString for T'
// @has foo/primitive.i32.html '//div[@id="impl-ToString"]//h3[@class="code-header in-band"]' 'impl<T> ToString for T'

View File

@ -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;

View File

@ -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 {}

View File

@ -11,7 +11,7 @@ pub struct Bar {
pub struct Foo<T: ?Sized>(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],
}

View File

@ -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<T> Any for T'
// @has - '//div[@id="impl-Any"]/h3[@class="code-header in-band"]' 'impl<T> Any for T'
// @has - '//div[@id="impl-Any"]//a[@class="srclink"]' '[src]'
pub struct Unsized {
data: [u8],

View File

@ -1,6 +1,6 @@
// @has basic/struct.Foo.html
// @has - '//code' 'impl<T> Send for Foo<T> where T: Send'
// @has - '//code' 'impl<T> Sync for Foo<T> where T: Sync'
// @has - '//h3[@class="code-header in-band"]' 'impl<T> Send for Foo<T> where T: Send'
// @has - '//h3[@class="code-header in-band"]' 'impl<T> Sync for Foo<T> 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<T> {

View File

@ -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>, <T as MyTrait<'a>>::MyItem: Copy, 'a: 'static"

View File

@ -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;

View File

@ -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>,

View File

@ -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<T> Sync for Foo<T> 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<T> Send for Foo<T>'
//
// @count - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]' 1

View File

@ -3,10 +3,10 @@ pub struct Inner<T: Copy> {
}
// @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<T> !Send for Outer<T>"
//
// @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<T> !Sync for Outer<T>"
pub struct Outer<T: Copy> {
inner_field: Inner<T>,

View File

@ -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<T> Send for Foo<T> 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<T> Sync for Foo<T> where T: Sync'
pub struct Foo<T> {
inner_field: Inner<T>,

View File

@ -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<T> Send for Outer<T> where T: Copy + Send"
pub struct Outer<T> {
inner_field: Inner<T>,

View File

@ -21,7 +21,7 @@ enum TyData<I: Interner> {
struct VariableKind<I: Interner>(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<RustInterner<'tcx>>
}

View File

@ -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<MyItem = bool>, '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, <K as MyTrait>::MyItem: OtherTrait, \
// 'c: 'static,"
pub struct Foo<'c, K: 'c> {

View File

@ -23,7 +23,7 @@ impl<T> Pattern for Wrapper<T> {
// @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<P1> Send for WriteAndThen<P1> where <P1 as Pattern>::Value: Send"
pub struct WriteAndThen<P1>(pub P1::Value,pub <Constrain<P1, Wrapper<P1::Value>> as Pattern>::Value)
where P1: Pattern;

View File

@ -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<T> Send for Owned<T> where <T as OwnedTrait<'static>>::Reader: Send"
pub struct Owned<T> where T: OwnedTrait<'static> {
marker: <T as OwnedTrait<'static>>::Reader,

View File

@ -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 {
}

View File

@ -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();

View File

@ -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'
}

View File

@ -4,7 +4,7 @@
pub struct Bounded<T: Clone>(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<SomeStruct> {
@ -18,7 +18,7 @@ fn asdf() -> Bounded<SomeStruct> {
}
// @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 = {

View File

@ -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'

View File

@ -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;

View File

@ -11,7 +11,7 @@ pub fn charlie<C>() where C: MyTrait {}
pub struct Delta<D>(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<D> Delta<D> where D: MyTrait"
impl<D> Delta<D> where D: MyTrait {
pub fn delta() {}
@ -19,17 +19,17 @@ impl<D> Delta<D> where D: MyTrait {
pub struct Echo<E>(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<E> MyTrait for Echo<E> 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<E> MyTrait for Echo<E> where E: MyTrait"
impl<E> MyTrait for Echo<E> where E: MyTrait {}
pub enum Foxtrot<F> { 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<F> MyTrait for Foxtrot<F> 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<F> MyTrait for Foxtrot<F> where F: MyTrait"
impl<F> MyTrait for Foxtrot<F> where F: MyTrait {}

View File

@ -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 <h4> tag.
// The solution is to avoid doing that, but we need to have the <h4> 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");