diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:11:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:11:28 +0000 |
commit | 94a0819fe3a0d679c3042a77bfe6a2afc505daea (patch) | |
tree | 2b827afe6a05f3538db3f7803a88c4587fe85648 /src/test/rustdoc | |
parent | Adding upstream version 1.64.0+dfsg1. (diff) | |
download | rustc-94a0819fe3a0d679c3042a77bfe6a2afc505daea.tar.xz rustc-94a0819fe3a0d679c3042a77bfe6a2afc505daea.zip |
Adding upstream version 1.66.0+dfsg1.upstream/1.66.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/rustdoc')
227 files changed, 1508 insertions, 656 deletions
diff --git a/src/test/rustdoc/all.rs b/src/test/rustdoc/all.rs index a95d6c462..4c8d02310 100644 --- a/src/test/rustdoc/all.rs +++ b/src/test/rustdoc/all.rs @@ -24,5 +24,5 @@ mod private_module { } // @has foo/all.html '//a[@href="struct.ReexportedStruct.html"]' 'ReexportedStruct' -// @!has foo/all.html 'private_module' +// @!hasraw foo/all.html 'private_module' pub use private_module::ReexportedStruct; diff --git a/src/test/rustdoc/anchors.no_const_anchor.html b/src/test/rustdoc/anchors.no_const_anchor.html index 98f47e530..75e67330a 100644 --- a/src/test/rustdoc/anchors.no_const_anchor.html +++ b/src/test/rustdoc/anchors.no_const_anchor.html @@ -1 +1 @@ -<div id="associatedconstant.YOLO" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/foo/anchors.rs.html#16">source</a></div><h4 class="code-header">const <a href="#associatedconstant.YOLO" class="constant">YOLO</a>: <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a></h4></div> +<section id="associatedconstant.YOLO" class="method has-srclink"><a class="srclink rightside" href="../src/foo/anchors.rs.html#16">source</a><h4 class="code-header">const <a href="#associatedconstant.YOLO" class="constant">YOLO</a>: <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a></h4></section>
\ No newline at end of file diff --git a/src/test/rustdoc/anchors.no_const_anchor2.html b/src/test/rustdoc/anchors.no_const_anchor2.html index 6d37e8e5e..c00251976 100644 --- a/src/test/rustdoc/anchors.no_const_anchor2.html +++ b/src/test/rustdoc/anchors.no_const_anchor2.html @@ -1 +1 @@ -<section id="associatedconstant.X" class="associatedconstant has-srclink"><span class="rightside"><a class="srclink" href="../src/foo/anchors.rs.html#42">source</a></span><h4 class="code-header">pub const <a href="#associatedconstant.X" class="constant">X</a>: <a class="primitive" href="{{channel}}/std/primitive.i32.html">i32</a> = 0i32</h4></section> +<section id="associatedconstant.X" class="associatedconstant has-srclink"><a class="srclink rightside" href="../src/foo/anchors.rs.html#42">source</a><h4 class="code-header">pub const <a href="#associatedconstant.X" class="constant">X</a>: <a class="primitive" href="{{channel}}/std/primitive.i32.html">i32</a> = 0i32</h4></section>
\ No newline at end of file diff --git a/src/test/rustdoc/anchors.no_method_anchor.html b/src/test/rustdoc/anchors.no_method_anchor.html index f46d3090e..521fdcb78 100644 --- a/src/test/rustdoc/anchors.no_method_anchor.html +++ b/src/test/rustdoc/anchors.no_method_anchor.html @@ -1 +1 @@ -<section id="method.new" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/foo/anchors.rs.html#48">source</a></span><h4 class="code-header">pub fn <a href="#method.new" class="fnname">new</a>() -> Self</h4></section>
\ No newline at end of file +<section id="method.new" class="method has-srclink"><a class="srclink rightside" href="../src/foo/anchors.rs.html#48">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fnname">new</a>() -> Self</h4></section>
\ No newline at end of file diff --git a/src/test/rustdoc/anchors.no_trait_method_anchor.html b/src/test/rustdoc/anchors.no_trait_method_anchor.html index 445a7bb56..d7bd525ff 100644 --- a/src/test/rustdoc/anchors.no_trait_method_anchor.html +++ b/src/test/rustdoc/anchors.no_trait_method_anchor.html @@ -1 +1 @@ -<div id="method.bar" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/foo/anchors.rs.html#23">source</a></div><h4 class="code-header">fn <a href="#method.bar" class="fnname">bar</a>()</h4></div>
\ No newline at end of file +<section id="method.bar" class="method has-srclink"><a class="srclink rightside" href="../src/foo/anchors.rs.html#23">source</a><h4 class="code-header">fn <a href="#method.bar" class="fnname">bar</a>()</h4></section>
\ No newline at end of file diff --git a/src/test/rustdoc/anchors.no_tymethod_anchor.html b/src/test/rustdoc/anchors.no_tymethod_anchor.html index bb0771b10..e668e5e4d 100644 --- a/src/test/rustdoc/anchors.no_tymethod_anchor.html +++ b/src/test/rustdoc/anchors.no_tymethod_anchor.html @@ -1 +1 @@ -<div id="tymethod.foo" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/foo/anchors.rs.html#20">source</a></div><h4 class="code-header">fn <a href="#tymethod.foo" class="fnname">foo</a>()</h4></div>
\ No newline at end of file +<section id="tymethod.foo" class="method has-srclink"><a class="srclink rightside" href="../src/foo/anchors.rs.html#20">source</a><h4 class="code-header">fn <a href="#tymethod.foo" class="fnname">foo</a>()</h4></section>
\ No newline at end of file diff --git a/src/test/rustdoc/anchors.no_type_anchor.html b/src/test/rustdoc/anchors.no_type_anchor.html index d317eb500..2c66d5aa3 100644 --- a/src/test/rustdoc/anchors.no_type_anchor.html +++ b/src/test/rustdoc/anchors.no_type_anchor.html @@ -1 +1 @@ -<div id="associatedtype.T" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/foo/anchors.rs.html#13">source</a></div><h4 class="code-header">type <a href="#associatedtype.T" class="associatedtype">T</a></h4></div>
\ No newline at end of file +<section id="associatedtype.T" class="method has-srclink"><a class="srclink rightside" href="../src/foo/anchors.rs.html#13">source</a><h4 class="code-header">type <a href="#associatedtype.T" class="associatedtype">T</a></h4></section>
\ No newline at end of file diff --git a/src/test/rustdoc/anonymous-lifetime.rs b/src/test/rustdoc/anonymous-lifetime.rs index f5a7d2258..390ed5a1f 100644 --- a/src/test/rustdoc/anonymous-lifetime.rs +++ b/src/test/rustdoc/anonymous-lifetime.rs @@ -12,7 +12,7 @@ pub trait Stream { } // @has 'foo/trait.Stream.html' -// @has - '//*[@class="code-header in-band"]' 'impl<S: ?Sized + Stream + Unpin> Stream for &mut S' +// @has - '//*[@class="code-header"]' 'impl<S: ?Sized + Stream + Unpin> Stream for &mut S' impl<S: ?Sized + Stream + Unpin> Stream for &mut S { type Item = S::Item; diff --git a/src/test/rustdoc/array-links.link_box_generic.html b/src/test/rustdoc/array-links.link_box_generic.html new file mode 100644 index 000000000..3481bb6a0 --- /dev/null +++ b/src/test/rustdoc/array-links.link_box_generic.html @@ -0,0 +1 @@ +<code>pub fn delta<T>() -> <a class="struct" href="struct.MyBox.html" title="struct foo::MyBox">MyBox</a><<a class="primitive" href="{{channel}}/core/primitive.array.html">[T; 1]</a>></code>
\ No newline at end of file diff --git a/src/test/rustdoc/array-links.link_box_u32.html b/src/test/rustdoc/array-links.link_box_u32.html new file mode 100644 index 000000000..e864ae55c --- /dev/null +++ b/src/test/rustdoc/array-links.link_box_u32.html @@ -0,0 +1 @@ +<code>pub fn gamma() -> <a class="struct" href="struct.MyBox.html" title="struct foo::MyBox">MyBox</a><[<a class="primitive" href="{{channel}}/core/primitive.u32.html">u32</a>; <a class="primitive" href="{{channel}}/core/primitive.array.html">1</a>]></code>
\ No newline at end of file diff --git a/src/test/rustdoc/array-links.link_slice_generic.html b/src/test/rustdoc/array-links.link_slice_generic.html new file mode 100644 index 000000000..f1ca2f59b --- /dev/null +++ b/src/test/rustdoc/array-links.link_slice_generic.html @@ -0,0 +1 @@ +<code>pub fn beta<T>() -> &'static <a class="primitive" href="{{channel}}/core/primitive.array.html">[T; 1]</a></code>
\ No newline at end of file diff --git a/src/test/rustdoc/array-links.link_slice_u32.html b/src/test/rustdoc/array-links.link_slice_u32.html new file mode 100644 index 000000000..c3943e8d3 --- /dev/null +++ b/src/test/rustdoc/array-links.link_slice_u32.html @@ -0,0 +1 @@ +<code>pub fn alpha() -> &'static [<a class="primitive" href="{{channel}}/core/primitive.u32.html">u32</a>; <a class="primitive" href="{{channel}}/core/primitive.array.html">1</a>]</code>
\ No newline at end of file diff --git a/src/test/rustdoc/array-links.rs b/src/test/rustdoc/array-links.rs new file mode 100644 index 000000000..07f92ac51 --- /dev/null +++ b/src/test/rustdoc/array-links.rs @@ -0,0 +1,28 @@ +#![crate_name = "foo"] +#![no_std] + +pub struct MyBox<T: ?Sized>(*const T); + +// @has 'foo/fn.alpha.html' +// @snapshot link_slice_u32 - '//pre[@class="rust fn"]/code' +pub fn alpha() -> &'static [u32; 1] { + loop {} +} + +// @has 'foo/fn.beta.html' +// @snapshot link_slice_generic - '//pre[@class="rust fn"]/code' +pub fn beta<T>() -> &'static [T; 1] { + loop {} +} + +// @has 'foo/fn.gamma.html' +// @snapshot link_box_u32 - '//pre[@class="rust fn"]/code' +pub fn gamma() -> MyBox<[u32; 1]> { + loop {} +} + +// @has 'foo/fn.delta.html' +// @snapshot link_box_generic - '//pre[@class="rust fn"]/code' +pub fn delta<T>() -> MyBox<[T; 1]> { + loop {} +} diff --git a/src/test/rustdoc/assoc-consts.rs b/src/test/rustdoc/assoc-consts.rs index a79e93145..a3e10ee55 100644 --- a/src/test/rustdoc/assoc-consts.rs +++ b/src/test/rustdoc/assoc-consts.rs @@ -5,7 +5,7 @@ pub trait Foo { const FOO: usize = 12 + 1; // @has - '//*[@id="associatedconstant.FOO_NO_DEFAULT"]' 'const FOO_NO_DEFAULT: bool' const FOO_NO_DEFAULT: bool; - // @!has - FOO_HIDDEN + // @!hasraw - FOO_HIDDEN #[doc(hidden)] const FOO_HIDDEN: u8 = 0; } @@ -13,12 +13,12 @@ pub trait Foo { pub struct Bar; impl Foo for Bar { - // @has assoc_consts/struct.Bar.html '//h3[@class="code-header in-band"]' 'impl Foo for Bar' + // @has assoc_consts/struct.Bar.html '//h3[@class="code-header"]' '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' const FOO_NO_DEFAULT: bool = false; - // @!has - FOO_HIDDEN + // @!hasraw - FOO_HIDDEN #[doc(hidden)] const FOO_HIDDEN: u8 = 0; } @@ -50,9 +50,9 @@ impl Bar { } impl Bar { - // @!has assoc_consts/struct.Bar.html 'BAR_PRIVATE' + // @!hasraw assoc_consts/struct.Bar.html 'BAR_PRIVATE' const BAR_PRIVATE: char = 'a'; - // @!has assoc_consts/struct.Bar.html 'BAR_HIDDEN' + // @!hasraw assoc_consts/struct.Bar.html 'BAR_HIDDEN' #[doc(hidden)] pub const BAR_HIDDEN: &'static str = "a"; } @@ -81,7 +81,7 @@ pub trait Qux { const QUX_DEFAULT2: u32 = 3; } -// @has assoc_consts/struct.Bar.html '//h3[@class="code-header in-band"]' 'impl Qux for Bar' +// @has assoc_consts/struct.Bar.html '//h3[@class="code-header"]' 'impl Qux for Bar' impl Qux for Bar { // @has - '//*[@id="associatedconstant.QUX0"]' 'const QUX0: u8' // @has - '//*[@class="docblock"]' "Docs for QUX0 in trait." diff --git a/src/test/rustdoc/associated-consts.rs b/src/test/rustdoc/associated-consts.rs index 9319a073b..adb155bb5 100644 --- a/src/test/rustdoc/associated-consts.rs +++ b/src/test/rustdoc/associated-consts.rs @@ -9,7 +9,7 @@ pub trait Trait { pub struct Bar; // @has 'foo/struct.Bar.html' -// @!has - '//h3[@class="sidebar-title"]' 'Associated Constants' +// @!has - '//div[@class="sidebar-elems"]//h3' 'Associated Constants' // @!has - '//div[@class="sidebar-elems"]//a' 'FOO' impl Trait for Bar { const FOO: u32 = 1; @@ -22,7 +22,7 @@ pub enum Foo { } // @has 'foo/enum.Foo.html' -// @!has - '//h3[@class="sidebar-title"]' 'Associated Constants' +// @!has - '//div[@class="sidebar-elems"]//h3' 'Associated Constants' // @!has - '//div[@class="sidebar-elems"]//a' 'FOO' impl Trait for Foo { const FOO: u32 = 1; @@ -33,7 +33,7 @@ impl Trait for Foo { pub struct Baz; // @has 'foo/struct.Baz.html' -// @has - '//h3[@class="sidebar-title"]' 'Associated Constants' +// @has - '//div[@class="sidebar-elems"]//h3' 'Associated Constants' // @has - '//div[@class="sidebar-elems"]//a' 'FOO' impl Baz { pub const FOO: u32 = 42; @@ -44,7 +44,7 @@ pub enum Quux { } // @has 'foo/enum.Quux.html' -// @has - '//h3[@class="sidebar-title"]' 'Associated Constants' +// @has - '//div[@class="sidebar-elems"]//h3' 'Associated Constants' // @has - '//div[@class="sidebar-elems"]//a' 'FOO' impl Quux { pub const FOO: u32 = 42; diff --git a/src/test/rustdoc/async-trait.rs b/src/test/rustdoc/async-trait.rs new file mode 100644 index 000000000..a473e4674 --- /dev/null +++ b/src/test/rustdoc/async-trait.rs @@ -0,0 +1,16 @@ +// aux-build:async-trait-dep.rs +// edition:2021 + +#![feature(async_fn_in_trait)] +#![allow(incomplete_features)] + +extern crate async_trait_dep; + +pub struct Oink {} + +// @has 'async_trait/struct.Oink.html' '//h4[@class="code-header"]' "async fn woof()" +impl async_trait_dep::Meow for Oink { + async fn woof() { + todo!() + } +} diff --git a/src/test/rustdoc/attribute-rendering.rs b/src/test/rustdoc/attribute-rendering.rs index 677787184..36e10923c 100644 --- a/src/test/rustdoc/attribute-rendering.rs +++ b/src/test/rustdoc/attribute-rendering.rs @@ -1,7 +1,7 @@ #![crate_name = "foo"] // @has 'foo/fn.f.html' -// @has - //*[@'class="docblock item-decl"]' '#[export_name = "f"] pub fn f()' +// @has - //*[@'class="item-decl"]' '#[export_name = "f"] pub fn f()' #[export_name = "\ f"] pub fn f() {} diff --git a/src/test/rustdoc/attributes.rs b/src/test/rustdoc/attributes.rs index 1c7f4b724..a36dadced 100644 --- a/src/test/rustdoc/attributes.rs +++ b/src/test/rustdoc/attributes.rs @@ -8,6 +8,6 @@ pub extern "C" fn f() {} #[export_name = "bar"] pub extern "C" fn g() {} -// @has foo/struct.Repr.html '//*[@class="docblock item-decl"]' '#[repr(C, align(8))]' +// @has foo/struct.Repr.html '//*[@class="item-decl"]' '#[repr(C, align(8))]' #[repr(C, align(8))] pub struct Repr; diff --git a/src/test/rustdoc/auxiliary/async-trait-dep.rs b/src/test/rustdoc/auxiliary/async-trait-dep.rs new file mode 100644 index 000000000..10a55dd02 --- /dev/null +++ b/src/test/rustdoc/auxiliary/async-trait-dep.rs @@ -0,0 +1,9 @@ +// edition:2021 + +#![feature(async_fn_in_trait)] +#![allow(incomplete_features)] + +pub trait Meow { + /// Who's a good dog? + async fn woof(); +} diff --git a/src/test/rustdoc/auxiliary/incoherent-impl-types.rs b/src/test/rustdoc/auxiliary/incoherent-impl-types.rs new file mode 100644 index 000000000..fc51e42e5 --- /dev/null +++ b/src/test/rustdoc/auxiliary/incoherent-impl-types.rs @@ -0,0 +1,7 @@ +#![feature(rustc_attrs)] + +#[rustc_has_incoherent_inherent_impls] +pub trait FooTrait {} + +#[rustc_has_incoherent_inherent_impls] +pub struct FooStruct; diff --git a/src/test/rustdoc/auxiliary/reexport-doc-aux.rs b/src/test/rustdoc/auxiliary/reexport-doc-aux.rs new file mode 100644 index 000000000..3400717eb --- /dev/null +++ b/src/test/rustdoc/auxiliary/reexport-doc-aux.rs @@ -0,0 +1,5 @@ +pub struct Foo; + +impl Foo { + pub fn foo() {} +} diff --git a/src/test/rustdoc/blanket-reexport-item.rs b/src/test/rustdoc/blanket-reexport-item.rs index 676d656da..437f0001f 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 '//*[@id="impl-Into%3CU%3E-for-S"]//h3[@class="code-header in-band"]' 'impl<T, U> Into<U> for T' +// @has foo/struct.S.html '//*[@id="impl-Into%3CU%3E-for-S"]//h3[@class="code-header"]' 'impl<T, U> Into<U> for T' pub struct S2 {} mod m { pub struct S {} diff --git a/src/test/rustdoc/cfg_doc_reexport.rs b/src/test/rustdoc/cfg_doc_reexport.rs new file mode 100644 index 000000000..addb6709d --- /dev/null +++ b/src/test/rustdoc/cfg_doc_reexport.rs @@ -0,0 +1,33 @@ +#![feature(doc_cfg)] +#![feature(no_core)] + +#![crate_name = "foo"] +#![no_core] + +// @has 'foo/index.html' +// @has - '//*[@class="item-left module-item"]/*[@class="stab portability"]' 'foobar' +// @has - '//*[@class="item-left module-item"]/*[@class="stab portability"]' 'bar' + +#[doc(cfg(feature = "foobar"))] +mod imp_priv { + // @has 'foo/struct.BarPriv.html' + // @has - '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \ + // 'Available on crate feature foobar only.' + pub struct BarPriv {} + impl BarPriv { + pub fn test() {} + } +} +#[doc(cfg(feature = "foobar"))] +pub use crate::imp_priv::*; + +pub mod bar { + // @has 'foo/bar/struct.Bar.html' + // @has - '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \ + // 'Available on crate feature bar only.' + #[doc(cfg(feature = "bar"))] + pub struct Bar; +} + +#[doc(cfg(feature = "bar"))] +pub use bar::Bar; diff --git a/src/test/rustdoc/check-source-code-urls-to-def-std.rs b/src/test/rustdoc/check-source-code-urls-to-def-std.rs index 3396b234a..e12d8445f 100644 --- a/src/test/rustdoc/check-source-code-urls-to-def-std.rs +++ b/src/test/rustdoc/check-source-code-urls-to-def-std.rs @@ -9,7 +9,7 @@ fn babar() {} // @has - '//a[@href="{{channel}}/std/primitive.u32.html"]' 'u32' // @has - '//a[@href="{{channel}}/std/primitive.str.html"]' 'str' // @has - '//a[@href="{{channel}}/std/primitive.bool.html"]' 'bool' -// @has - '//a[@href="../../src/foo/check-source-code-urls-to-def-std.rs.html#7"]' 'babar' +// @has - '//a[@href="#7"]' 'babar' pub fn foo(a: u32, b: &str, c: String) { let x = 12; let y: bool = true; @@ -31,12 +31,12 @@ macro_rules! data { pub fn another_foo() { // This is known limitation: if the macro doesn't generate anything, the visitor // can't find any item or anything that could tell us that it comes from expansion. - // @!has - '//a[@href="../../src/foo/check-source-code-urls-to-def-std.rs.html#19"]' 'yolo!' + // @!has - '//a[@href="#19"]' 'yolo!' yolo!(); // @has - '//a[@href="{{channel}}/std/macro.eprintln.html"]' 'eprintln!' eprintln!(); - // @has - '//a[@href="../../src/foo/check-source-code-urls-to-def-std.rs.html#27-29"]' 'data!' + // @has - '//a[@href="#27-29"]' 'data!' let x = data!(4); - // @has - '//a[@href="../../src/foo/check-source-code-urls-to-def-std.rs.html#23-25"]' 'bar!' + // @has - '//a[@href="#23-25"]' 'bar!' bar!(x); } diff --git a/src/test/rustdoc/check-source-code-urls-to-def.rs b/src/test/rustdoc/check-source-code-urls-to-def.rs index ec44e1bc6..d00a3e355 100644 --- a/src/test/rustdoc/check-source-code-urls-to-def.rs +++ b/src/test/rustdoc/check-source-code-urls-to-def.rs @@ -10,14 +10,14 @@ extern crate source_code; // @has 'src/foo/check-source-code-urls-to-def.rs.html' -// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#1-17"]' 'bar' +// @has - '//a[@href="auxiliary/source-code-bar.rs.html#1-17"]' 'bar' #[path = "auxiliary/source-code-bar.rs"] pub mod bar; -// @count - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#5"]' 4 +// @count - '//a[@href="auxiliary/source-code-bar.rs.html#5"]' 4 use bar::Bar; -// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#13"]' 'self' -// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#14"]' 'Trait' +// @has - '//a[@href="auxiliary/source-code-bar.rs.html#13"]' 'self' +// @has - '//a[@href="auxiliary/source-code-bar.rs.html#14"]' 'Trait' use bar::sub::{self, Trait}; pub struct Foo; @@ -31,26 +31,26 @@ fn babar() {} // @has - '//a/@href' '/struct.String.html' // @has - '//a/@href' '/primitive.u32.html' // @has - '//a/@href' '/primitive.str.html' -// @count - '//a[@href="../../src/foo/check-source-code-urls-to-def.rs.html#23"]' 5 +// @count - '//a[@href="#23"]' 5 // @has - '//a[@href="../../source_code/struct.SourceCode.html"]' 'source_code::SourceCode' pub fn foo(a: u32, b: &str, c: String, d: Foo, e: bar::Bar, f: source_code::SourceCode) { let x = 12; let y: Foo = Foo; let z: Bar = bar::Bar { field: Foo }; babar(); - // @has - '//a[@href="../../src/foo/check-source-code-urls-to-def.rs.html#26"]' 'hello' + // @has - '//a[@href="#26"]' 'hello' y.hello(); } -// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#14"]' 'bar::sub::Trait' -// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#14"]' 'Trait' +// @has - '//a[@href="auxiliary/source-code-bar.rs.html#14"]' 'bar::sub::Trait' +// @has - '//a[@href="auxiliary/source-code-bar.rs.html#14"]' 'Trait' pub fn foo2<T: bar::sub::Trait, V: Trait>(t: &T, v: &V, b: bool) {} pub trait AnotherTrait {} pub trait WhyNot {} -// @has - '//a[@href="../../src/foo/check-source-code-urls-to-def.rs.html#49"]' 'AnotherTrait' -// @has - '//a[@href="../../src/foo/check-source-code-urls-to-def.rs.html#50"]' 'WhyNot' +// @has - '//a[@href="#49"]' 'AnotherTrait' +// @has - '//a[@href="#50"]' 'WhyNot' pub fn foo3<T, V>(t: &T, v: &V) where T: AnotherTrait, @@ -59,7 +59,7 @@ where pub trait AnotherTrait2 {} -// @has - '//a[@href="../../src/foo/check-source-code-urls-to-def.rs.html#60"]' 'AnotherTrait2' +// @has - '//a[@href="#60"]' 'AnotherTrait2' pub fn foo4() { let x: Vec<AnotherTrait2> = Vec::new(); } diff --git a/src/test/rustdoc/codeblock-title.rs b/src/test/rustdoc/codeblock-title.rs index 140c5b3a6..b9b0b0d1a 100644 --- a/src/test/rustdoc/codeblock-title.rs +++ b/src/test/rustdoc/codeblock-title.rs @@ -1,8 +1,8 @@ #![crate_name = "foo"] -// @has foo/fn.bar.html '//*[@class="tooltip compile_fail"]' "โ" -// @has foo/fn.bar.html '//*[@class="tooltip ignore"]' "โ" -// @has foo/fn.bar.html '//*[@class="tooltip should_panic"]' "โ" +// @has foo/fn.bar.html '//*[@class="example-wrap compile_fail"]/*[@class="tooltip"]' "โ" +// @has foo/fn.bar.html '//*[@class="example-wrap ignore"]/*[@class="tooltip"]' "โ" +// @has foo/fn.bar.html '//*[@class="example-wrap should_panic"]/*[@class="tooltip"]' "โ" // @has foo/fn.bar.html '//*[@data-edition="2018"]' "โ" /// foo diff --git a/src/test/rustdoc/const-display.rs b/src/test/rustdoc/const-display.rs index 8455dd9ef..594501b22 100644 --- a/src/test/rustdoc/const-display.rs +++ b/src/test/rustdoc/const-display.rs @@ -20,7 +20,7 @@ pub const fn foo() -> u32 { 42 } pub const unsafe fn foo_unsafe() -> u32 { 42 } // @has 'foo/fn.foo2.html' '//pre' 'pub const fn foo2() -> u32' -// @!has - '//span[@class="since"]' +// @!hasraw - '//span[@class="since"]' #[unstable(feature = "humans", issue = "none")] pub const fn foo2() -> u32 { 42 } @@ -32,7 +32,7 @@ pub const fn bar2() -> u32 { 42 } // @has 'foo/fn.foo2_gated.html' '//pre' 'pub const unsafe fn foo2_gated() -> u32' -// @!has - '//span[@class="since"]' +// @!hasraw - '//span[@class="since"]' #[unstable(feature = "foo2", issue = "none")] pub const unsafe fn foo2_gated() -> u32 { 42 } @@ -43,7 +43,7 @@ pub const unsafe fn foo2_gated() -> u32 { 42 } pub const unsafe fn bar2_gated() -> u32 { 42 } // @has 'foo/fn.bar_not_gated.html' '//pre' 'pub const unsafe fn bar_not_gated() -> u32' -// @!has - '//span[@class="since"]' +// @!hasraw - '//span[@class="since"]' pub const unsafe fn bar_not_gated() -> u32 { 42 } pub struct Foo; diff --git a/src/test/rustdoc/const-generics/add-impl.rs b/src/test/rustdoc/const-generics/add-impl.rs index 591139523..6cbae9abe 100644 --- a/src/test/rustdoc/const-generics/add-impl.rs +++ b/src/test/rustdoc/const-generics/add-impl.rs @@ -7,7 +7,7 @@ pub struct Simd<T, const WIDTH: usize> { inner: T, } -// @has foo/struct.Simd.html '//div[@id="trait-implementations-list"]//h3[@class="code-header in-band"]' 'impl Add<Simd<u8, 16>> for Simd<u8, 16>' +// @has foo/struct.Simd.html '//div[@id="trait-implementations-list"]//h3[@class="code-header"]' 'impl Add<Simd<u8, 16>> for Simd<u8, 16>' impl Add for Simd<u8, 16> { 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 352a8e646..5bf76e3c4 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<const N: usize>' -// @has - '//*[@id="impl-Trait%3C1%3E-for-u8"]//h3[@class="code-header in-band"]' 'impl Trait<1> for u8' -// @has - '//*[@id="impl-Trait%3C2%3E-for-u8"]//h3[@class="code-header in-band"]' 'impl Trait<2> 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"]' \ +// @has - '//*[@id="impl-Trait%3C1%3E-for-u8"]//h3[@class="code-header"]' 'impl Trait<1> for u8' +// @has - '//*[@id="impl-Trait%3C2%3E-for-u8"]//h3[@class="code-header"]' 'impl Trait<2> for u8' +// @has - '//*[@id="impl-Trait%3C{1%20+%202}%3E-for-u8"]//h3[@class="code-header"]' 'impl Trait<{1 + 2}> for u8' +// @has - '//*[@id="impl-Trait%3CN%3E-for-%5Bu8%3B%20N%5D"]//h3[@class="code-header"]' \ // 'impl<const N: usize> Trait<N> for [u8; N]' pub trait Trait<const N: usize> {} impl Trait<1> for u8 {} @@ -31,12 +31,12 @@ impl Trait<{1 + 2}> for u8 {} impl<const N: usize> Trait<N> for [u8; N] {} // @has foo/struct.Foo.html '//pre[@class="rust struct"]' \ -// 'pub struct Foo<const N: usize> where u8: Trait<N>' +// 'pub struct Foo<const N: usize>where u8: Trait<N>' 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 '//*[@id="impl-Foo%3CM%3E"]/h3[@class="code-header in-band"]' 'impl<const M: usize> Foo<M> where u8: Trait<M>' +// @has foo/struct.Foo.html '//*[@id="impl-Foo%3CM%3E"]/h3[@class="code-header"]' '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,17 +47,17 @@ impl<const M: usize> Foo<M> where u8: Trait<M> { } } -// @has foo/struct.Bar.html '//*[@id="impl-Bar%3Cu8%2C%20M%3E"]/h3[@class="code-header in-band"]' 'impl<const M: usize> Bar<u8, M>' +// @has foo/struct.Bar.html '//*[@id="impl-Bar%3Cu8%2C%20M%3E"]/h3[@class="code-header"]' '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>' + // 'pub fn hey<const N: usize>(&self) -> Foo<N>where u8: Trait<N>' pub fn hey<const N: usize>(&self) -> Foo<N> where u8: Trait<N> { Foo } } // @has foo/fn.test.html '//pre[@class="rust fn"]' \ -// 'pub fn test<const N: usize>() -> impl Trait<N> where u8: Trait<N>' +// 'pub fn test<const N: usize>() -> impl Trait<N>where u8: Trait<N>' pub fn test<const N: usize>() -> impl Trait<N> where u8: Trait<N> { 2u8 } diff --git a/src/test/rustdoc/const-generics/const-impl.rs b/src/test/rustdoc/const-generics/const-impl.rs index f1181d54a..75ee84279 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<T, const ORDER: Order>' -// @has foo/struct.VSet.html '//*[@id="impl-Send-for-VSet%3CT%2C%20ORDER%3E"]/h3[@class="code-header in-band"]' 'impl<T, const ORDER: Order> Send for VSet<T, ORDER>' -// @has foo/struct.VSet.html '//*[@id="impl-Sync-for-VSet%3CT%2C%20ORDER%3E"]/h3[@class="code-header in-band"]' 'impl<T, const ORDER: Order> Sync for VSet<T, ORDER>' +// @has foo/struct.VSet.html '//*[@id="impl-Send-for-VSet%3CT%2C%20ORDER%3E"]/h3[@class="code-header"]' 'impl<T, const ORDER: Order> Send for VSet<T, ORDER>' +// @has foo/struct.VSet.html '//*[@id="impl-Sync-for-VSet%3CT%2C%20ORDER%3E"]/h3[@class="code-header"]' '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 '//*[@id="impl-VSet%3CT%2C%20{%20Order%3A%3ASorted%20}%3E"]/h3[@class="code-header in-band"]' 'impl<T> VSet<T, { Order::Sorted }>' +// @has foo/struct.VSet.html '//*[@id="impl-VSet%3CT%2C%20{%20Order%3A%3ASorted%20}%3E"]/h3[@class="code-header"]' '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 '//*[@id="impl-VSet%3CT%2C%20{%20Order%3A%3AUnsorted%20}%3E"]/h3[@class="code-header in-band"]' 'impl<T> VSet<T, { Order::Unsorted }>' +// @has foo/struct.VSet.html '//*[@id="impl-VSet%3CT%2C%20{%20Order%3A%3AUnsorted%20}%3E"]/h3[@class="code-header"]' '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 '//*[@id="impl-Escape%3Cr#%22%3Cscript%3Ealert(%22Escape%22)%3B%3C/script%3E%22#%3E"]/h3[@class="code-header in-band"]' 'impl Escape<r#"<script>alert("Escape");</script>"#>' +// @has foo/struct.Escape.html '//*[@id="impl-Escape%3Cr#%22%3Cscript%3Ealert(%22Escape%22)%3B%3C/script%3E%22#%3E"]/h3[@class="code-header"]' 'impl Escape<r#"<script>alert("Escape");</script>"#>' impl Escape<r#"<script>alert("Escape");</script>"#> { 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 4eac8e31e..310e89a35 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<T> { unsafe impl<T: Default> Send for Hasher<T> {} // @has foo/struct.Foo.html -// @has - '//h3[@class="code-header in-band"]' 'impl Send for Foo' +// @has - '//h3[@class="code-header"]' 'impl Send for Foo' pub struct Foo { hasher: Hasher<[u8; 3]>, } diff --git a/src/test/rustdoc/const-value-display.rs b/src/test/rustdoc/const-value-display.rs index 5b2f3c48d..8d95f0de9 100644 --- a/src/test/rustdoc/const-value-display.rs +++ b/src/test/rustdoc/const-value-display.rs @@ -1,9 +1,9 @@ #![crate_name = "foo"] // @has 'foo/constant.HOUR_IN_SECONDS.html' -// @has - '//*[@class="docblock item-decl"]//code' 'pub const HOUR_IN_SECONDS: u64 = _; // 3_600u64' +// @has - '//*[@class="item-decl"]//code' 'pub const HOUR_IN_SECONDS: u64 = _; // 3_600u64' pub const HOUR_IN_SECONDS: u64 = 60 * 60; // @has 'foo/constant.NEGATIVE.html' -// @has - '//*[@class="docblock item-decl"]//code' 'pub const NEGATIVE: i64 = _; // -3_600i64' +// @has - '//*[@class="item-decl"]//code' 'pub const NEGATIVE: i64 = _; // -3_600i64' pub const NEGATIVE: i64 = -60 * 60; diff --git a/src/test/rustdoc/decl-trailing-whitespace.rs b/src/test/rustdoc/decl-trailing-whitespace.rs index 46a2307ab..e47edc132 100644 --- a/src/test/rustdoc/decl-trailing-whitespace.rs +++ b/src/test/rustdoc/decl-trailing-whitespace.rs @@ -7,7 +7,7 @@ pub struct Error; // @has 'foo/trait.Write.html' pub trait Write { - // @snapshot 'declaration' - '//*[@class="docblock item-decl"]//code' + // @snapshot 'declaration' - '//*[@class="item-decl"]//code' fn poll_write( self: Option<String>, cx: &mut Option<String>, diff --git a/src/test/rustdoc/deprecated-impls.rs b/src/test/rustdoc/deprecated-impls.rs index efd250ce9..e419d2631 100644 --- a/src/test/rustdoc/deprecated-impls.rs +++ b/src/test/rustdoc/deprecated-impls.rs @@ -5,8 +5,8 @@ pub struct Foo0; impl Foo0 { // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.1: fn_with_doc' - // @has - 'fn_with_doc short' - // @has - 'fn_with_doc full' + // @hasraw - 'fn_with_doc short' + // @hasraw - 'fn_with_doc full' /// fn_with_doc short /// /// fn_with_doc full @@ -52,8 +52,8 @@ pub struct Foo1; impl Bar for Foo1 { // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.3: fn_empty_with_doc' - // @has - 'fn_empty_with_doc_impl short' - // @has - 'fn_empty_with_doc_impl full' + // @hasraw - 'fn_empty_with_doc_impl short' + // @hasraw - 'fn_empty_with_doc_impl full' /// fn_empty_with_doc_impl short /// /// fn_empty_with_doc_impl full @@ -63,8 +63,8 @@ impl Bar for Foo1 { fn fn_empty_without_doc() {} // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.5: fn_def_with_doc' - // @has - 'fn_def_with_doc_impl short' - // @has - 'fn_def_with_doc_impl full' + // @hasraw - 'fn_def_with_doc_impl short' + // @hasraw - 'fn_def_with_doc_impl full' /// fn_def_with_doc_impl short /// /// fn_def_with_doc_impl full @@ -74,8 +74,8 @@ impl Bar for Foo1 { fn fn_def_without_doc() {} // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.7: fn_def_def_with_doc' - // @has - 'fn_def_def_with_doc short' - // @!has - 'fn_def_def_with_doc full' + // @hasraw - 'fn_def_def_with_doc short' + // @!hasraw - 'fn_def_def_with_doc full' // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.8: fn_def_def_without_doc' } @@ -85,34 +85,34 @@ pub struct Foo2; impl Bar for Foo2 { // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.3: fn_empty_with_doc' - // @has - 'fn_empty_with_doc short' - // @!has - 'fn_empty_with_doc full' + // @hasraw - 'fn_empty_with_doc short' + // @!hasraw - 'fn_empty_with_doc full' fn fn_empty_with_doc() {} // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.4: fn_empty_without_doc' - // @has - 'fn_empty_without_doc_impl short' - // @has - 'fn_empty_without_doc_impl full' + // @hasraw - 'fn_empty_without_doc_impl short' + // @hasraw - 'fn_empty_without_doc_impl full' /// fn_empty_without_doc_impl short /// /// fn_empty_without_doc_impl full fn fn_empty_without_doc() {} // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.5: fn_def_with_doc' - // @has - 'fn_def_with_doc short' - // @!has - 'fn_def_with_doc full' + // @hasraw - 'fn_def_with_doc short' + // @!hasraw - 'fn_def_with_doc full' fn fn_def_with_doc() {} // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.6: fn_def_without_doc' - // @has - 'fn_def_without_doc_impl short' - // @has - 'fn_def_without_doc_impl full' + // @hasraw - 'fn_def_without_doc_impl short' + // @hasraw - 'fn_def_without_doc_impl full' /// fn_def_without_doc_impl short /// /// fn_def_without_doc_impl full fn fn_def_without_doc() {} // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.7: fn_def_def_with_doc' - // @has - 'fn_def_def_with_doc short' - // @!has - 'fn_def_def_with_doc full' + // @hasraw - 'fn_def_def_with_doc short' + // @!hasraw - 'fn_def_def_with_doc full' // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.0.8: fn_def_def_without_doc' } diff --git a/src/test/rustdoc/deref-recursive-pathbuf.rs b/src/test/rustdoc/deref-recursive-pathbuf.rs index 746df9c80..be2b42b5a 100644 --- a/src/test/rustdoc/deref-recursive-pathbuf.rs +++ b/src/test/rustdoc/deref-recursive-pathbuf.rs @@ -7,9 +7,9 @@ // @has '-' '//*[@class="impl-items"]//*[@id="method.as_path"]' 'pub fn as_path(&self)' // @has '-' '//*[@id="deref-methods-Path"]' 'Methods from Deref<Target = Path>' // @has '-' '//*[@class="impl-items"]//*[@id="method.exists"]' 'pub fn exists(&self)' -// @has '-' '//*[@class="sidebar-title"]/a[@href="#deref-methods-PathBuf"]' 'Methods from Deref<Target=PathBuf>' +// @has '-' '//div[@class="sidebar-elems"]//h3/a[@href="#deref-methods-PathBuf"]' 'Methods from Deref<Target=PathBuf>' // @has '-' '//*[@class="sidebar-elems"]//*[@class="block"]//a[@href="#method.as_path"]' 'as_path' -// @has '-' '//*[@class="sidebar-title"]/a[@href="#deref-methods-Path"]' 'Methods from Deref<Target=Path>' +// @has '-' '//div[@class="sidebar-elems"]//h3/a[@href="#deref-methods-Path"]' 'Methods from Deref<Target=Path>' // @has '-' '//*[@class="sidebar-elems"]//*[@class="block"]//a[@href="#method.exists"]' 'exists' #![crate_name = "foo"] diff --git a/src/test/rustdoc/deref-recursive.rs b/src/test/rustdoc/deref-recursive.rs index d5f8473f2..0436f2f86 100644 --- a/src/test/rustdoc/deref-recursive.rs +++ b/src/test/rustdoc/deref-recursive.rs @@ -7,9 +7,9 @@ // @has '-' '//*[@class="impl-items"]//*[@id="method.bar"]' 'pub fn bar(&self)' // @has '-' '//*[@id="deref-methods-Baz"]' 'Methods from Deref<Target = Baz>' // @has '-' '//*[@class="impl-items"]//*[@id="method.baz"]' 'pub fn baz(&self)' -// @has '-' '//*[@class="sidebar-title"]/a[@href="#deref-methods-Bar"]' 'Methods from Deref<Target=Bar>' +// @has '-' '//div[@class="sidebar-elems"]//h3/a[@href="#deref-methods-Bar"]' 'Methods from Deref<Target=Bar>' // @has '-' '//*[@class="sidebar-elems"]//section//a[@href="#method.bar"]' 'bar' -// @has '-' '//*[@class="sidebar-title"]/a[@href="#deref-methods-Baz"]' 'Methods from Deref<Target=Baz>' +// @has '-' '//div[@class="sidebar-elems"]//h3/a[@href="#deref-methods-Baz"]' 'Methods from Deref<Target=Baz>' // @has '-' '//*[@class="sidebar-elems"]//section//a[@href="#method.baz"]' 'baz' #![crate_name = "foo"] diff --git a/src/test/rustdoc/deref-typedef.rs b/src/test/rustdoc/deref-typedef.rs index 28f977e31..32424d13e 100644 --- a/src/test/rustdoc/deref-typedef.rs +++ b/src/test/rustdoc/deref-typedef.rs @@ -6,7 +6,7 @@ // @has '-' '//*[@class="impl-items"]//*[@id="method.foo_b"]' 'pub fn foo_b(&self)' // @has '-' '//*[@class="impl-items"]//*[@id="method.foo_c"]' 'pub fn foo_c(&self)' // @has '-' '//*[@class="impl-items"]//*[@id="method.foo_j"]' 'pub fn foo_j(&self)' -// @has '-' '//*[@class="sidebar-title"]/a[@href="#deref-methods-FooJ"]' 'Methods from Deref<Target=FooJ>' +// @has '-' '//div[@class="sidebar-elems"]//h3/a[@href="#deref-methods-FooJ"]' 'Methods from Deref<Target=FooJ>' // @has '-' '//*[@class="sidebar-elems"]//section//a[@href="#method.foo_a"]' 'foo_a' // @has '-' '//*[@class="sidebar-elems"]//section//a[@href="#method.foo_b"]' 'foo_b' // @has '-' '//*[@class="sidebar-elems"]//section//a[@href="#method.foo_c"]' 'foo_c' diff --git a/src/test/rustdoc/doc-notable_trait_box_is_not_an_iterator.rs b/src/test/rustdoc/doc-notable_trait_box_is_not_an_iterator.rs new file mode 100644 index 000000000..3fb00c7db --- /dev/null +++ b/src/test/rustdoc/doc-notable_trait_box_is_not_an_iterator.rs @@ -0,0 +1,38 @@ +#![feature(doc_notable_trait)] +#![feature(lang_items)] +#![feature(no_core)] +#![no_core] +#[lang = "owned_box"] +pub struct Box<T>; + +impl<T> Box<T> { + pub fn new(x: T) -> Box<T> { + Box + } +} + +#[doc(notable_trait)] +pub trait FakeIterator {} + +impl<I: FakeIterator> FakeIterator for Box<I> {} + +#[lang = "pin"] +pub struct Pin<T>; + +impl<T> Pin<T> { + pub fn new(x: T) -> Pin<T> { + Pin + } +} + +impl<I: FakeIterator> FakeIterator for Pin<I> {} + +// @!has doc_notable_trait_box_is_not_an_iterator/fn.foo.html '//*' 'Notable' +pub fn foo<T>(x: T) -> Box<T> { + Box::new(x) +} + +// @!has doc_notable_trait_box_is_not_an_iterator/fn.bar.html '//*' 'Notable' +pub fn bar<T>(x: T) -> Pin<T> { + Pin::new(x) +} diff --git a/src/test/rustdoc/doc_auto_cfg_nested_impl.rs b/src/test/rustdoc/doc_auto_cfg_nested_impl.rs new file mode 100644 index 000000000..4d73e0d82 --- /dev/null +++ b/src/test/rustdoc/doc_auto_cfg_nested_impl.rs @@ -0,0 +1,24 @@ +// Regression test for <https://github.com/rust-lang/rust/issues/101129>. + +#![feature(doc_auto_cfg)] +#![crate_type = "lib"] +#![crate_name = "foo"] + +pub struct S; +pub trait MyTrait1 {} +pub trait MyTrait2 {} + +// @has foo/struct.S.html +// @has - '//*[@id="impl-MyTrait1-for-S"]//*[@class="stab portability"]' \ +// 'Available on non-crate feature coolstuff only.' +#[cfg(not(feature = "coolstuff"))] +impl MyTrait1 for S {} + +#[cfg(not(feature = "coolstuff"))] +mod submod { + use crate::{S, MyTrait2}; + // This impl should also have the `not(feature = "coolstuff")`. + // @has - '//*[@id="impl-MyTrait2-for-S"]//*[@class="stab portability"]' \ + // 'Available on non-crate feature coolstuff only.' + impl MyTrait2 for S {} +} diff --git a/src/test/rustdoc/duplicate_impls/issue-33054.rs b/src/test/rustdoc/duplicate_impls/issue-33054.rs index 84c9e4ac0..c1f95ac91 100644 --- a/src/test/rustdoc/duplicate_impls/issue-33054.rs +++ b/src/test/rustdoc/duplicate_impls/issue-33054.rs @@ -1,12 +1,12 @@ // ignore-tidy-linelength // @has issue_33054/impls/struct.Foo.html -// @has - '//h3[@class="code-header in-band"]' 'impl Foo' -// @has - '//h3[@class="code-header in-band"]' 'impl Bar for Foo' +// @has - '//h3[@class="code-header"]' 'impl Foo' +// @has - '//h3[@class="code-header"]' 'impl Bar for Foo' // @count - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]' 1 // @count - '//*[@id="main-content"]/div[@id="implementations-list"]/details/summary/*[@class="impl has-srclink"]' 1 // @has issue_33054/impls/bar/trait.Bar.html -// @has - '//h3[@class="code-header in-band"]' 'impl Bar for Foo' +// @has - '//h3[@class="code-header"]' 'impl Bar for Foo' // @count - '//*[@class="struct"]' 1 pub mod impls; diff --git a/src/test/rustdoc/elided-lifetime.rs b/src/test/rustdoc/elided-lifetime.rs index 5a32554f9..006132ef8 100644 --- a/src/test/rustdoc/elided-lifetime.rs +++ b/src/test/rustdoc/elided-lifetime.rs @@ -3,7 +3,7 @@ // rust-lang/rust#75225 // // Since Rust 2018 we encourage writing out <'_> explicitly to make it clear -// that borrowing is occuring. Make sure rustdoc is following the same idiom. +// that borrowing is occurring. Make sure rustdoc is following the same idiom. #![crate_name = "foo"] @@ -11,33 +11,33 @@ pub struct Ref<'a>(&'a u32); type ARef<'a> = Ref<'a>; // @has foo/fn.test1.html -// @matches - "Ref</a><'_>" +// @matchesraw - "Ref</a><'_>" pub fn test1(a: &u32) -> Ref { Ref(a) } // @has foo/fn.test2.html -// @matches - "Ref</a><'_>" +// @matchesraw - "Ref</a><'_>" pub fn test2(a: &u32) -> Ref<'_> { Ref(a) } // @has foo/fn.test3.html -// @matches - "Ref</a><'_>" +// @matchesraw - "Ref</a><'_>" pub fn test3(a: &u32) -> ARef { Ref(a) } // @has foo/fn.test4.html -// @matches - "Ref</a><'_>" +// @matchesraw - "Ref</a><'_>" pub fn test4(a: &u32) -> ARef<'_> { Ref(a) } // Ensure external paths in inlined docs also display elided lifetime // @has foo/bar/fn.test5.html -// @matches - "Ref</a><'_>" +// @matchesraw - "Ref</a><'_>" // @has foo/bar/fn.test6.html -// @matches - "Ref</a><'_>" +// @matchesraw - "Ref</a><'_>" #[doc(inline)] pub extern crate bar; diff --git a/src/test/rustdoc/empty-impl-block-private-with-doc.rs b/src/test/rustdoc/empty-impl-block-private-with-doc.rs new file mode 100644 index 000000000..439719961 --- /dev/null +++ b/src/test/rustdoc/empty-impl-block-private-with-doc.rs @@ -0,0 +1,44 @@ +// compile-flags: --document-private-items + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] +#![crate_name = "foo"] + +// @has 'foo/struct.Foo.html' +pub struct Foo; + +// There are 3 impl blocks with public item and one that should not be displayed +// by default because it only contains private items (but not in this case because +// we used `--document-private-items`). +// @count - '//*[@class="impl has-srclink"]' 'impl Foo' 4 + +// Impl block only containing private items should not be displayed unless the +// `--document-private-items` flag is used. +/// Private +impl Foo { + const BAR: u32 = 0; + type FOO = i32; + fn hello() {} +} + +// But if any element of the impl block is public, it should be displayed. +/// Not private +impl Foo { + pub const BAR: u32 = 0; + type FOO = i32; + fn hello() {} +} + +/// Not private +impl Foo { + const BAR: u32 = 0; + pub type FOO = i32; + fn hello() {} +} + +/// Not private +impl Foo { + const BAR: u32 = 0; + type FOO = i32; + pub fn hello() {} +} diff --git a/src/test/rustdoc/empty-impl-block-private.rs b/src/test/rustdoc/empty-impl-block-private.rs new file mode 100644 index 000000000..5caf02065 --- /dev/null +++ b/src/test/rustdoc/empty-impl-block-private.rs @@ -0,0 +1,40 @@ +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] +#![crate_name = "foo"] + +// @has 'foo/struct.Foo.html' +pub struct Foo; + +// There are 3 impl blocks with public item and one that should not be displayed +// because it only contains private items. +// @count - '//*[@class="impl has-srclink"]' 'impl Foo' 3 + +// Impl block only containing private items should not be displayed. +/// Private +impl Foo { + const BAR: u32 = 0; + type FOO = i32; + fn hello() {} +} + +// But if any element of the impl block is public, it should be displayed. +/// Not private +impl Foo { + pub const BAR: u32 = 0; + type FOO = i32; + fn hello() {} +} + +/// Not private +impl Foo { + const BAR: u32 = 0; + pub type FOO = i32; + fn hello() {} +} + +/// Not private +impl Foo { + const BAR: u32 = 0; + type FOO = i32; + pub fn hello() {} +} diff --git a/src/test/rustdoc/empty-impl-block.rs b/src/test/rustdoc/empty-impl-block.rs index 6a2a254f6..95d4db06b 100644 --- a/src/test/rustdoc/empty-impl-block.rs +++ b/src/test/rustdoc/empty-impl-block.rs @@ -16,5 +16,5 @@ pub struct Another; pub trait Bar {} // @has 'foo/struct.Another.html' -// @has - '//h3[@class="code-header in-band"]' 'impl Bar for Another' +// @has - '//h3[@class="code-header"]' 'impl Bar for Another' impl Bar for Another {} diff --git a/src/test/rustdoc/empty-mod-private.rs b/src/test/rustdoc/empty-mod-private.rs index c2a98049a..147e11e58 100644 --- a/src/test/rustdoc/empty-mod-private.rs +++ b/src/test/rustdoc/empty-mod-private.rs @@ -1,16 +1,16 @@ // compile-flags: --document-private-items // @has 'empty_mod_private/index.html' '//a[@href="foo/index.html"]' 'foo' -// @has 'empty_mod_private/sidebar-items.js' 'foo' +// @hasraw 'empty_mod_private/sidebar-items.js' 'foo' // @matches 'empty_mod_private/foo/index.html' '//h1' 'Module empty_mod_private::foo' mod foo {} // @has 'empty_mod_private/index.html' '//a[@href="bar/index.html"]' 'bar' -// @has 'empty_mod_private/sidebar-items.js' 'bar' +// @hasraw 'empty_mod_private/sidebar-items.js' 'bar' // @matches 'empty_mod_private/bar/index.html' '//h1' 'Module empty_mod_private::bar' mod bar { // @has 'empty_mod_private/bar/index.html' '//a[@href="baz/index.html"]' 'baz' - // @has 'empty_mod_private/bar/sidebar-items.js' 'baz' + // @hasraw 'empty_mod_private/bar/sidebar-items.js' 'baz' // @matches 'empty_mod_private/bar/baz/index.html' '//h1' 'Module empty_mod_private::bar::baz' mod baz {} } diff --git a/src/test/rustdoc/empty-mod-public.rs b/src/test/rustdoc/empty-mod-public.rs index d097fcf83..c0bac4021 100644 --- a/src/test/rustdoc/empty-mod-public.rs +++ b/src/test/rustdoc/empty-mod-public.rs @@ -1,14 +1,14 @@ // @has 'empty_mod_public/index.html' '//a[@href="foo/index.html"]' 'foo' -// @has 'empty_mod_public/sidebar-items.js' 'foo' +// @hasraw 'empty_mod_public/sidebar-items.js' 'foo' // @matches 'empty_mod_public/foo/index.html' '//h1' 'Module empty_mod_public::foo' pub mod foo {} // @has 'empty_mod_public/index.html' '//a[@href="bar/index.html"]' 'bar' -// @has 'empty_mod_public/sidebar-items.js' 'bar' +// @hasraw 'empty_mod_public/sidebar-items.js' 'bar' // @matches 'empty_mod_public/bar/index.html' '//h1' 'Module empty_mod_public::bar' pub mod bar { // @has 'empty_mod_public/bar/index.html' '//a[@href="baz/index.html"]' 'baz' - // @has 'empty_mod_public/bar/sidebar-items.js' 'baz' + // @hasraw 'empty_mod_public/bar/sidebar-items.js' 'baz' // @matches 'empty_mod_public/bar/baz/index.html' '//h1' 'Module empty_mod_public::bar::baz' pub mod baz {} } diff --git a/src/test/rustdoc/empty-section.rs b/src/test/rustdoc/empty-section.rs index 665aa38b1..d8241ab96 100644 --- a/src/test/rustdoc/empty-section.rs +++ b/src/test/rustdoc/empty-section.rs @@ -5,7 +5,7 @@ pub struct Foo; // @has foo/struct.Foo.html -// @!has - 'Auto Trait Implementations' +// @!hasraw - 'Auto Trait Implementations' impl !Send for Foo {} impl !Sync for Foo {} impl !std::marker::Unpin for Foo {} diff --git a/src/test/rustdoc/ensure-src-link.rs b/src/test/rustdoc/ensure-src-link.rs index 9f8b0277e..c65387080 100644 --- a/src/test/rustdoc/ensure-src-link.rs +++ b/src/test/rustdoc/ensure-src-link.rs @@ -2,5 +2,5 @@ // This test ensures that the [src] link is present on traits items. -// @has foo/trait.Iterator.html '//*[@id="method.zip"]//a[@class="srclink"]' "source" +// @has foo/trait.Iterator.html '//*[@id="method.zip"]//a[@class="srclink rightside"]' "source" pub use std::iter::Iterator; diff --git a/src/test/rustdoc/escape-deref-methods.rs b/src/test/rustdoc/escape-deref-methods.rs index a62ad2c40..66919d73e 100644 --- a/src/test/rustdoc/escape-deref-methods.rs +++ b/src/test/rustdoc/escape-deref-methods.rs @@ -27,7 +27,7 @@ impl Deref for TitleList { } // @has foo/struct.TitleList.html -// @has - '//*[@class="sidebar-title"]' 'Methods from Deref<Target=Vec<Title>>' +// @has - '//div[@class="sidebar-elems"]//h3' 'Methods from Deref<Target=Vec<Title>>' impl DerefMut for TitleList { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.members diff --git a/src/test/rustdoc/extern-impl.rs b/src/test/rustdoc/extern-impl.rs index f357d65df..fd1bc2140 100644 --- a/src/test/rustdoc/extern-impl.rs +++ b/src/test/rustdoc/extern-impl.rs @@ -19,9 +19,9 @@ impl Foo { // @has foo/trait.Bar.html pub trait Bar {} -// @has - '//h3[@class="code-header in-band"]' 'impl Bar for fn()' +// @has - '//h3[@class="code-header"]' 'impl Bar for fn()' impl Bar for fn() {} -// @has - '//h3[@class="code-header in-band"]' 'impl Bar for extern "C" fn()' +// @has - '//h3[@class="code-header"]' 'impl Bar for extern "C" fn()' impl Bar for extern fn() {} -// @has - '//h3[@class="code-header in-band"]' 'impl Bar for extern "system" fn()' +// @has - '//h3[@class="code-header"]' 'impl Bar for extern "system" fn()' impl Bar for extern "system" fn() {} diff --git a/src/test/rustdoc/fn-bound.rs b/src/test/rustdoc/fn-bound.rs index 4c4ffddc8..9e060ff20 100644 --- a/src/test/rustdoc/fn-bound.rs +++ b/src/test/rustdoc/fn-bound.rs @@ -11,7 +11,7 @@ pub struct ConditionalIterator<F> { } -// @has 'fn_bound/struct.ConditionalIterator.html' '//h3[@class="code-header in-band"]' 'impl<F: Fn(&i32)> Iterator for ConditionalIterator<F>' +// @has 'fn_bound/struct.ConditionalIterator.html' '//h3[@class="code-header"]' 'impl<F: Fn(&i32)> Iterator for ConditionalIterator<F>' impl<F: Fn(&i32)> Iterator for ConditionalIterator<F> { type Item = (); diff --git a/src/test/rustdoc/generic-associated-types/gats.rs b/src/test/rustdoc/generic-associated-types/gats.rs index ae981b949..bcead3115 100644 --- a/src/test/rustdoc/generic-associated-types/gats.rs +++ b/src/test/rustdoc/generic-associated-types/gats.rs @@ -1,9 +1,8 @@ #![crate_name = "foo"] -#![feature(generic_associated_types)] // @has foo/trait.LendingIterator.html pub trait LendingIterator { - // @has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' "type Item<'a> where Self: 'a" + // @has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' "type Item<'a>where Self: 'a" type Item<'a> where Self: 'a; // @has - '//*[@id="tymethod.next"]//h4[@class="code-header"]' \ @@ -24,7 +23,7 @@ impl LendingIterator for () { pub struct Infinite<T>(T); // @has foo/trait.LendingIterator.html -// @has - '//*[@id="associatedtype.Item-2"]//h4[@class="code-header"]' "type Item<'a> where Self: 'a = &'a T" +// @has - '//*[@id="associatedtype.Item-2"]//h4[@class="code-header"]' "type Item<'a>where Self: 'a = &'a T" impl<T> LendingIterator for Infinite<T> { type Item<'a> where Self: 'a = &'a T; diff --git a/src/test/rustdoc/generic-associated-types/issue-94683.rs b/src/test/rustdoc/generic-associated-types/issue-94683.rs index 38ecf5283..985c7e983 100644 --- a/src/test/rustdoc/generic-associated-types/issue-94683.rs +++ b/src/test/rustdoc/generic-associated-types/issue-94683.rs @@ -1,5 +1,4 @@ #![crate_name = "foo"] -#![feature(generic_associated_types)] pub trait Trait { type Gat<'a>; @@ -8,6 +7,6 @@ pub trait Trait { // Make sure that the elided lifetime shows up // @has foo/type.T.html -// @has - "pub type T = " -// @has - "<'_>" +// @hasraw - "pub type T = " +// @hasraw - "<'_>" pub type T = fn(&<() as Trait>::Gat<'_>); diff --git a/src/test/rustdoc/generic-impl.rs b/src/test/rustdoc/generic-impl.rs index c6beed70a..6f68b1574 100644 --- a/src/test/rustdoc/generic-impl.rs +++ b/src/test/rustdoc/generic-impl.rs @@ -5,7 +5,7 @@ use std::fmt; // @!has foo/struct.Bar.html '//*[@id="impl-ToString-for-Bar"]' '' pub struct Bar; -// @has foo/struct.Foo.html '//*[@id="impl-ToString-for-Foo"]//h3[@class="code-header in-band"]' 'impl<T> ToString for T' +// @has foo/struct.Foo.html '//*[@id="impl-ToString-for-Foo"]//h3[@class="code-header"]' 'impl<T> ToString for T' pub struct Foo; // @has foo/struct.Foo.html '//*[@class="sidebar-elems"]//section//a[@href="#impl-ToString-for-Foo"]' 'ToString' diff --git a/src/test/rustdoc/glob-shadowing-const.rs b/src/test/rustdoc/glob-shadowing-const.rs new file mode 100644 index 000000000..5b786cf53 --- /dev/null +++ b/src/test/rustdoc/glob-shadowing-const.rs @@ -0,0 +1,20 @@ +// https://github.com/rust-lang/rust/pull/83872#issuecomment-820101008 +#![crate_name="foo"] + +mod sub4 { + /// 0 + pub const X: usize = 0; + pub mod inner { + pub use super::*; + /// 1 + pub const X: usize = 1; + } +} + +#[doc(inline)] +pub use sub4::inner::*; + +// @has 'foo/index.html' +// @has - '//div[@class="item-right docblock-short"]' '1' +// @!has - '//div[@class="item-right docblock-short"]' '0' +fn main() { assert_eq!(X, 1); } diff --git a/src/test/rustdoc/glob-shadowing.rs b/src/test/rustdoc/glob-shadowing.rs new file mode 100644 index 000000000..66a31c42b --- /dev/null +++ b/src/test/rustdoc/glob-shadowing.rs @@ -0,0 +1,86 @@ +// @has 'glob_shadowing/index.html' +// @count - '//div[@class="item-left module-item"]' 6 +// @!has - '//div[@class="item-right docblock-short"]' 'sub1::describe' +// @has - '//div[@class="item-right docblock-short"]' 'sub2::describe' + +// @!has - '//div[@class="item-right docblock-short"]' 'sub1::describe2' + +// @!has - '//div[@class="item-right docblock-short"]' 'sub1::prelude' +// @has - '//div[@class="item-right docblock-short"]' 'mod::prelude' + +// @has - '//div[@class="item-right docblock-short"]' 'sub1::Foo (struct)' +// @has - '//div[@class="item-right docblock-short"]' 'mod::Foo (function)' + +// @has - '//div[@class="item-right docblock-short"]' 'sub4::inner::X' + +// @has 'glob_shadowing/fn.describe.html' +// @has - '//div[@class="docblock"]' 'sub2::describe' + +mod sub1 { + // this should be shadowed by sub2::describe + /// sub1::describe + pub fn describe() -> &'static str { + "sub1::describe" + } + + // this should be shadowed by mod::prelude + /// sub1::prelude + pub mod prelude { + } + + // this should *not* be shadowed, because sub1::Foo and mod::Foo are in different namespaces + /// sub1::Foo (struct) + pub struct Foo; + + // this should be shadowed, + // because both sub1::describe2 and sub3::describe2 are from glob reexport + /// sub1::describe2 + pub fn describe2() -> &'static str { + "sub1::describe2" + } +} + +mod sub2 { + /// sub2::describe + pub fn describe() -> &'static str { + "sub2::describe" + } +} + +mod sub3 { + // this should be shadowed + // because both sub1::describe2 and sub3::describe2 are from glob reexport + /// sub3::describe2 + pub fn describe2() -> &'static str { + "sub3::describe2" + } +} + +mod sub4 { + // this should be shadowed by sub4::inner::X + /// sub4::X + pub const X: usize = 0; + pub mod inner { + pub use super::*; + /// sub4::inner::X + pub const X: usize = 1; + } +} + +/// mod::Foo (function) +pub fn Foo() {} + +#[doc(inline)] +pub use sub2::describe; + +#[doc(inline)] +pub use sub1::*; + +#[doc(inline)] +pub use sub3::*; + +#[doc(inline)] +pub use sub4::inner::*; + +/// mod::prelude +pub mod prelude {} diff --git a/src/test/rustdoc/hidden-impls.rs b/src/test/rustdoc/hidden-impls.rs index 8f33a6604..26e2e0e06 100644 --- a/src/test/rustdoc/hidden-impls.rs +++ b/src/test/rustdoc/hidden-impls.rs @@ -11,7 +11,7 @@ pub mod __hidden { } // @has foo/trait.Clone.html -// @!has - 'Foo' +// @!hasraw - 'Foo' // @has implementors/core/clone/trait.Clone.js -// @!has - 'Foo' +// @!hasraw - 'Foo' pub use std::clone::Clone; diff --git a/src/test/rustdoc/hidden-line.rs b/src/test/rustdoc/hidden-line.rs index f2f6173d2..00a05a7c2 100644 --- a/src/test/rustdoc/hidden-line.rs +++ b/src/test/rustdoc/hidden-line.rs @@ -15,5 +15,5 @@ /// ``` pub fn foo() {} -// @!has hidden_line/fn.foo.html invisible +// @!hasraw hidden_line/fn.foo.html invisible // @matches - //pre "#\[derive\(PartialEq\)\] // Bar" diff --git a/src/test/rustdoc/hidden-methods.rs b/src/test/rustdoc/hidden-methods.rs index 27181d489..543d8f768 100644 --- a/src/test/rustdoc/hidden-methods.rs +++ b/src/test/rustdoc/hidden-methods.rs @@ -17,13 +17,13 @@ pub mod hidden { } // @has foo/struct.Foo.html -// @!has - 'Methods' +// @!hasraw - 'Methods' // @!has - '//code' 'impl Foo' -// @!has - 'this_should_be_hidden' +// @!hasraw - 'this_should_be_hidden' pub use hidden::Foo; // @has foo/struct.Bar.html -// @!has - 'Methods' +// @!hasraw - 'Methods' // @!has - '//code' 'impl Bar' -// @!has - 'this_should_be_hidden' +// @!hasraw - 'this_should_be_hidden' pub use hidden::Bar; diff --git a/src/test/rustdoc/hide-unstable-trait.rs b/src/test/rustdoc/hide-unstable-trait.rs index c30d6ed7b..0bf7cabc4 100644 --- a/src/test/rustdoc/hide-unstable-trait.rs +++ b/src/test/rustdoc/hide-unstable-trait.rs @@ -5,7 +5,7 @@ extern crate unstable_trait; -// @has foo/struct.Foo.html 'bar' -// @has foo/struct.Foo.html 'bar2' +// @hasraw foo/struct.Foo.html 'bar' +// @hasraw foo/struct.Foo.html 'bar2' #[doc(inline)] pub use unstable_trait::Foo; diff --git a/src/test/rustdoc/higher-ranked-trait-bounds.rs b/src/test/rustdoc/higher-ranked-trait-bounds.rs index b75b8de52..3493ae6d2 100644 --- a/src/test/rustdoc/higher-ranked-trait-bounds.rs +++ b/src/test/rustdoc/higher-ranked-trait-bounds.rs @@ -4,7 +4,7 @@ pub trait Trait<'x> {} // @has foo/fn.test1.html -// @has - '//pre' "pub fn test1<T>() where for<'a> &'a T: Iterator," +// @has - '//pre' "pub fn test1<T>()where for<'a> &'a T: Iterator," pub fn test1<T>() where for<'a> &'a T: Iterator, @@ -12,7 +12,7 @@ where } // @has foo/fn.test2.html -// @has - '//pre' "pub fn test2<T>() where for<'a, 'b> &'a T: Trait<'b>," +// @has - '//pre' "pub fn test2<T>()where for<'a, 'b> &'a T: Trait<'b>," pub fn test2<T>() where for<'a, 'b> &'a T: Trait<'b>, @@ -20,7 +20,7 @@ where } // @has foo/fn.test3.html -// @has - '//pre' "pub fn test3<F>() where F: for<'a, 'b> Fn(&'a u8, &'b u8)," +// @has - '//pre' "pub fn test3<F>()where F: for<'a, 'b> Fn(&'a u8, &'b u8)," pub fn test3<F>() where F: for<'a, 'b> Fn(&'a u8, &'b u8), @@ -38,7 +38,7 @@ pub struct Foo<'a> { // @has - '//span[@id="structfield.some_trait"]' "some_trait: &'a dyn for<'b> Trait<'b>" impl<'a> Foo<'a> { - // @has - '//h4[@class="code-header"]' "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 - '//h3[@class="code-header in-band"]' "impl<'a> B<'a> for dyn for<'b> Trait<'b>" +// @has - '//h3[@class="code-header"]' "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 d1d39ccff..9e74ede8f 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<T> { field: T } -// @has foo/trait.Foo.html '//*[@class="item-list"]//h3[@class="code-header in-band"]' \ +// @has foo/trait.Foo.html '//*[@id="implementors-list"]//h3[@class="code-header"]' \ // "impl Foo for Bar<u8>" impl Foo for Bar<u8> {} -// @has foo/trait.Foo.html '//*[@class="item-list"]//h3[@class="code-header in-band"]' \ +// @has foo/trait.Foo.html '//*[@id="implementors-list"]//h3[@class="code-header"]' \ // "impl Foo for Bar<u16>" impl Foo for Bar<u16> {} -// @has foo/trait.Foo.html '//*[@class="item-list"]//h3[@class="code-header in-band"]' \ +// @has foo/trait.Foo.html '//*[@id="implementors-list"]//h3[@class="code-header"]' \ // "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"]//h3[@class="code-header in-band"]' \ +// @has foo/trait.Foo.html '//*[@id="implementors-list"]//h3[@class="code-header"]' \ // "impl Foo for foo::mod1::Baz" impl Foo for mod1::Baz {} -// @has foo/trait.Foo.html '//*[@class="item-list"]//h3[@class="code-header in-band"]' \ +// @has foo/trait.Foo.html '//*[@id="implementors-list"]//h3[@class="code-header"]' \ // "impl<'a> Foo for &'a foo::mod2::Baz" impl<'a> Foo for &'a mod2::Baz {} diff --git a/src/test/rustdoc/impl-parts-crosscrate.rs b/src/test/rustdoc/impl-parts-crosscrate.rs index 6c5e79d5a..34733f1f8 100644 --- a/src/test/rustdoc/impl-parts-crosscrate.rs +++ b/src/test/rustdoc/impl-parts-crosscrate.rs @@ -12,9 +12,9 @@ pub struct Bar<T> { t: T } // full impl string. Instead, just make sure something from each part // is mentioned. -// @has implementors/rustdoc_impl_parts_crosscrate/trait.AnAutoTrait.js Bar -// @has - Send -// @has - !AnAutoTrait -// @has - Copy +// @hasraw implementors/rustdoc_impl_parts_crosscrate/trait.AnAutoTrait.js Bar +// @hasraw - Send +// @hasraw - !AnAutoTrait +// @hasraw - Copy impl<T: Send> !rustdoc_impl_parts_crosscrate::AnAutoTrait for Bar<T> where T: Copy {} diff --git a/src/test/rustdoc/impl-parts.rs b/src/test/rustdoc/impl-parts.rs index 249158c1a..7b931727e 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<T> { field: T } -// @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"]//h3[@class="code-header in-band"]' \ -// "impl<T: Clone> !AnAutoTrait for Foo<T> where T: Sync," +// @has impl_parts/struct.Foo.html '//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// "impl<T: Clone> !AnAutoTrait for Foo<T>where T: Sync," +// @has impl_parts/trait.AnAutoTrait.html '//*[@id="implementors-list"]//h3[@class="code-header"]' \ +// "impl<T: Clone> !AnAutoTrait for Foo<T>where T: Sync," impl<T: Clone> !AnAutoTrait for Foo<T> where T: Sync {} diff --git a/src/test/rustdoc/impl-trait-alias.rs b/src/test/rustdoc/impl-trait-alias.rs index 54c3f856d..4f681c78e 100644 --- a/src/test/rustdoc/impl-trait-alias.rs +++ b/src/test/rustdoc/impl-trait-alias.rs @@ -3,11 +3,11 @@ trait MyTrait {} impl MyTrait for i32 {} -// @has impl_trait_alias/type.Foo.html 'Foo' +// @hasraw impl_trait_alias/type.Foo.html 'Foo' /// debug type pub type Foo = impl MyTrait; -// @has impl_trait_alias/fn.foo.html 'foo' +// @hasraw impl_trait_alias/fn.foo.html 'foo' /// debug function pub fn foo() -> Foo { 1 diff --git a/src/test/rustdoc/impossible-default.rs b/src/test/rustdoc/impossible-default.rs new file mode 100644 index 000000000..24d6e3bda --- /dev/null +++ b/src/test/rustdoc/impossible-default.rs @@ -0,0 +1,20 @@ +#![crate_name = "foo"] + +// Check that default trait items that are impossible to satisfy + +pub trait Foo { + fn needs_sized(&self) + where + Self: Sized, + {} + + fn no_needs_sized(&self) {} +} + +// @!has foo/struct.Bar.html '//*[@id="method.needs_sized"]//h4[@class="code-header"]' \ +// "fn needs_sized" +// @has foo/struct.Bar.html '//*[@id="method.no_needs_sized"]//h4[@class="code-header"]' \ +// "fn no_needs_sized" +pub struct Bar([u8]); + +impl Foo for Bar {} diff --git a/src/test/rustdoc/index-page.rs b/src/test/rustdoc/index-page.rs index be668a127..0c947ea2e 100644 --- a/src/test/rustdoc/index-page.rs +++ b/src/test/rustdoc/index-page.rs @@ -5,7 +5,7 @@ #![crate_name = "foo"] // @has foo/../index.html -// @has - '//span[@class="in-band"]' 'List of all crates' -// @has - '//ul[@class="crate mod"]//a[@href="foo/index.html"]' 'foo' -// @has - '//ul[@class="crate mod"]//a[@href="all_item_types/index.html"]' 'all_item_types' +// @has - '//h1[@class="fqn"]' 'List of all crates' +// @has - '//ul[@class="all-items"]//a[@href="foo/index.html"]' 'foo' +// @has - '//ul[@class="all-items"]//a[@href="all_item_types/index.html"]' 'all_item_types' pub struct Foo; diff --git a/src/test/rustdoc/infinite-redirection.rs b/src/test/rustdoc/infinite-redirection.rs index 96a43323c..f037a8e1a 100644 --- a/src/test/rustdoc/infinite-redirection.rs +++ b/src/test/rustdoc/infinite-redirection.rs @@ -7,7 +7,7 @@ // @has 'foo/builders/struct.ActionRowBuilder.html' // @has - '//*[@id="synthetic-implementations"]' 'Auto Trait Implementations' -// And that the link in the module is targetting it. +// And that the link in the module is targeting it. // @has 'foo/builders/index.html' // @has - '//a[@href="struct.ActionRowBuilder.html"]' 'ActionRowBuilder' diff --git a/src/test/rustdoc/inline_cross/add-docs.rs b/src/test/rustdoc/inline_cross/add-docs.rs index 8f0c4e5e6..a1124d209 100644 --- a/src/test/rustdoc/inline_cross/add-docs.rs +++ b/src/test/rustdoc/inline_cross/add-docs.rs @@ -4,6 +4,6 @@ extern crate inner; // @has add_docs/struct.MyStruct.html -// @has add_docs/struct.MyStruct.html "Doc comment from โpub useโ, Doc comment from definition" +// @hasraw add_docs/struct.MyStruct.html "Doc comment from โpub useโ, Doc comment from definition" /// Doc comment from 'pub use', pub use inner::MyStruct; diff --git a/src/test/rustdoc/inline_cross/assoc-items.rs b/src/test/rustdoc/inline_cross/assoc-items.rs index 231805a52..811827a17 100644 --- a/src/test/rustdoc/inline_cross/assoc-items.rs +++ b/src/test/rustdoc/inline_cross/assoc-items.rs @@ -7,10 +7,10 @@ extern crate assoc_items; // @has foo/struct.MyStruct.html -// @!has - 'PrivateConst' +// @!hasraw - 'PrivateConst' // @has - '//*[@id="associatedconstant.PublicConst"]' 'pub const PublicConst: u8' // @has - '//*[@class="docblock"]' 'docs for PublicConst' -// @!has - 'private_method' +// @!hasraw - 'private_method' // @has - '//*[@id="method.public_method"]' 'pub fn public_method()' // @has - '//*[@class="docblock"]' 'docs for public_method' // @has - '//*[@id="associatedconstant.ConstNoDefault"]' 'const ConstNoDefault: i16' diff --git a/src/test/rustdoc/inline_cross/assoc_item_trait_bounds.out0.html b/src/test/rustdoc/inline_cross/assoc_item_trait_bounds.out0.html new file mode 100644 index 000000000..8934bc1ee --- /dev/null +++ b/src/test/rustdoc/inline_cross/assoc_item_trait_bounds.out0.html @@ -0,0 +1 @@ +<h4 class="code-header">type <a href="#associatedtype.Out0" class="associatedtype">Out0</a>: <a class="trait" href="../assoc_item_trait_bounds/trait.Support.html" title="trait assoc_item_trait_bounds::Support">Support</a><Item = <a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>></h4>
\ No newline at end of file diff --git a/src/test/rustdoc/inline_cross/assoc_item_trait_bounds.out2.html b/src/test/rustdoc/inline_cross/assoc_item_trait_bounds.out2.html new file mode 100644 index 000000000..bf330670e --- /dev/null +++ b/src/test/rustdoc/inline_cross/assoc_item_trait_bounds.out2.html @@ -0,0 +1 @@ +<h4 class="code-header">type <a href="#associatedtype.Out2" class="associatedtype">Out2</a><T>: <a class="trait" href="../assoc_item_trait_bounds/trait.Support.html" title="trait assoc_item_trait_bounds::Support">Support</a><Item = T></h4>
\ No newline at end of file diff --git a/src/test/rustdoc/inline_cross/assoc_item_trait_bounds.out9.html b/src/test/rustdoc/inline_cross/assoc_item_trait_bounds.out9.html new file mode 100644 index 000000000..69d84e1b2 --- /dev/null +++ b/src/test/rustdoc/inline_cross/assoc_item_trait_bounds.out9.html @@ -0,0 +1 @@ +<h4 class="code-header">type <a href="#associatedtype.Out9" class="associatedtype">Out9</a>: <a class="trait" href="{{channel}}/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="{{channel}}/std/primitive.i32.html">i32</a>) -> <a class="primitive" href="{{channel}}/std/primitive.bool.html">bool</a> + <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a></h4>
\ No newline at end of file diff --git a/src/test/rustdoc/inline_cross/assoc_item_trait_bounds.rs b/src/test/rustdoc/inline_cross/assoc_item_trait_bounds.rs new file mode 100644 index 000000000..5f4712aab --- /dev/null +++ b/src/test/rustdoc/inline_cross/assoc_item_trait_bounds.rs @@ -0,0 +1,40 @@ +// Regression test for issues #77763, #84579 and #102142. +#![crate_name = "main"] + +// aux-build:assoc_item_trait_bounds.rs +// build-aux-docs +// ignore-cross-compile +extern crate assoc_item_trait_bounds as aux; + +// @has main/trait.Main.html +// @has - '//*[@id="associatedtype.Out0"]' 'type Out0: Support<Item = ()>' +// @has - '//*[@id="associatedtype.Out1"]' 'type Out1: Support<Item = Self::Item>' +// @has - '//*[@id="associatedtype.Out2"]' 'type Out2<T>: Support<Item = T>' +// @has - '//*[@id="associatedtype.Out3"]' 'type Out3: Support<Produce<()> = bool>' +// @has - '//*[@id="associatedtype.Out4"]' 'type Out4<T>: Support<Produce<T> = T>' +// @has - '//*[@id="associatedtype.Out5"]' "type Out5: Support<Output<'static> = &'static ()>" +// @has - '//*[@id="associatedtype.Out6"]' "type Out6: for<'a> Support<Output<'a> = &'a ()>" +// @has - '//*[@id="associatedtype.Out7"]' "type Out7: Support<Item = String, Produce<i32> = u32> + Unrelated" +// @has - '//*[@id="associatedtype.Out8"]' "type Out8: Unrelated + Protocol<i16, Q1 = u128, Q0 = ()>" +// @has - '//*[@id="associatedtype.Out9"]' "type Out9: FnMut(i32) -> bool + Clone" +// @has - '//*[@id="associatedtype.Out10"]' "type Out10<'q>: Support<Output<'q> = ()>" +// @has - '//*[@id="associatedtype.Out11"]' "type Out11: for<'r, 's> Helper<A<'s> = &'s (), B<'r> = ()>" +// @has - '//*[@id="associatedtype.Out12"]' "type Out12: for<'w> Helper<B<'w> = Cow<'w, str>, A<'w> = bool>" +// @has - '//*[@id="associatedtype.Out13"]' "type Out13: for<'fst, 'snd> Aid<'snd, Result<'fst> = &'fst mut str>" +// @has - '//*[@id="associatedtype.Out14"]' "type Out14<P: Copy + Eq, Q: ?Sized>" +// +// Snapshots: +// Check that we don't render any where-clauses for the following associated types since +// all corresponding projection equality predicates should have already been re-sugared +// to associated type bindings: +// +// @snapshot out0 - '//*[@id="associatedtype.Out0"]/*[@class="code-header"]' +// @snapshot out2 - '//*[@id="associatedtype.Out2"]/*[@class="code-header"]' +// @snapshot out9 - '//*[@id="associatedtype.Out9"]/*[@class="code-header"]' +// +// @has - '//*[@id="tymethod.make"]' \ +// "fn make<F>(F, impl FnMut(&str) -> bool)\ +// where \ +// F: FnOnce(u32) -> String, \ +// Self::Out2<()>: Protocol<u8, Q0 = Self::Item, Q1 = ()>" +pub use aux::Main; diff --git a/src/test/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs b/src/test/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs new file mode 100644 index 000000000..d326e61da --- /dev/null +++ b/src/test/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs @@ -0,0 +1,46 @@ +pub trait Main { + type Item; + + type Out0: Support<Item = ()>; + type Out1: Support<Item = Self::Item>; + type Out2<T>: Support<Item = T>; + type Out3: Support<Produce<()> = bool>; + type Out4<T>: Support<Produce<T> = T>; + type Out5: Support<Output<'static> = &'static ()>; + type Out6: for<'a> Support<Output<'a> = &'a ()>; + type Out7: Support<Item = String, Produce<i32> = u32> + Unrelated; + type Out8: Unrelated + Protocol<i16, Q1 = u128, Q0 = ()>; + type Out9: FnMut(i32) -> bool + Clone; + type Out10<'q>: Support<Output<'q> = ()>; + type Out11: for<'r, 's> Helper<A<'s> = &'s (), B<'r> = ()>; + type Out12: for<'w> Helper<B<'w> = std::borrow::Cow<'w, str>, A<'w> = bool>; + type Out13: for<'fst, 'snd> Aid<'snd, Result<'fst> = &'fst mut str>; + type Out14<P: Copy + Eq, Q: ?Sized>; + + fn make<F>(_: F, _: impl FnMut(&str) -> bool) + where + F: FnOnce(u32) -> String, + Self::Out2<()>: Protocol<u8, Q0 = Self::Item, Q1 = ()>; +} + +pub trait Support { + type Item; + type Output<'a>; + type Produce<T>; +} + +pub trait Protocol<K> { + type Q0; + type Q1; +} + +pub trait Unrelated {} + +pub trait Helper { + type A<'q>; + type B<'q>; +} + +pub trait Aid<'src> { + type Result<'inter>; +} diff --git a/src/test/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs b/src/test/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs index 913ba8f2a..19433c968 100644 --- a/src/test/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs +++ b/src/test/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs @@ -13,6 +13,19 @@ pub fn func3(_x: impl Iterator<Item = impl Iterator<Item = u8>> + Clone) {} pub fn func4<T: Iterator<Item = impl Clone>>(_x: T) {} +pub fn func5( + _f: impl for<'any> Fn(&'any str, &'any str) -> bool + for<'r> Other<T<'r> = ()>, + _a: impl for<'alpha, 'beta> Auxiliary<'alpha, Item<'beta> = fn(&'beta ())>, +) {} + +pub trait Other { + type T<'dependency>; +} + +pub trait Auxiliary<'arena> { + type Item<'input>; +} + pub async fn async_fn() {} pub struct Foo; diff --git a/src/test/rustdoc/inline_cross/auxiliary/issue-24183.rs b/src/test/rustdoc/inline_cross/auxiliary/issue-24183.rs new file mode 100644 index 000000000..e7a13acc6 --- /dev/null +++ b/src/test/rustdoc/inline_cross/auxiliary/issue-24183.rs @@ -0,0 +1,14 @@ +#![crate_type = "lib"] + +pub trait U/*: ?Sized */ { + fn modified(self) -> Self + where + Self: Sized + { + self + } + + fn touch(&self)/* where Self: ?Sized */{} +} + +pub trait S: Sized {} diff --git a/src/test/rustdoc/inline_cross/hidden-use.rs b/src/test/rustdoc/inline_cross/hidden-use.rs index 97715737f..28a4f4bac 100644 --- a/src/test/rustdoc/inline_cross/hidden-use.rs +++ b/src/test/rustdoc/inline_cross/hidden-use.rs @@ -5,8 +5,8 @@ extern crate rustdoc_hidden; // @has hidden_use/index.html -// @!has - 'rustdoc_hidden' -// @!has - 'Bar' +// @!hasraw - 'rustdoc_hidden' +// @!hasraw - 'Bar' // @!has hidden_use/struct.Bar.html #[doc(hidden)] pub use rustdoc_hidden::Bar; diff --git a/src/test/rustdoc/inline_cross/impl_trait.rs b/src/test/rustdoc/inline_cross/impl_trait.rs index ef615472b..6c1cf8252 100644 --- a/src/test/rustdoc/inline_cross/impl_trait.rs +++ b/src/test/rustdoc/inline_cross/impl_trait.rs @@ -26,6 +26,13 @@ pub use impl_trait_aux::func3; // @has - '//pre[@class="rust fn"]' "T: Iterator<Item = impl Clone>," pub use impl_trait_aux::func4; +// @has impl_trait/fn.func5.html +// @has - '//pre[@class="rust fn"]' "func5(" +// @has - '//pre[@class="rust fn"]' "_f: impl for<'any> Fn(&'any str, &'any str) -> bool + for<'r> Other<T<'r> = ()>," +// @has - '//pre[@class="rust fn"]' "_a: impl for<'alpha, 'beta> Auxiliary<'alpha, Item<'beta> = fn(&'beta ())>" +// @!has - '//pre[@class="rust fn"]' 'where' +pub use impl_trait_aux::func5; + // @has impl_trait/fn.async_fn.html // @has - '//pre[@class="rust fn"]' "pub async fn async_fn()" pub use impl_trait_aux::async_fn; diff --git a/src/test/rustdoc/inline_cross/issue-24183.method_no_where_self_sized.html b/src/test/rustdoc/inline_cross/issue-24183.method_no_where_self_sized.html new file mode 100644 index 000000000..6955a9614 --- /dev/null +++ b/src/test/rustdoc/inline_cross/issue-24183.method_no_where_self_sized.html @@ -0,0 +1 @@ +<h4 class="code-header">fn <a href="#method.touch" class="fnname">touch</a>(&self)</h4>
\ No newline at end of file diff --git a/src/test/rustdoc/inline_cross/issue-24183.rs b/src/test/rustdoc/inline_cross/issue-24183.rs new file mode 100644 index 000000000..d11b6955f --- /dev/null +++ b/src/test/rustdoc/inline_cross/issue-24183.rs @@ -0,0 +1,18 @@ +#![crate_type = "lib"] +#![crate_name = "usr"] + +// aux-crate:issue_24183=issue-24183.rs +// edition: 2021 + +// @has usr/trait.U.html +// @has - '//*[@class="item-decl"]' "pub trait U {" +// @has - '//*[@id="method.modified"]' \ +// "fn modified(self) -> Self\ +// where \ +// Self: Sized" +// @snapshot method_no_where_self_sized - '//*[@id="method.touch"]/*[@class="code-header"]' +pub use issue_24183::U; + +// @has usr/trait.S.html +// @has - '//*[@class="item-decl"]' 'pub trait S: Sized {' +pub use issue_24183::S; diff --git a/src/test/rustdoc/inline_cross/issue-31948-1.rs b/src/test/rustdoc/inline_cross/issue-31948-1.rs index be8585dd1..6e89167b3 100644 --- a/src/test/rustdoc/inline_cross/issue-31948-1.rs +++ b/src/test/rustdoc/inline_cross/issue-31948-1.rs @@ -5,22 +5,22 @@ extern crate rustdoc_nonreachable_impls; // @has issue_31948_1/struct.Wobble.html -// @has - '//*[@class="impl has-srclink"]//h3[@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' +// @has - '//*[@class="impl has-srclink"]//h3[@class="code-header"]' 'Bark for' +// @has - '//*[@class="impl has-srclink"]//h3[@class="code-header"]' 'Woof for' +// @!has - '//*[@class="impl"]//h3[@class="code-header"]' 'Bar for' +// @!has - '//*[@class="impl"]//h3[@class="code-header"]' 'Qux for' pub use rustdoc_nonreachable_impls::hidden::Wobble; // @has issue_31948_1/trait.Bark.html -// @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' +// @has - '//h3[@class="code-header"]' 'for Foo' +// @has - '//h3[@class="code-header"]' 'for Wobble' +// @!has - '//h3[@class="code-header"]' 'for Wibble' pub use rustdoc_nonreachable_impls::Bark; // @has issue_31948_1/trait.Woof.html -// @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' +// @has - '//h3[@class="code-header"]' 'for Foo' +// @has - '//h3[@class="code-header"]' 'for Wobble' +// @!has - '//h3[@class="code-header"]' '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 7aa994f19..141e07656 100644 --- a/src/test/rustdoc/inline_cross/issue-31948-2.rs +++ b/src/test/rustdoc/inline_cross/issue-31948-2.rs @@ -5,15 +5,15 @@ extern crate rustdoc_nonreachable_impls; // @has issue_31948_2/struct.Wobble.html -// @has - '//*[@class="impl has-srclink"]//h3[@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' +// @has - '//*[@class="impl has-srclink"]//h3[@class="code-header"]' 'Qux for' +// @has - '//*[@class="impl has-srclink"]//h3[@class="code-header"]' 'Bark for' +// @has - '//*[@class="impl has-srclink"]//h3[@class="code-header"]' 'Woof for' +// @!has - '//*[@class="impl"]//h3[@class="code-header"]' 'Bar for' pub use rustdoc_nonreachable_impls::hidden::Wobble; // @has issue_31948_2/trait.Qux.html -// @has - '//h3[@class="code-header in-band"]' 'for Foo' -// @has - '//h3[@class="code-header in-band"]' 'for Wobble' +// @has - '//h3[@class="code-header"]' 'for Foo' +// @has - '//h3[@class="code-header"]' '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 7bf4110d3..96fc6ca47 100644 --- a/src/test/rustdoc/inline_cross/issue-31948.rs +++ b/src/test/rustdoc/inline_cross/issue-31948.rs @@ -5,22 +5,22 @@ extern crate rustdoc_nonreachable_impls; // @has issue_31948/struct.Foo.html -// @has - '//*[@class="impl has-srclink"]//h3[@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' +// @has - '//*[@class="impl has-srclink"]//h3[@class="code-header"]' 'Bark for' +// @has - '//*[@class="impl has-srclink"]//h3[@class="code-header"]' 'Woof for' +// @!has - '//*[@class="impl has-srclink"]//h3[@class="code-header"]' 'Bar for' +// @!has - '//*[@class="impl"]//h3[@class="code-header"]' 'Qux for' pub use rustdoc_nonreachable_impls::Foo; // @has issue_31948/trait.Bark.html -// @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' +// @has - '//h3[@class="code-header"]' 'for Foo' +// @!has - '//h3[@class="code-header"]' 'for Wibble' +// @!has - '//h3[@class="code-header"]' 'for Wobble' pub use rustdoc_nonreachable_impls::Bark; // @has issue_31948/trait.Woof.html -// @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' +// @has - '//h3[@class="code-header"]' 'for Foo' +// @!has - '//h3[@class="code-header"]' 'for Wibble' +// @!has - '//h3[@class="code-header"]' '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 8052339a8..183fd15ab 100644 --- a/src/test/rustdoc/inline_cross/issue-32881.rs +++ b/src/test/rustdoc/inline_cross/issue-32881.rs @@ -5,7 +5,7 @@ extern crate rustdoc_trait_object_impl; // @has issue_32881/trait.Bar.html -// @has - '//h3[@class="code-header in-band"]' "impl<'a> dyn Bar" -// @has - '//h3[@class="code-header in-band"]' "impl<'a> Debug for dyn Bar" +// @has - '//h3[@class="code-header"]' "impl<'a> dyn Bar" +// @has - '//h3[@class="code-header"]' "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 c60859bbc..d954707fa 100644 --- a/src/test/rustdoc/inline_cross/issue-33113.rs +++ b/src/test/rustdoc/inline_cross/issue-33113.rs @@ -5,6 +5,6 @@ extern crate bar; // @has issue_33113/trait.Bar.html -// @has - '//h3[@class="code-header in-band"]' "for &'a char" -// @has - '//h3[@class="code-header in-band"]' "for Foo" +// @has - '//h3[@class="code-header"]' "for &'a char" +// @has - '//h3[@class="code-header"]' "for Foo" pub use bar::Bar; diff --git a/src/test/rustdoc/inline_cross/proc_macro.rs b/src/test/rustdoc/inline_cross/proc_macro.rs index 532a295c0..a46550865 100644 --- a/src/test/rustdoc/inline_cross/proc_macro.rs +++ b/src/test/rustdoc/inline_cross/proc_macro.rs @@ -12,25 +12,25 @@ extern crate some_macros; // @has proc_macro/derive.SomeDerive.html // @has proc_macro/macro.some_proc_macro.html -// @has - 'a proc-macro that swallows its input and does nothing.' +// @hasraw - 'a proc-macro that swallows its input and does nothing.' pub use some_macros::some_proc_macro; // @has proc_macro/macro.reexported_macro.html -// @has - 'Doc comment from the original crate' +// @hasraw - 'Doc comment from the original crate' pub use some_macros::reexported_macro; // @has proc_macro/attr.some_proc_attr.html -// @has - 'a proc-macro attribute that passes its item through verbatim.' +// @hasraw - 'a proc-macro attribute that passes its item through verbatim.' pub use some_macros::some_proc_attr; // @has proc_macro/derive.SomeDerive.html -// @has - 'a derive attribute that adds nothing to its input.' +// @hasraw - 'a derive attribute that adds nothing to its input.' pub use some_macros::SomeDerive; // @has proc_macro/attr.first_attr.html -// @has - 'Generated doc comment' +// @hasraw - 'Generated doc comment' pub use some_macros::first_attr; // @has proc_macro/attr.second_attr.html -// @has - 'Generated doc comment' +// @hasraw - 'Generated doc comment' pub use some_macros::second_attr; diff --git a/src/test/rustdoc/inline_cross/trait-vis.rs b/src/test/rustdoc/inline_cross/trait-vis.rs index 363c52a33..b646babac 100644 --- a/src/test/rustdoc/inline_cross/trait-vis.rs +++ b/src/test/rustdoc/inline_cross/trait-vis.rs @@ -3,5 +3,5 @@ extern crate inner; // @has trait_vis/struct.SomeStruct.html -// @has - '//h3[@class="code-header in-band"]' 'impl Clone for SomeStruct' +// @has - '//h3[@class="code-header"]' 'impl Clone for SomeStruct' pub use inner::SomeStruct; diff --git a/src/test/rustdoc/inline_local/glob-extern-document-private-items.rs b/src/test/rustdoc/inline_local/glob-extern-document-private-items.rs index a2f0d65ef..8e1089d60 100644 --- a/src/test/rustdoc/inline_local/glob-extern-document-private-items.rs +++ b/src/test/rustdoc/inline_local/glob-extern-document-private-items.rs @@ -12,14 +12,14 @@ mod mod1 { pub use mod1::*; // @has foo/index.html -// @has - "mod1" -// @has - "public_fn" -// @!has - "private_fn" +// @hasraw - "mod1" +// @hasraw - "public_fn" +// @!hasraw - "private_fn" // @has foo/fn.public_fn.html // @!has foo/fn.private_fn.html // @has foo/mod1/index.html -// @has - "public_fn" -// @has - "private_fn" +// @hasraw - "public_fn" +// @hasraw - "private_fn" // @has foo/mod1/fn.public_fn.html // @has foo/mod1/fn.private_fn.html diff --git a/src/test/rustdoc/inline_local/glob-extern.rs b/src/test/rustdoc/inline_local/glob-extern.rs index 686e55de3..c592a4db1 100644 --- a/src/test/rustdoc/inline_local/glob-extern.rs +++ b/src/test/rustdoc/inline_local/glob-extern.rs @@ -10,9 +10,9 @@ mod mod1 { pub use mod1::*; // @has foo/index.html -// @!has - "mod1" -// @has - "public_fn" -// @!has - "private_fn" +// @!hasraw - "mod1" +// @hasraw - "public_fn" +// @!hasraw - "private_fn" // @has foo/fn.public_fn.html // @!has foo/fn.private_fn.html diff --git a/src/test/rustdoc/inline_local/glob-private-document-private-items.rs b/src/test/rustdoc/inline_local/glob-private-document-private-items.rs index f16d21ecd..d8cbd4234 100644 --- a/src/test/rustdoc/inline_local/glob-private-document-private-items.rs +++ b/src/test/rustdoc/inline_local/glob-private-document-private-items.rs @@ -15,31 +15,31 @@ mod mod1 { pub use mod1::*; // @has foo/index.html -// @has - "mod1" -// @has - "Mod1Public" -// @!has - "Mod1Private" -// @!has - "mod2" -// @has - "Mod2Public" -// @!has - "Mod2Private" +// @hasraw - "mod1" +// @hasraw - "Mod1Public" +// @!hasraw - "Mod1Private" +// @!hasraw - "mod2" +// @hasraw - "Mod2Public" +// @!hasraw - "Mod2Private" // @has foo/struct.Mod1Public.html // @!has foo/struct.Mod1Private.html // @has foo/struct.Mod2Public.html // @!has foo/struct.Mod2Private.html // @has foo/mod1/index.html -// @has - "mod2" -// @has - "Mod1Public" -// @has - "Mod1Private" -// @!has - "Mod2Public" -// @!has - "Mod2Private" +// @hasraw - "mod2" +// @hasraw - "Mod1Public" +// @hasraw - "Mod1Private" +// @!hasraw - "Mod2Public" +// @!hasraw - "Mod2Private" // @has foo/mod1/struct.Mod1Public.html // @has foo/mod1/struct.Mod1Private.html // @!has foo/mod1/struct.Mod2Public.html // @!has foo/mod1/struct.Mod2Private.html // @has foo/mod1/mod2/index.html -// @has - "Mod2Public" -// @has - "Mod2Private" +// @hasraw - "Mod2Public" +// @hasraw - "Mod2Private" // @has foo/mod1/mod2/struct.Mod2Public.html // @has foo/mod1/mod2/struct.Mod2Private.html diff --git a/src/test/rustdoc/inline_local/glob-private.rs b/src/test/rustdoc/inline_local/glob-private.rs index d294d590e..303f1d610 100644 --- a/src/test/rustdoc/inline_local/glob-private.rs +++ b/src/test/rustdoc/inline_local/glob-private.rs @@ -13,12 +13,12 @@ mod mod1 { pub use mod1::*; // @has foo/index.html -// @!has - "mod1" -// @has - "Mod1Public" -// @!has - "Mod1Private" -// @!has - "mod2" -// @has - "Mod2Public" -// @!has - "Mod2Private" +// @!hasraw - "mod1" +// @hasraw - "Mod1Public" +// @!hasraw - "Mod1Private" +// @!hasraw - "mod2" +// @hasraw - "Mod2Public" +// @!hasraw - "Mod2Private" // @has foo/struct.Mod1Public.html // @!has foo/struct.Mod1Private.html // @has foo/struct.Mod2Public.html diff --git a/src/test/rustdoc/inline_local/hidden-use.rs b/src/test/rustdoc/inline_local/hidden-use.rs index a972d376a..de512fb26 100644 --- a/src/test/rustdoc/inline_local/hidden-use.rs +++ b/src/test/rustdoc/inline_local/hidden-use.rs @@ -3,8 +3,8 @@ mod private { } // @has hidden_use/index.html -// @!has - 'private' -// @!has - 'Foo' +// @!hasraw - 'private' +// @!hasraw - 'Foo' // @!has hidden_use/struct.Foo.html #[doc(hidden)] pub use private::Foo; diff --git a/src/test/rustdoc/inline_local/macro_by_example.rs b/src/test/rustdoc/inline_local/macro_by_example.rs index dacc7cfb3..5c33c0037 100644 --- a/src/test/rustdoc/inline_local/macro_by_example.rs +++ b/src/test/rustdoc/inline_local/macro_by_example.rs @@ -7,7 +7,7 @@ macro_rules! foo { // @has macro_by_example/macros/index.html pub mod macros { - // @!has - 'pub use foo as bar;' + // @!hasraw - 'pub use foo as bar;' // @has macro_by_example/macros/macro.bar.html // @has - '//*[@class="docblock"]' 'docs for foo' // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.2.3: text' diff --git a/src/test/rustdoc/inline_local/please_inline.rs b/src/test/rustdoc/inline_local/please_inline.rs index 48539361f..e4429ef33 100644 --- a/src/test/rustdoc/inline_local/please_inline.rs +++ b/src/test/rustdoc/inline_local/please_inline.rs @@ -4,7 +4,7 @@ pub mod foo { // @has please_inline/a/index.html pub mod a { - // @!has - 'pub use foo::' + // @!hasraw - 'pub use foo::' // @has please_inline/a/struct.Foo.html #[doc(inline)] pub use foo::Foo; @@ -12,7 +12,7 @@ pub mod a { // @has please_inline/b/index.html pub mod b { - // @has - 'pub use foo::' + // @hasraw - 'pub use foo::' // @!has please_inline/b/struct.Foo.html #[feature(inline)] pub use foo::Foo; diff --git a/src/test/rustdoc/inline_local/trait-vis.rs b/src/test/rustdoc/inline_local/trait-vis.rs index e7b08088f..19b69da15 100644 --- a/src/test/rustdoc/inline_local/trait-vis.rs +++ b/src/test/rustdoc/inline_local/trait-vis.rs @@ -13,6 +13,6 @@ mod asdf { } // @has trait_vis/struct.SomeStruct.html -// @has - '//h3[@class="code-header in-band"]' 'impl ThisTrait for SomeStruct' -// @!has - '//h3[@class="code-header in-band"]' 'impl PrivateTrait for SomeStruct' +// @has - '//h3[@class="code-header"]' 'impl ThisTrait for SomeStruct' +// @!has - '//h3[@class="code-header"]' 'impl PrivateTrait for SomeStruct' pub use asdf::SomeStruct; diff --git a/src/test/rustdoc/internal.rs b/src/test/rustdoc/internal.rs index f316eb24a..caad43a08 100644 --- a/src/test/rustdoc/internal.rs +++ b/src/test/rustdoc/internal.rs @@ -3,13 +3,15 @@ // Check that the unstable marker is not added for "rustc_private". // @!matches internal/index.html \ -// '//*[@class="item-right docblock-short"]/span[@class="stab unstable"]' +// '//*[@class="item-right docblock-short"]/span[@class="stab unstable"]' \ +// '' // @!matches internal/index.html \ -// '//*[@class="item-right docblock-short"]/span[@class="stab internal"]' +// '//*[@class="item-right docblock-short"]/span[@class="stab internal"]' \ +// '' // @matches - '//*[@class="item-right docblock-short"]' 'Docs' -// @!has internal/struct.S.html '//*[@class="stab unstable"]' -// @!has internal/struct.S.html '//*[@class="stab internal"]' +// @!has internal/struct.S.html '//*[@class="stab unstable"]' '' +// @!has internal/struct.S.html '//*[@class="stab internal"]' '' /// Docs pub struct S; diff --git a/src/test/rustdoc/intra-doc/assoc-reexport-super.rs b/src/test/rustdoc/intra-doc/assoc-reexport-super.rs new file mode 100644 index 000000000..a7bc1c6a2 --- /dev/null +++ b/src/test/rustdoc/intra-doc/assoc-reexport-super.rs @@ -0,0 +1,20 @@ +// Regression test for #93205 + +#![crate_name = "foo"] + +mod generated { + pub struct MyNewType; + impl MyNewType { + pub const FOO: Self = Self; + } +} + +pub use generated::MyNewType; + +mod prelude { + impl super::MyNewType { + /// An alias for [`Self::FOO`]. + // @has 'foo/struct.MyNewType.html' '//a[@href="struct.MyNewType.html#associatedconstant.FOO"]' 'Self::FOO' + pub const FOO2: Self = Self::FOO; + } +} diff --git a/src/test/rustdoc/intra-doc/auxiliary/issue-103463-aux.rs b/src/test/rustdoc/intra-doc/auxiliary/issue-103463-aux.rs new file mode 100644 index 000000000..2b8fdec1f --- /dev/null +++ b/src/test/rustdoc/intra-doc/auxiliary/issue-103463-aux.rs @@ -0,0 +1,4 @@ +pub trait Trait { + /// [`u8::clone`] + fn method(); +} diff --git a/src/test/rustdoc/intra-doc/extern-crate-only-used-in-link.rs b/src/test/rustdoc/intra-doc/extern-crate-only-used-in-link.rs index 5d8dcf8bc..ad50887e9 100644 --- a/src/test/rustdoc/intra-doc/extern-crate-only-used-in-link.rs +++ b/src/test/rustdoc/intra-doc/extern-crate-only-used-in-link.rs @@ -16,4 +16,4 @@ //! [`empty`] // @has - '//a[@href="../empty2/index.html"]' 'empty2' -//! [empty2<x>] +//! [`empty2<x>`] diff --git a/src/test/rustdoc/intra-doc/extern-type.rs b/src/test/rustdoc/intra-doc/extern-type.rs index ab088ab78..5440f582d 100644 --- a/src/test/rustdoc/intra-doc/extern-type.rs +++ b/src/test/rustdoc/intra-doc/extern-type.rs @@ -25,11 +25,11 @@ impl G<usize> for ExternType { } // @has 'extern_type/foreigntype.ExternType.html' -// @has 'extern_type/fn.links_to_extern_type.html' \ +// @hasraw 'extern_type/fn.links_to_extern_type.html' \ // 'href="foreigntype.ExternType.html#method.f"' -// @has 'extern_type/fn.links_to_extern_type.html' \ +// @hasraw 'extern_type/fn.links_to_extern_type.html' \ // 'href="foreigntype.ExternType.html#method.test"' -// @has 'extern_type/fn.links_to_extern_type.html' \ +// @hasraw 'extern_type/fn.links_to_extern_type.html' \ // 'href="foreigntype.ExternType.html#method.g"' /// See also [ExternType::f] /// See also [ExternType::test] diff --git a/src/test/rustdoc/intra-doc/issue-103463.rs b/src/test/rustdoc/intra-doc/issue-103463.rs new file mode 100644 index 000000000..4adf8a9a8 --- /dev/null +++ b/src/test/rustdoc/intra-doc/issue-103463.rs @@ -0,0 +1,8 @@ +// The `Trait` is not pulled into the crate resulting in doc links in its methods being resolved. + +// aux-build:issue-103463-aux.rs + +extern crate issue_103463_aux; +use issue_103463_aux::Trait; + +fn main() {} diff --git a/src/test/rustdoc/intra-doc/issue-104145.rs b/src/test/rustdoc/intra-doc/issue-104145.rs new file mode 100644 index 000000000..9ce36740d --- /dev/null +++ b/src/test/rustdoc/intra-doc/issue-104145.rs @@ -0,0 +1,14 @@ +// Doc links in `Trait`'s methods are resolved because it has a local impl. + +// aux-build:issue-103463-aux.rs + +extern crate issue_103463_aux; +use issue_103463_aux::Trait; + +pub struct LocalType; + +impl Trait for LocalType { + fn method() {} +} + +fn main() {} diff --git a/src/test/rustdoc/intra-doc/no-doc-primitive.rs b/src/test/rustdoc/intra-doc/no-doc-primitive.rs new file mode 100644 index 000000000..e5eba1d8d --- /dev/null +++ b/src/test/rustdoc/intra-doc/no-doc-primitive.rs @@ -0,0 +1,15 @@ +// Crate tree without a `doc(primitive)` module for primitive type linked to by a doc link. + +#![deny(rustdoc::broken_intra_doc_links)] +#![feature(no_core, lang_items, rustc_attrs)] +#![no_core] +#![rustc_coherence_is_core] +#![crate_type = "rlib"] + +// @has no_doc_primitive/index.html +//! A [`char`] and its [`char::len_utf8`]. +impl char { + pub fn len_utf8(self) -> usize { + 42 + } +} diff --git a/src/test/rustdoc/issue-100241.rs b/src/test/rustdoc/issue-100241.rs new file mode 100644 index 000000000..9e9cba13a --- /dev/null +++ b/src/test/rustdoc/issue-100241.rs @@ -0,0 +1,12 @@ +//! See [`S`]. + +// Check that this isn't an ICE +// should-fail + +mod foo { + pub use inner::S; + //~^ ERROR unresolved imports `inner`, `foo::S` +} + +use foo::*; +use foo::S; diff --git a/src/test/rustdoc/issue-100620.rs b/src/test/rustdoc/issue-100620.rs new file mode 100644 index 000000000..097666eb5 --- /dev/null +++ b/src/test/rustdoc/issue-100620.rs @@ -0,0 +1,19 @@ +pub trait Bar<S> {} + +pub trait Qux<T> {} + +pub trait Foo<T, S> { + fn bar() + where + T: Bar<S>, + { + } +} + +pub struct Concrete; + +impl<S> Foo<(), S> for Concrete {} + +impl<T, S> Bar<S> for T where S: Qux<T> {} + +impl<T, S> Qux<T> for S where T: Bar<S> {} diff --git a/src/test/rustdoc/issue-100679-sidebar-links-deref.rs b/src/test/rustdoc/issue-100679-sidebar-links-deref.rs new file mode 100644 index 000000000..f09d23206 --- /dev/null +++ b/src/test/rustdoc/issue-100679-sidebar-links-deref.rs @@ -0,0 +1,30 @@ +#![crate_name="foo"] + +pub struct Vec; + +pub struct Slice; + +impl std::ops::Deref for Vec { + type Target = Slice; + fn deref(&self) -> &Slice { + &Slice + } +} + +// @has foo/struct.Vec.html '//*[@class="sidebar-elems"]//section//li/a[@href="#method.is_empty"]' \ +// "is_empty" +impl Vec { + pub fn is_empty(&self) -> bool { + true + } +} + +// @has foo/struct.Vec.html '//*[@class="sidebar-elems"]//section//li/a[@href="#method.is_empty-1"]' \ +// "is_empty" +// @has foo/struct.Slice.html '//*[@class="sidebar-elems"]//section//li/a[@href="#method.is_empty"]' \ +// "is_empty" +impl Slice { + pub fn is_empty(&self) -> bool { + true + } +} diff --git a/src/test/rustdoc/issue-101743-bold-tag.rs b/src/test/rustdoc/issue-101743-bold-tag.rs new file mode 100644 index 000000000..631181fec --- /dev/null +++ b/src/test/rustdoc/issue-101743-bold-tag.rs @@ -0,0 +1,19 @@ +// Regression test for https://github.com/rust-lang/rust/issues/101743 + +#![crate_name="foo"] + +pub type Word = usize; +pub struct Repr<const B: usize>([i32; B]); +pub struct IBig(usize); + +pub const fn base_as_ibig<const B: Word>() -> IBig { + IBig(B) +} + +impl<const B: Word> Repr<B> { + // If we change back to rendering the value of consts, check this doesn't add + // a <b> tag, but escapes correctly + + // @has foo/struct.Repr.html '//section[@id="associatedconstant.BASE"]/h4' '= _' + pub const BASE: IBig = base_as_ibig::<B>(); +} diff --git a/src/test/rustdoc/issue-16265-1.rs b/src/test/rustdoc/issue-16265-1.rs index ec007e36b..2fda637a6 100644 --- a/src/test/rustdoc/issue-16265-1.rs +++ b/src/test/rustdoc/issue-16265-1.rs @@ -1,6 +1,6 @@ pub struct Foo; -// @has issue_16265_1/traits/index.html 'source' +// @hasraw issue_16265_1/traits/index.html 'source' pub mod traits { impl PartialEq for super::Foo { fn eq(&self, _: &super::Foo) -> bool { diff --git a/src/test/rustdoc/issue-16265-2.rs b/src/test/rustdoc/issue-16265-2.rs index d5cd18d9d..c3eb35617 100644 --- a/src/test/rustdoc/issue-16265-2.rs +++ b/src/test/rustdoc/issue-16265-2.rs @@ -1,4 +1,4 @@ -// @has issue_16265_2/index.html 'source' +// @hasraw issue_16265_2/index.html 'source' trait Y {} impl Y for Option<u32> {} diff --git a/src/test/rustdoc/issue-20727-4.rs b/src/test/rustdoc/issue-20727-4.rs index 84fc6f94a..643f93875 100644 --- a/src/test/rustdoc/issue-20727-4.rs +++ b/src/test/rustdoc/issue-20727-4.rs @@ -25,7 +25,7 @@ pub trait IndexMut<Idx: ?Sized>: Index<Idx> { pub mod reexport { // @has issue_20727_4/reexport/trait.Index.html - // @has - '//*[@class="rust trait"]' 'trait Index<Idx> where Idx: ?Sized, {' + // @has - '//*[@class="rust trait"]' 'trait Index<Idx>where Idx: ?Sized,{' // @has - '//*[@class="rust trait"]' 'type Output: ?Sized' // @has - '//*[@class="rust trait"]' \ // 'fn index(&self, index: Idx) -> &Self::Output' @@ -33,7 +33,7 @@ pub mod reexport { // @has issue_20727_4/reexport/trait.IndexMut.html // @has - '//*[@class="rust trait"]' \ - // 'trait IndexMut<Idx>: Index<Idx> where Idx: ?Sized, {' + // 'trait IndexMut<Idx>: Index<Idx>where Idx: ?Sized,{' // @has - '//*[@class="rust trait"]' \ // 'fn index_mut(&mut self, index: Idx) -> &mut Self::Output;' pub use issue_20727::IndexMut; diff --git a/src/test/rustdoc/issue-21801.rs b/src/test/rustdoc/issue-21801.rs index 2a586b6ff..29d2ec64c 100644 --- a/src/test/rustdoc/issue-21801.rs +++ b/src/test/rustdoc/issue-21801.rs @@ -5,5 +5,5 @@ extern crate issue_21801; // @has issue_21801/struct.Foo.html // @has - '//*[@id="method.new"]' \ -// 'fn new<F>(f: F) -> Foo where F: FnMut() -> i32' +// 'fn new<F>(f: F) -> Foowhere F: FnMut() -> i32' pub use issue_21801::Foo; diff --git a/src/test/rustdoc/issue-23511.rs b/src/test/rustdoc/issue-23511.rs index 2d2a7908f..7576ebb03 100644 --- a/src/test/rustdoc/issue-23511.rs +++ b/src/test/rustdoc/issue-23511.rs @@ -6,7 +6,7 @@ pub mod str { #![doc(primitive = "str")] impl str { - // @has search-index.js foo + // @hasraw search-index.js foo #[rustc_allow_incoherent_impl] pub fn foo(&self) {} } diff --git a/src/test/rustdoc/issue-23812.rs b/src/test/rustdoc/issue-23812.rs index 5dac8d87b..08fd1833b 100644 --- a/src/test/rustdoc/issue-23812.rs +++ b/src/test/rustdoc/issue-23812.rs @@ -16,10 +16,10 @@ doc! { } // @has issue_23812/Foo/index.html -// @has - 'Outer comment' -// @!has - '/// Outer comment' -// @has - 'Inner comment' -// @!has - '//! Inner comment' +// @hasraw - 'Outer comment' +// @!hasraw - '/// Outer comment' +// @hasraw - 'Inner comment' +// @!hasraw - '//! Inner comment' doc! { @@ -30,7 +30,7 @@ doc! { } // @has issue_23812/Bar/index.html -// @has - 'Outer block comment' -// @!has - '/** Outer block comment */' -// @has - 'Inner block comment' -// @!has - '/*! Inner block comment */' +// @hasraw - 'Outer block comment' +// @!hasraw - '/** Outer block comment */' +// @hasraw - 'Inner block comment' +// @!hasraw - '/*! Inner block comment */' diff --git a/src/test/rustdoc/issue-27104.rs b/src/test/rustdoc/issue-27104.rs index b74c3eb78..9f2fd9071 100644 --- a/src/test/rustdoc/issue-27104.rs +++ b/src/test/rustdoc/issue-27104.rs @@ -3,8 +3,8 @@ // ignore-cross-compile // @has issue_27104/index.html -// @!has - 'extern crate std' -// @!has - 'use std::prelude::' +// @!hasraw - 'extern crate std' +// @!hasraw - 'use std::prelude::' -// @has - 'pub extern crate empty' +// @hasraw - 'pub extern crate empty' pub extern crate empty; diff --git a/src/test/rustdoc/issue-27759.rs b/src/test/rustdoc/issue-27759.rs index f3739dafd..65e0f7cb8 100644 --- a/src/test/rustdoc/issue-27759.rs +++ b/src/test/rustdoc/issue-27759.rs @@ -4,11 +4,11 @@ #![unstable(feature="test", issue="27759")] // @has issue_27759/unstable/index.html -// @has - '<code>test</code> <a href="http://issue_url/27759">#27759</a>' +// @hasraw - '<code>test</code> <a href="http://issue_url/27759">#27759</a>' #[unstable(feature="test", issue="27759")] pub mod unstable { // @has issue_27759/unstable/fn.issue.html - // @has - '<code>test_function</code> <a href="http://issue_url/12345">#12345</a>' + // @hasraw - '<code>test_function</code> <a href="http://issue_url/12345">#12345</a>' #[unstable(feature="test_function", issue="12345")] pub fn issue() {} } diff --git a/src/test/rustdoc/issue-29503.rs b/src/test/rustdoc/issue-29503.rs index 635c3175f..01ae44385 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']//*[@id='impl-MyTrait-for-T']//h3[@class='code-header in-band']" "impl<T> MyTrait for T where T: Debug" +// @has - "//div[@id='implementors-list']//*[@id='impl-MyTrait-for-T']//h3[@class='code-header']" "impl<T> MyTrait for Twhere T: Debug" impl<T> MyTrait for T where T: fmt::Debug, diff --git a/src/test/rustdoc/issue-29584.rs b/src/test/rustdoc/issue-29584.rs index 28e1efec6..4364a9649 100644 --- a/src/test/rustdoc/issue-29584.rs +++ b/src/test/rustdoc/issue-29584.rs @@ -4,5 +4,5 @@ extern crate issue_29584; // @has issue_29584/struct.Foo.html -// @!has - 'impl Bar for' +// @!hasraw - 'impl Bar for' pub use issue_29584::Foo; diff --git a/src/test/rustdoc/issue-31899.rs b/src/test/rustdoc/issue-31899.rs index e7a8ee239..3eee37446 100644 --- a/src/test/rustdoc/issue-31899.rs +++ b/src/test/rustdoc/issue-31899.rs @@ -1,8 +1,8 @@ // @has issue_31899/index.html -// @has - 'Make this line a bit longer.' -// @!has - 'rust rust-example-rendered' -// @!has - 'use ndarray::arr2' -// @!has - 'prohibited' +// @hasraw - 'Make this line a bit longer.' +// @!hasraw - 'rust rust-example-rendered' +// @!hasraw - 'use ndarray::arr2' +// @!hasraw - 'prohibited' /// A tuple or fixed size array that can be used to index an array. /// Make this line a bit longer. diff --git a/src/test/rustdoc/issue-32374.rs b/src/test/rustdoc/issue-32374.rs index 01f955381..8d2c27cf3 100644 --- a/src/test/rustdoc/issue-32374.rs +++ b/src/test/rustdoc/issue-32374.rs @@ -8,20 +8,24 @@ // 'Experimental' // @matches issue_32374/index.html '//*[@class="item-right docblock-short"]/text()' 'Docs' -// @has issue_32374/struct.T.html '//*[@class="stab deprecated"]' \ -// '๐ Deprecated since 1.0.0: text' -// @has - '<code>test</code> <a href="https://issue_url/32374">#32374</a>' +// @has issue_32374/struct.T.html '//*[@class="stab deprecated"]/span' '๐' +// @has issue_32374/struct.T.html '//*[@class="stab deprecated"]/span' \ +// 'Deprecated since 1.0.0: text' +// @hasraw - '<code>test</code> <a href="https://issue_url/32374">#32374</a>' +// @matches issue_32374/struct.T.html '//*[@class="stab unstable"]' '๐ฌ' // @matches issue_32374/struct.T.html '//*[@class="stab unstable"]' \ -// '๐ฌ This is a nightly-only experimental API. \(test\s#32374\)$' +// 'This is a nightly-only experimental API. \(test\s#32374\)$' /// Docs #[deprecated(since = "1.0.0", note = "text")] #[unstable(feature = "test", issue = "32374")] pub struct T; +// @has issue_32374/struct.U.html '//*[@class="stab deprecated"]' '๐' // @has issue_32374/struct.U.html '//*[@class="stab deprecated"]' \ -// '๐ Deprecated since 1.0.0: deprecated' +// 'Deprecated since 1.0.0: deprecated' +// @has issue_32374/struct.U.html '//*[@class="stab unstable"]' '๐ฌ' // @has issue_32374/struct.U.html '//*[@class="stab unstable"]' \ -// '๐ฌ This is a nightly-only experimental API. (test #32374)' +// 'This is a nightly-only experimental API. (test #32374)' #[deprecated(since = "1.0.0", note = "deprecated")] #[unstable(feature = "test", issue = "32374", reason = "unstable")] pub struct U; diff --git a/src/test/rustdoc/issue-32395.rs b/src/test/rustdoc/issue-32395.rs index 13468c153..5552300f9 100644 --- a/src/test/rustdoc/issue-32395.rs +++ b/src/test/rustdoc/issue-32395.rs @@ -3,13 +3,13 @@ // ignore-cross-compile // @has variant_struct/enum.Foo.html -// @!has - 'pub qux' -// @!has - 'pub(crate) qux' -// @!has - 'pub Bar' +// @!hasraw - 'pub qux' +// @!hasraw - 'pub(crate) qux' +// @!hasraw - 'pub Bar' extern crate variant_struct; // @has issue_32395/enum.Foo.html -// @!has - 'pub qux' -// @!has - 'pub(crate) qux' -// @!has - 'pub Bar' +// @!hasraw - 'pub qux' +// @!hasraw - 'pub(crate) qux' +// @!hasraw - 'pub Bar' pub use variant_struct::Foo; diff --git a/src/test/rustdoc/issue-33592.rs b/src/test/rustdoc/issue-33592.rs index 815439db9..7a128f0b8 100644 --- a/src/test/rustdoc/issue-33592.rs +++ b/src/test/rustdoc/issue-33592.rs @@ -6,8 +6,8 @@ pub struct Bar; pub struct Baz; -// @has foo/trait.Foo.html '//h3[@class="code-header in-band"]' 'impl Foo<i32> for Bar' +// @has foo/trait.Foo.html '//h3[@class="code-header"]' 'impl Foo<i32> for Bar' impl Foo<i32> for Bar {} -// @has foo/trait.Foo.html '//h3[@class="code-header in-band"]' 'impl<T> Foo<T> for Baz' +// @has foo/trait.Foo.html '//h3[@class="code-header"]' 'impl<T> Foo<T> for Baz' impl<T> Foo<T> for Baz {} diff --git a/src/test/rustdoc/issue-34473.rs b/src/test/rustdoc/issue-34473.rs index d96301f3a..37da3dd19 100644 --- a/src/test/rustdoc/issue-34473.rs +++ b/src/test/rustdoc/issue-34473.rs @@ -5,7 +5,7 @@ mod second { } // @has foo/index.html -// @!has - SomeTypeWithLongName +// @!hasraw - SomeTypeWithLongName // @has foo/struct.SomeType.html // @!has foo/struct.SomeTypeWithLongName.html pub use second::{SomeTypeWithLongName as SomeType}; diff --git a/src/test/rustdoc/issue-34928.rs b/src/test/rustdoc/issue-34928.rs index 4184086f6..91b677574 100644 --- a/src/test/rustdoc/issue-34928.rs +++ b/src/test/rustdoc/issue-34928.rs @@ -2,5 +2,5 @@ pub trait Bar {} -// @has foo/struct.Foo.html '//pre' 'pub struct Foo<T>(pub T) where T: Bar;' +// @has foo/struct.Foo.html '//pre' 'pub struct Foo<T>(pub T)where T: Bar;' pub struct Foo<T>(pub T) where T: Bar; diff --git a/src/test/rustdoc/issue-41783.codeblock.html b/src/test/rustdoc/issue-41783.codeblock.html new file mode 100644 index 000000000..89987491d --- /dev/null +++ b/src/test/rustdoc/issue-41783.codeblock.html @@ -0,0 +1,5 @@ +<code># single +## double +### triple +<span class="attribute">#[outer] +#![inner]</span></code> diff --git a/src/test/rustdoc/issue-41783.rs b/src/test/rustdoc/issue-41783.rs index cb9b9b153..87267a750 100644 --- a/src/test/rustdoc/issue-41783.rs +++ b/src/test/rustdoc/issue-41783.rs @@ -1,11 +1,11 @@ // @has issue_41783/struct.Foo.html -// @!has - 'space' -// @!has - 'comment' -// @has - '# <span class="ident">single' -// @has - '## <span class="ident">double</span>' -// @has - '### <span class="ident">triple</span>' -// @has - '<span class="attribute">#[<span class="ident">outer</span>]</span>' -// @has - '<span class="attribute">#![<span class="ident">inner</span>]</span>' +// @!hasraw - 'space' +// @!hasraw - 'comment' +// @hasraw - '<span class="attribute">#[outer]' +// @!hasraw - '<span class="attribute">#[outer]</span>' +// @hasraw - '#![inner]</span>' +// @!hasraw - '<span class="attribute">#![inner]</span>' +// @snapshot 'codeblock' - '//*[@class="rustdoc-toggle top-doc"]/*[@class="docblock"]//pre/code' /// ```no_run /// # # space diff --git a/src/test/rustdoc/issue-46727.rs b/src/test/rustdoc/issue-46727.rs index 00e9127a3..8cfc4827a 100644 --- a/src/test/rustdoc/issue-46727.rs +++ b/src/test/rustdoc/issue-46727.rs @@ -3,5 +3,5 @@ extern crate issue_46727; // @has issue_46727/trait.Foo.html -// @has - '//h3[@class="code-header in-band"]' 'impl<T> Foo for Bar<[T; 3]>' +// @has - '//h3[@class="code-header"]' 'impl<T> 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 d88c29217..04bc4f304 100644 --- a/src/test/rustdoc/issue-50159.rs +++ b/src/test/rustdoc/issue-50159.rs @@ -11,8 +11,8 @@ impl<B, C> Signal2 for B where B: Signal<Item = C> { } // @has issue_50159/struct.Switch.html -// @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' +// @has - '//h3[@class="code-header"]' 'impl<B> Send for Switch<B>where <B as Signal>::Item: Send' +// @has - '//h3[@class="code-header"]' '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> { diff --git a/src/test/rustdoc/issue-51236.rs b/src/test/rustdoc/issue-51236.rs index ee11ccc68..1c7aa9c7e 100644 --- a/src/test/rustdoc/issue-51236.rs +++ b/src/test/rustdoc/issue-51236.rs @@ -7,8 +7,8 @@ pub mod traits { } // @has issue_51236/struct.Owned.html -// @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" +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// "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>, } diff --git a/src/test/rustdoc/issue-53689.rs b/src/test/rustdoc/issue-53689.rs index 52ce4159d..832140e06 100644 --- a/src/test/rustdoc/issue-53689.rs +++ b/src/test/rustdoc/issue-53689.rs @@ -5,7 +5,7 @@ extern crate issue_53689; // @has foo/trait.MyTrait.html -// @!has - 'MyStruct' +// @!hasraw - 'MyStruct' // @count - '//*[h3="impl<T> MyTrait for T"]' 1 pub trait MyTrait {} diff --git a/src/test/rustdoc/issue-54705.rs b/src/test/rustdoc/issue-54705.rs index bedaf5c4d..7b7290ab4 100644 --- a/src/test/rustdoc/issue-54705.rs +++ b/src/test/rustdoc/issue-54705.rs @@ -1,13 +1,11 @@ pub trait ScopeHandle<'scope> {} - - // @has issue_54705/struct.ScopeFutureContents.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ -// "impl<'scope, S> Send for ScopeFutureContents<'scope, S> where S: Sync" +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// "impl<'scope, S> Send for ScopeFutureContents<'scope, S>where S: Sync" // -// @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" +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// "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 ee2420d86..22a18ef90 100644 --- a/src/test/rustdoc/issue-55321.rs +++ b/src/test/rustdoc/issue-55321.rs @@ -1,9 +1,9 @@ #![feature(negative_impls)] // @has issue_55321/struct.A.html -// @has - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ +// @has - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ // "impl !Send for A" -// @has - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ +// @has - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ // "impl !Sync for A" pub struct A(); @@ -11,8 +11,8 @@ impl !Send for A {} impl !Sync for A {} // @has issue_55321/struct.B.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ // "impl<T> !Send for B<T>" -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ // "impl<T> !Sync for B<T>" pub struct B<T: ?Sized>(A, Box<T>); diff --git a/src/test/rustdoc/issue-56822.rs b/src/test/rustdoc/issue-56822.rs index aef6ddd8d..b4eef344b 100644 --- a/src/test/rustdoc/issue-56822.rs +++ b/src/test/rustdoc/issue-56822.rs @@ -17,7 +17,7 @@ impl<'a, T> MyTrait for Inner<'a, T> { } // @has issue_56822/struct.Parser.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ // "impl<'a> Send for Parser<'a>" pub struct Parser<'a> { field: <Wrapper<Inner<'a, u8>> as MyTrait>::Output diff --git a/src/test/rustdoc/issue-60726.rs b/src/test/rustdoc/issue-60726.rs index 167f0f039..fbb0f82ae 100644 --- a/src/test/rustdoc/issue-60726.rs +++ b/src/test/rustdoc/issue-60726.rs @@ -26,9 +26,9 @@ where {} // @has issue_60726/struct.IntoIter.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ // "impl<T> !Send for IntoIter<T>" -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ // "impl<T> !Sync for IntoIter<T>" pub struct IntoIter<T>{ hello:DynTrait<FooInterface<T>>, diff --git a/src/test/rustdoc/issue-61592.rs b/src/test/rustdoc/issue-61592.rs index aef038c07..4b6c37b94 100644 --- a/src/test/rustdoc/issue-61592.rs +++ b/src/test/rustdoc/issue-61592.rs @@ -5,11 +5,11 @@ extern crate foo; // @has issue_61592/index.html // @has - '//a[@href="#reexports"]' 'Re-exports' // @has - '//code' 'pub use foo::FooTrait as _;' -// @!has - '//a[@href="trait._.html"]' +// @!has - '//a[@href="trait._.html"]' '' pub use foo::FooTrait as _; // @has issue_61592/index.html // @has - '//a[@href="#reexports"]' 'Re-exports' // @has - '//code' 'pub use foo::FooStruct as _;' -// @!has - '//a[@href="struct._.html"]' +// @!has - '//a[@href="struct._.html"]' '' pub use foo::FooStruct as _; diff --git a/src/test/rustdoc/issue-75588.rs b/src/test/rustdoc/issue-75588.rs index ac97b94fb..3b11059a7 100644 --- a/src/test/rustdoc/issue-75588.rs +++ b/src/test/rustdoc/issue-75588.rs @@ -10,8 +10,8 @@ extern crate realcore; extern crate real_gimli; // issue #74672 -// @!has foo/trait.Deref.html '//*[@id="impl-Deref-for-EndianSlice"]//h3[@class="code-header in-band"]' 'impl Deref for EndianSlice' +// @!has foo/trait.Deref.html '//*[@id="impl-Deref-for-EndianSlice"]//h3[@class="code-header"]' 'impl Deref for EndianSlice' pub use realcore::Deref; -// @has foo/trait.Join.html '//*[@id="impl-Join-for-Foo"]//h3[@class="code-header in-band"]' 'impl Join for Foo' +// @has foo/trait.Join.html '//*[@id="impl-Join-for-Foo"]//h3[@class="code-header"]' '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 515e617b4..62fbc2444 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<T: Trait3> Trait3 for Vec<T> { pub struct Struct1 {} // @has issue_80233_normalize_auto_trait/struct.Question.html -// @has - '//h3[@class="code-header in-band"]' 'impl<T> Send for Question<T>' +// @has - '//h3[@class="code-header"]' 'impl<T> Send for Question<T>' pub struct Question<T: Trait1> { pub ins: <<Vec<T> 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 8999e6a88..adf4d111a 100644 --- a/src/test/rustdoc/issue-82465-asref-for-and-of-local.rs +++ b/src/test/rustdoc/issue-82465-asref-for-and-of-local.rs @@ -1,14 +1,14 @@ use std::convert::AsRef; pub struct Local; -// @has issue_82465_asref_for_and_of_local/struct.Local.html '//h3[@class="code-header in-band"]' 'impl AsRef<str> for Local' +// @has issue_82465_asref_for_and_of_local/struct.Local.html '//h3[@class="code-header"]' 'impl AsRef<str> for Local' impl AsRef<str> for Local { fn as_ref(&self) -> &str { todo!() } } -// @has - '//h3[@class="code-header in-band"]' 'impl AsRef<Local> for str' +// @has - '//h3[@class="code-header"]' 'impl AsRef<Local> for str' impl AsRef<Local> for str { fn as_ref(&self) -> &Local { todo!() diff --git a/src/test/rustdoc/issue-83375-multiple-mods-w-same-name-doc-inline-last-item.rs b/src/test/rustdoc/issue-83375-multiple-mods-w-same-name-doc-inline-last-item.rs new file mode 100644 index 000000000..d3a7a870b --- /dev/null +++ b/src/test/rustdoc/issue-83375-multiple-mods-w-same-name-doc-inline-last-item.rs @@ -0,0 +1,16 @@ +#![crate_name = "foo"] + +pub mod sub { + pub struct Item; + + pub mod prelude { + pub use super::Item; + } +} + +#[doc(inline)] +pub use sub::*; + +// @count foo/index.html '//a[@class="mod"][@title="foo::prelude mod"]' 1 +// @count foo/prelude/index.html '//div[@class="item-row"]' 0 +pub mod prelude {} diff --git a/src/test/rustdoc/issue-83375-multiple-mods-w-same-name-doc-inline.rs b/src/test/rustdoc/issue-83375-multiple-mods-w-same-name-doc-inline.rs new file mode 100644 index 000000000..b83692509 --- /dev/null +++ b/src/test/rustdoc/issue-83375-multiple-mods-w-same-name-doc-inline.rs @@ -0,0 +1,16 @@ +#![crate_name = "foo"] + +pub mod sub { + pub struct Item; + + pub mod prelude { + pub use super::Item; + } +} + +// @count foo/index.html '//a[@class="mod"][@title="foo::prelude mod"]' 1 +// @count foo/prelude/index.html '//div[@class="item-row"]' 0 +pub mod prelude {} + +#[doc(inline)] +pub use sub::*; diff --git a/src/test/rustdoc/issue-89852.rs b/src/test/rustdoc/issue-89852.rs index 45544dbee..4f2da5e07 100644 --- a/src/test/rustdoc/issue-89852.rs +++ b/src/test/rustdoc/issue-89852.rs @@ -3,8 +3,8 @@ #![no_core] #![feature(no_core)] -// @matches 'issue_89852/sidebar-items.js' '"repro"' -// @!matches 'issue_89852/sidebar-items.js' '"repro".*"repro"' +// @matchesraw 'issue_89852/sidebar-items.js' '"repro"' +// @!matchesraw 'issue_89852/sidebar-items.js' '"repro".*"repro"' #[macro_export] macro_rules! repro { diff --git a/src/test/rustdoc/issue-98697.rs b/src/test/rustdoc/issue-98697.rs index 83e08094c..d50268509 100644 --- a/src/test/rustdoc/issue-98697.rs +++ b/src/test/rustdoc/issue-98697.rs @@ -8,10 +8,10 @@ extern crate issue_98697_reexport_with_anonymous_lifetime; -// @has issue_98697/fn.repro.html '//pre[@class="rust fn"]/code' 'fn repro<F>() where F: Fn(&str)' +// @has issue_98697/fn.repro.html '//pre[@class="rust fn"]/code' 'fn repro<F>()where F: Fn(&str)' // @!has issue_98697/fn.repro.html '//pre[@class="rust fn"]/code' 'for<' pub use issue_98697_reexport_with_anonymous_lifetime::repro; -// @has issue_98697/struct.Extra.html '//div[@id="trait-implementations-list"]//h3[@class="code-header in-band"]' 'impl MyTrait<&Extra> for Extra' -// @!has issue_98697/struct.Extra.html '//div[@id="trait-implementations-list"]//h3[@class="code-header in-band"]' 'impl<' +// @has issue_98697/struct.Extra.html '//div[@id="trait-implementations-list"]//h3[@class="code-header"]' 'impl MyTrait<&Extra> for Extra' +// @!has issue_98697/struct.Extra.html '//div[@id="trait-implementations-list"]//h3[@class="code-header"]' 'impl<' pub use issue_98697_reexport_with_anonymous_lifetime::Extra; diff --git a/src/test/rustdoc/keyword.rs b/src/test/rustdoc/keyword.rs index 1cebe4c67..ea1273850 100644 --- a/src/test/rustdoc/keyword.rs +++ b/src/test/rustdoc/keyword.rs @@ -7,7 +7,7 @@ // @has foo/index.html '//div[@class="sidebar-elems"]//li/a' 'Keywords' // @has foo/index.html '//div[@class="sidebar-elems"]//li/a/@href' '#keywords' // @has foo/keyword.match.html '//a[@class="keyword"]' 'match' -// @has foo/keyword.match.html '//span[@class="in-band"]' 'Keyword match' +// @has foo/keyword.match.html '//h1[@class="fqn"]' 'Keyword match' // @has foo/keyword.match.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!' // @has foo/index.html '//a/@href' '../foo/index.html' // @!has foo/foo/index.html diff --git a/src/test/rustdoc/link-title-escape.rs b/src/test/rustdoc/link-title-escape.rs index 01aa8d00b..7a322ea6d 100644 --- a/src/test/rustdoc/link-title-escape.rs +++ b/src/test/rustdoc/link-title-escape.rs @@ -6,4 +6,4 @@ //! //! [foo]: url 'title & <stuff> & "things"' -// @has 'foo/index.html' 'title & <stuff> & "things"' +// @hasraw 'foo/index.html' 'title & <stuff> & "things"' diff --git a/src/test/rustdoc/logo-class-default.rs b/src/test/rustdoc/logo-class-default.rs index a7016d227..d2d439199 100644 --- a/src/test/rustdoc/logo-class-default.rs +++ b/src/test/rustdoc/logo-class-default.rs @@ -1,4 +1,4 @@ // Note: this test is paired with logo-class.rs. // @has logo_class_default/struct.SomeStruct.html '//*[@class="logo-container"]/img[@class="rust-logo"]' '' -// @has logo_class_default/struct.SomeStruct.html '//*[@class="sub-logo-container"]/img[@class="rust-logo"]' '' +// @has src/logo_class_default/logo-class-default.rs.html '//*[@class="sub-logo-container"]/img[@class="rust-logo"]' '' pub struct SomeStruct; diff --git a/src/test/rustdoc/logo-class.rs b/src/test/rustdoc/logo-class.rs index f071f356a..d3aa446da 100644 --- a/src/test/rustdoc/logo-class.rs +++ b/src/test/rustdoc/logo-class.rs @@ -5,6 +5,6 @@ // @has logo_class/struct.SomeStruct.html '//*[@class="logo-container"]/img[@src="https://raw.githubusercontent.com/sagebind/isahc/master/media/isahc.svg.png"]' '' // @!has logo_class/struct.SomeStruct.html '//*[@class="logo-container"]/img[@class="rust-logo"]' '' // -// @has logo_class/struct.SomeStruct.html '//*[@class="sub-logo-container"]/img[@src="https://raw.githubusercontent.com/sagebind/isahc/master/media/isahc.svg.png"]' '' -// @!has logo_class/struct.SomeStruct.html '//*[@class="sub-logo-container"]/img[@class="rust-logo"]' '' +// @has src/logo_class/logo-class.rs.html '//*[@class="sub-logo-container"]/img[@src="https://raw.githubusercontent.com/sagebind/isahc/master/media/isahc.svg.png"]' '' +// @!has src/logo_class/logo-class.rs.html '//*[@class="sub-logo-container"]/img[@class="rust-logo"]' '' pub struct SomeStruct; diff --git a/src/test/rustdoc/macro-document-private-duplicate.rs b/src/test/rustdoc/macro-document-private-duplicate.rs index 7576c1326..d3cf7e140 100644 --- a/src/test/rustdoc/macro-document-private-duplicate.rs +++ b/src/test/rustdoc/macro-document-private-duplicate.rs @@ -4,21 +4,21 @@ // (yes, that's a thing), rustdoc lists both of them on the index page, // but only documents the first one on the page for the macro. // Fortunately, this can only happen in document private items mode, -// but it still isn't ideal beahvior. +// but it still isn't ideal behavior. // // See https://github.com/rust-lang/rust/pull/88019#discussion_r693920453 // // compile-flags: --document-private-items -// @has macro_document_private_duplicate/index.html 'Doc 1.' -// @has macro_document_private_duplicate/macro.a_macro.html 'Doc 1.' +// @hasraw macro_document_private_duplicate/index.html 'Doc 1.' +// @hasraw macro_document_private_duplicate/macro.a_macro.html 'Doc 1.' /// Doc 1. macro_rules! a_macro { () => () } -// @has macro_document_private_duplicate/index.html 'Doc 2.' -// @!has macro_document_private_duplicate/macro.a_macro.html 'Doc 2.' +// @hasraw macro_document_private_duplicate/index.html 'Doc 2.' +// @!hasraw macro_document_private_duplicate/macro.a_macro.html 'Doc 2.' /// Doc 2. macro_rules! a_macro { () => () diff --git a/src/test/rustdoc/macro-higher-kinded-function.rs b/src/test/rustdoc/macro-higher-kinded-function.rs index 02a430564..b8c52b7b7 100644 --- a/src/test/rustdoc/macro-higher-kinded-function.rs +++ b/src/test/rustdoc/macro-higher-kinded-function.rs @@ -11,8 +11,8 @@ macro_rules! gen { } // @has 'foo/struct.Providers.html' -// @has - '//*[@class="docblock item-decl"]//code' "pub a: for<'tcx> fn(_: TyCtxt<'tcx>, _: u8) -> i8," -// @has - '//*[@class="docblock item-decl"]//code' "pub b: for<'tcx> fn(_: TyCtxt<'tcx>, _: u16) -> i16," +// @has - '//*[@class="item-decl"]//code' "pub a: for<'tcx> fn(_: TyCtxt<'tcx>, _: u8) -> i8," +// @has - '//*[@class="item-decl"]//code' "pub b: for<'tcx> fn(_: TyCtxt<'tcx>, _: u16) -> i16," // @has - '//*[@id="structfield.a"]/code' "a: for<'tcx> fn(_: TyCtxt<'tcx>, _: u8) -> i8" // @has - '//*[@id="structfield.b"]/code' "b: for<'tcx> fn(_: TyCtxt<'tcx>, _: u16) -> i16" gen! { diff --git a/src/test/rustdoc/macro-private-not-documented.rs b/src/test/rustdoc/macro-private-not-documented.rs index ae8b0e722..f135a3a9c 100644 --- a/src/test/rustdoc/macro-private-not-documented.rs +++ b/src/test/rustdoc/macro-private-not-documented.rs @@ -6,13 +6,13 @@ // This is a regression text for issue #88453. #![feature(decl_macro)] -// @!has macro_private_not_documented/index.html 'a_macro' +// @!hasraw macro_private_not_documented/index.html 'a_macro' // @!has macro_private_not_documented/macro.a_macro.html macro_rules! a_macro { () => () } -// @!has macro_private_not_documented/index.html 'another_macro' +// @!hasraw macro_private_not_documented/index.html 'another_macro' // @!has macro_private_not_documented/macro.another_macro.html macro another_macro { () => () diff --git a/src/test/rustdoc/macro_rules-matchers.rs b/src/test/rustdoc/macro_rules-matchers.rs index efc3b21e6..96f4126c7 100644 --- a/src/test/rustdoc/macro_rules-matchers.rs +++ b/src/test/rustdoc/macro_rules-matchers.rs @@ -5,32 +5,27 @@ // @has 'foo/macro.todo.html' // @has - '//span[@class="macro"]' 'macro_rules!' -// @has - '//span[@class="ident"]' 'todo' -// Note: the only op is the `+` -// @count - '//pre[@class="rust macro"]//span[@class="op"]' 1 +// @hasraw - ' todo {' -// @has - '{ () => { ... }; ($(' +// @hasraw - '{ () => { ... }; ($(' // @has - '//span[@class="macro-nonterminal"]' '$' // @has - '//span[@class="macro-nonterminal"]' 'arg' -// @has - ':' -// @has - '//span[@class="ident"]' 'tt' -// @has - '),' -// @has - '//span[@class="op"]' '+' -// @has - ') => { ... }; }' +// @hasraw - ':tt)+' +// @hasraw - ') => { ... }; }' pub use std::todo; mod mod1 { // @has 'foo/macro.macro1.html' - // @has - 'macro_rules!' - // @has - 'macro1' - // @has - '{ () => { ... }; ($(' + // @hasraw - 'macro_rules!' + // @hasraw - 'macro1' + // @hasraw - '{ () => { ... }; ($(' // @has - '//span[@class="macro-nonterminal"]' '$' // @has - '//span[@class="macro-nonterminal"]' 'arg' - // @has - ':' - // @has - 'expr' - // @has - '),' - // @has - '+' - // @has - ') => { ... }; }' + // @hasraw - ':' + // @hasraw - 'expr' + // @hasraw - '),' + // @hasraw - '+' + // @hasraw - ') => { ... }; }' #[macro_export] macro_rules! macro1 { () => {}; diff --git a/src/test/rustdoc/markdown-summaries.rs b/src/test/rustdoc/markdown-summaries.rs index b843e28e7..31e7072b5 100644 --- a/src/test/rustdoc/markdown-summaries.rs +++ b/src/test/rustdoc/markdown-summaries.rs @@ -7,21 +7,21 @@ //! //! [link]: https://example.com -// @has search-index.js 'This <em>summary</em> has a link and <code>code</code>.' -// @!has - 'second paragraph' +// @hasraw search-index.js 'This <em>summary</em> has a link and <code>code</code>.' +// @!hasraw - 'second paragraph' /// This `code` will be rendered in a code tag. /// /// This text should not be rendered. pub struct Sidebar; -// @has search-index.js 'This <code>code</code> will be rendered in a code tag.' -// @has summaries/sidebar-items.js 'This `code` will be rendered in a code tag.' -// @!has - 'text should not be rendered' +// @hasraw search-index.js 'This <code>code</code> will be rendered in a code tag.' +// @hasraw summaries/sidebar-items.js 'This `code` will be rendered in a code tag.' +// @!hasraw - 'text should not be rendered' /// ```text /// this block should not be rendered /// ``` pub struct Sidebar2; -// @!has summaries/sidebar-items.js 'block should not be rendered' +// @!hasraw summaries/sidebar-items.js 'block should not be rendered' diff --git a/src/test/rustdoc/masked.rs b/src/test/rustdoc/masked.rs index c7ad690d6..80d5b99c0 100644 --- a/src/test/rustdoc/masked.rs +++ b/src/test/rustdoc/masked.rs @@ -7,24 +7,24 @@ #[doc(masked)] extern crate masked; -// @!has 'search-index.js' 'masked_method' +// @!hasraw 'search-index.js' 'masked_method' -// @!has 'foo/struct.String.html' 'MaskedTrait' -// @!has 'foo/struct.String.html' 'masked_method' +// @!hasraw 'foo/struct.String.html' 'MaskedTrait' +// @!hasraw 'foo/struct.String.html' 'masked_method' pub use std::string::String; -// @!has 'foo/trait.Clone.html' 'MaskedStruct' +// @!hasraw 'foo/trait.Clone.html' 'MaskedStruct' pub use std::clone::Clone; -// @!has 'foo/struct.MyStruct.html' 'MaskedTrait' -// @!has 'foo/struct.MyStruct.html' 'masked_method' +// @!hasraw 'foo/struct.MyStruct.html' 'MaskedTrait' +// @!hasraw 'foo/struct.MyStruct.html' 'masked_method' pub struct MyStruct; impl masked::MaskedTrait for MyStruct { fn masked_method() {} } -// @!has 'foo/trait.MyTrait.html' 'MaskedStruct' +// @!hasraw 'foo/trait.MyTrait.html' 'MaskedStruct' pub trait MyTrait {} impl MyTrait for masked::MaskedStruct {} diff --git a/src/test/rustdoc/module-impls.rs b/src/test/rustdoc/module-impls.rs index 198b3446c..852f444e9 100644 --- a/src/test/rustdoc/module-impls.rs +++ b/src/test/rustdoc/module-impls.rs @@ -2,4 +2,4 @@ pub use std::marker::Send; -// @!has foo/index.html 'Implementations' +// @!hasraw foo/index.html 'Implementations' diff --git a/src/test/rustdoc/negative-impl-sidebar.rs b/src/test/rustdoc/negative-impl-sidebar.rs index b995fff1f..4af6d0084 100644 --- a/src/test/rustdoc/negative-impl-sidebar.rs +++ b/src/test/rustdoc/negative-impl-sidebar.rs @@ -4,6 +4,6 @@ pub struct Foo; // @has foo/struct.Foo.html -// @has - '//*[@class="sidebar-title"]/a[@href="#trait-implementations"]' 'Trait Implementations' +// @has - '//div[@class="sidebar-elems"]//h3/a[@href="#trait-implementations"]' 'Trait Implementations' // @has - '//*[@class="sidebar-elems"]//section//a' '!Sync' impl !Sync for Foo {} diff --git a/src/test/rustdoc/negative-impl.rs b/src/test/rustdoc/negative-impl.rs index 61a239868..af19c784d 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<B>" pub struct Bravo<B>(B); -// @matches negative_impl/struct.Alpha.html '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ +// @matches negative_impl/struct.Alpha.html '//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ // "impl !Send for Alpha" impl !Send for Alpha {} -// @matches negative_impl/struct.Bravo.html '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' "\ +// @matches negative_impl/struct.Bravo.html '//*[@class="impl has-srclink"]//h3[@class="code-header"]' "\ // impl<B> !Send for Bravo<B>" impl<B> !Send for Bravo<B> {} diff --git a/src/test/rustdoc/nested-modules.rs b/src/test/rustdoc/nested-modules.rs index 1596f4674..12234d2cf 100644 --- a/src/test/rustdoc/nested-modules.rs +++ b/src/test/rustdoc/nested-modules.rs @@ -7,22 +7,22 @@ mod a_module { pub mod a_nested_module { // @has aCrate/a_nested_module/index.html '//a[@href="fn.a_nested_public_function.html"]' 'a_nested_public_function' - // @has aCrate/a_nested_module/fn.a_nested_public_function.html 'pub fn a_nested_public_function()' + // @hasraw aCrate/a_nested_module/fn.a_nested_public_function.html 'pub fn a_nested_public_function()' pub fn a_nested_public_function() {} // @has aCrate/a_nested_module/index.html '//a[@href="fn.another_nested_public_function.html"]' 'another_nested_public_function' - // @has aCrate/a_nested_module/fn.another_nested_public_function.html 'pub fn another_nested_public_function()' + // @hasraw aCrate/a_nested_module/fn.another_nested_public_function.html 'pub fn another_nested_public_function()' pub use a_nested_module::a_nested_public_function as another_nested_public_function; } - // @!has aCrate/a_nested_module/index.html 'yet_another_nested_public_function' + // @!hasraw aCrate/a_nested_module/index.html 'yet_another_nested_public_function' pub use a_nested_module::a_nested_public_function as yet_another_nested_public_function; - // @!has aCrate/a_nested_module/index.html 'one_last_nested_public_function' + // @!hasraw aCrate/a_nested_module/index.html 'one_last_nested_public_function' pub use a_nested_module::another_nested_public_function as one_last_nested_public_function; } -// @!has aCrate/index.html 'a_module' +// @!hasraw aCrate/index.html 'a_module' // @has aCrate/index.html '//a[@href="a_nested_module/index.html"]' 'a_nested_module' pub use a_module::a_nested_module; @@ -36,7 +36,7 @@ pub use a_module::{ }; // @has aCrate/index.html '//a[@href="fn.private_function.html"]' 'private_function' -// @!has aCrate/fn.private_function.html 'a_module' +// @!hasraw aCrate/fn.private_function.html 'a_module' // @has aCrate/index.html '//a[@href="fn.other_private_function.html"]' 'other_private_function' -// @!has aCrate/fn.other_private_function.html 'a_module' +// @!hasraw aCrate/fn.other_private_function.html 'a_module' pub use a_module::{other_private_function, private_function}; diff --git a/src/test/rustdoc/no-crate-filter.rs b/src/test/rustdoc/no-crate-filter.rs index c694d1456..b2f899064 100644 --- a/src/test/rustdoc/no-crate-filter.rs +++ b/src/test/rustdoc/no-crate-filter.rs @@ -2,5 +2,5 @@ // compile-flags: -Z unstable-options --disable-per-crate-search -// @!has 'foo/struct.Foo.html' '//*[id="crate-search"]' +// @!has 'foo/struct.Foo.html' '//*[id="crate-search"]' '' pub struct Foo; diff --git a/src/test/rustdoc/normalize-assoc-item.rs b/src/test/rustdoc/normalize-assoc-item.rs index ad1a868ee..db56f6852 100644 --- a/src/test/rustdoc/normalize-assoc-item.rs +++ b/src/test/rustdoc/normalize-assoc-item.rs @@ -11,11 +11,24 @@ impl Trait for usize { type X = isize; } +impl Trait for () { + type X = fn() -> i32; +} + +impl Trait for isize { + type X = <() as Trait>::X; +} + // @has 'normalize_assoc_item/fn.f.html' '//pre[@class="rust fn"]' 'pub fn f() -> isize' pub fn f() -> <usize as Trait>::X { 0 } +// @has 'normalize_assoc_item/fn.f2.html' '//pre[@class="rust fn"]' 'pub fn f2() -> fn() -> i32' +pub fn f2() -> <isize as Trait>::X { + todo!() +} + pub struct S { // @has 'normalize_assoc_item/struct.S.html' '//span[@id="structfield.box_me_up"]' 'box_me_up: Box<S, Global>' pub box_me_up: <S as Trait>::X, diff --git a/src/test/rustdoc/not-wf-ambiguous-normalization.rs b/src/test/rustdoc/not-wf-ambiguous-normalization.rs new file mode 100644 index 000000000..1e9f925f8 --- /dev/null +++ b/src/test/rustdoc/not-wf-ambiguous-normalization.rs @@ -0,0 +1,24 @@ +// compile-flags: -Znormalize-docs + +#![feature(type_alias_impl_trait)] + +trait Allocator { + type Buffer; +} + +struct DefaultAllocator; + +// This unconstrained impl parameter causes the normalization of +// `<DefaultAllocator as Allocator>::Buffer` to be ambiguous, +// which caused an ICE with `-Znormalize-docs`. +impl<T> Allocator for DefaultAllocator { + type Buffer = (); +} + +type A = impl Fn(<DefaultAllocator as Allocator>::Buffer); + +fn foo() -> A { + |_| () +} + +fn main() {} diff --git a/src/test/rustdoc/primitive-reference.rs b/src/test/rustdoc/primitive-reference.rs new file mode 100644 index 000000000..ea8d2d166 --- /dev/null +++ b/src/test/rustdoc/primitive-reference.rs @@ -0,0 +1,37 @@ +#![crate_name = "foo"] + +#![feature(rustdoc_internals)] + +// @has foo/index.html +// @has - '//h2[@id="primitives"]' 'Primitive Types' +// @has - '//a[@href="primitive.reference.html"]' 'reference' +// @has - '//div[@class="sidebar-elems"]//li/a' 'Primitive Types' +// @has - '//div[@class="sidebar-elems"]//li/a/@href' '#primitives' +// @has foo/primitive.reference.html +// @has - '//a[@class="primitive"]' 'reference' +// @has - '//h1[@class="fqn"]' 'Primitive Type reference' +// @has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!' + +// There should be only one implementation listed. +// @count - '//*[@class="impl has-srclink"]' 1 +// @has - '//*[@id="impl-Foo%3C%26A%3E-for-%26B"]/*[@class="code-header"]' \ +// 'impl<A, B> Foo<&A> for &B' +#[doc(primitive = "reference")] +/// this is a test! +mod reference {} + +pub struct Bar; + +// This implementation should **not** show up. +impl<T> From<&T> for Bar { + fn from(s: &T) -> Self { + Bar + } +} + +pub trait Foo<T> { + fn stuff(&self, other: &T) {} +} + +// This implementation should show up. +impl<A, B> Foo<&A> for &B {} diff --git a/src/test/rustdoc/primitive-slice-auto-trait.rs b/src/test/rustdoc/primitive-slice-auto-trait.rs index b3f511bc1..cdddd6b65 100644 --- a/src/test/rustdoc/primitive-slice-auto-trait.rs +++ b/src/test/rustdoc/primitive-slice-auto-trait.rs @@ -4,11 +4,11 @@ #![feature(rustdoc_internals)] // @has foo/primitive.slice.html '//a[@class="primitive"]' 'slice' -// @has - '//span[@class="in-band"]' 'Primitive Type slice' +// @has - '//h1[@class="fqn"]' 'Primitive Type slice' // @has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!' // @has - '//h2[@id="synthetic-implementations"]' 'Auto Trait Implementations' -// @has - '//div[@id="synthetic-implementations-list"]//h3' 'impl<T> Send for [T] where T: Send' -// @has - '//div[@id="synthetic-implementations-list"]//h3' 'impl<T> Sync for [T] where T: Sync' +// @has - '//div[@id="synthetic-implementations-list"]//h3' 'impl<T> Send for [T]where T: Send' +// @has - '//div[@id="synthetic-implementations-list"]//h3' 'impl<T> Sync for [T]where T: Sync' #[doc(primitive = "slice")] /// this is a test! mod slice_prim {} diff --git a/src/test/rustdoc/primitive-tuple-auto-trait.rs b/src/test/rustdoc/primitive-tuple-auto-trait.rs index a2fbbf078..df681457f 100644 --- a/src/test/rustdoc/primitive-tuple-auto-trait.rs +++ b/src/test/rustdoc/primitive-tuple-auto-trait.rs @@ -4,7 +4,7 @@ #![feature(rustdoc_internals)] // @has foo/primitive.tuple.html '//a[@class="primitive"]' 'tuple' -// @has - '//span[@class="in-band"]' 'Primitive Type tuple' +// @has - '//h1[@class="fqn"]' 'Primitive Type tuple' // @has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!' // @has - '//h2[@id="synthetic-implementations"]' 'Auto Trait Implementations' // @has - '//div[@id="synthetic-implementations-list"]//h3' 'Send' diff --git a/src/test/rustdoc/primitive-unit-auto-trait.rs b/src/test/rustdoc/primitive-unit-auto-trait.rs index 76182622e..391e33bea 100644 --- a/src/test/rustdoc/primitive-unit-auto-trait.rs +++ b/src/test/rustdoc/primitive-unit-auto-trait.rs @@ -4,7 +4,7 @@ #![feature(rustdoc_internals)] // @has foo/primitive.unit.html '//a[@class="primitive"]' 'unit' -// @has - '//span[@class="in-band"]' 'Primitive Type unit' +// @has - '//h1[@class="fqn"]' 'Primitive Type unit' // @has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!' // @has - '//h2[@id="synthetic-implementations"]' 'Auto Trait Implementations' // @has - '//div[@id="synthetic-implementations-list"]//h3' 'impl Send for ()' diff --git a/src/test/rustdoc/primitive.rs b/src/test/rustdoc/primitive.rs index 605ca4d17..6347fdac3 100644 --- a/src/test/rustdoc/primitive.rs +++ b/src/test/rustdoc/primitive.rs @@ -7,7 +7,7 @@ // @has foo/index.html '//div[@class="sidebar-elems"]//li/a' 'Primitive Types' // @has foo/index.html '//div[@class="sidebar-elems"]//li/a/@href' '#primitives' // @has foo/primitive.i32.html '//a[@class="primitive"]' 'i32' -// @has foo/primitive.i32.html '//span[@class="in-band"]' 'Primitive Type i32' +// @has foo/primitive.i32.html '//h1[@class="fqn"]' 'Primitive Type i32' // @has foo/primitive.i32.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!' // @has foo/index.html '//a/@href' '../foo/index.html' // @!has foo/index.html '//span' '๐' diff --git a/src/test/rustdoc/primitive/primitive-generic-impl.rs b/src/test/rustdoc/primitive/primitive-generic-impl.rs index eebb2cf5a..7b336b398 100644 --- a/src/test/rustdoc/primitive/primitive-generic-impl.rs +++ b/src/test/rustdoc/primitive/primitive-generic-impl.rs @@ -1,7 +1,7 @@ #![feature(rustdoc_internals)] #![crate_name = "foo"] -// @has foo/primitive.i32.html '//*[@id="impl-ToString-for-i32"]//h3[@class="code-header in-band"]' 'impl<T> ToString for T' +// @has foo/primitive.i32.html '//*[@id="impl-ToString-for-i32"]//h3[@class="code-header"]' 'impl<T> ToString for T' #[doc(primitive = "i32")] /// Some useless docs, wouhou! diff --git a/src/test/rustdoc/recursive-deref.rs b/src/test/rustdoc/recursive-deref.rs index a7504fbcc..aa38485c4 100644 --- a/src/test/rustdoc/recursive-deref.rs +++ b/src/test/rustdoc/recursive-deref.rs @@ -9,7 +9,7 @@ impl C { pub fn c(&self) {} } -// @has recursive_deref/struct.A.html '//h3[@class="code-header in-band"]' 'impl Deref for A' +// @has recursive_deref/struct.A.html '//h3[@class="code-header"]' 'impl Deref for A' // @has '-' '//*[@class="impl-items"]//*[@id="method.c"]' 'pub fn c(&self)' impl Deref for A { type Target = B; @@ -19,7 +19,7 @@ impl Deref for A { } } -// @has recursive_deref/struct.B.html '//h3[@class="code-header in-band"]' 'impl Deref for B' +// @has recursive_deref/struct.B.html '//h3[@class="code-header"]' 'impl Deref for B' // @has '-' '//*[@class="impl-items"]//*[@id="method.c"]' 'pub fn c(&self)' impl Deref for B { type Target = C; @@ -29,7 +29,7 @@ impl Deref for B { } } -// @has recursive_deref/struct.C.html '//h3[@class="code-header in-band"]' 'impl Deref for C' +// @has recursive_deref/struct.C.html '//h3[@class="code-header"]' 'impl Deref for C' impl Deref for C { type Target = B; @@ -49,9 +49,9 @@ impl G { pub fn g() {} } -// @has recursive_deref/struct.D.html '//h3[@class="code-header in-band"]' 'impl Deref for D' +// @has recursive_deref/struct.D.html '//h3[@class="code-header"]' 'impl Deref for D' // We also check that `G::g` method isn't rendered because there is no `self` argument. -// @!has '-' '//*[@id="deref-methods-G"]' +// @!has '-' '//*[@id="deref-methods-G"]' '' impl Deref for D { type Target = E; @@ -60,9 +60,9 @@ impl Deref for D { } } -// @has recursive_deref/struct.E.html '//h3[@class="code-header in-band"]' 'impl Deref for E' +// @has recursive_deref/struct.E.html '//h3[@class="code-header"]' 'impl Deref for E' // We also check that `G::g` method isn't rendered because there is no `self` argument. -// @!has '-' '//*[@id="deref-methods-G"]' +// @!has '-' '//*[@id="deref-methods-G"]' '' impl Deref for E { type Target = F; @@ -71,9 +71,9 @@ impl Deref for E { } } -// @has recursive_deref/struct.F.html '//h3[@class="code-header in-band"]' 'impl Deref for F' +// @has recursive_deref/struct.F.html '//h3[@class="code-header"]' 'impl Deref for F' // We also check that `G::g` method isn't rendered because there is no `self` argument. -// @!has '-' '//*[@id="deref-methods-G"]' +// @!has '-' '//*[@id="deref-methods-G"]' '' impl Deref for F { type Target = G; @@ -82,7 +82,7 @@ impl Deref for F { } } -// @has recursive_deref/struct.G.html '//h3[@class="code-header in-band"]' 'impl Deref for G' +// @has recursive_deref/struct.G.html '//h3[@class="code-header"]' 'impl Deref for G' impl Deref for G { type Target = E; @@ -100,8 +100,8 @@ impl I { pub fn i() {} } -// @has recursive_deref/struct.H.html '//h3[@class="code-header in-band"]' 'impl Deref for H' -// @!has '-' '//*[@id="deref-methods-I"]' +// @has recursive_deref/struct.H.html '//h3[@class="code-header"]' 'impl Deref for H' +// @!has '-' '//*[@id="deref-methods-I"]' '' impl Deref for H { type Target = I; @@ -110,7 +110,7 @@ impl Deref for H { } } -// @has recursive_deref/struct.I.html '//h3[@class="code-header in-band"]' 'impl Deref for I' +// @has recursive_deref/struct.I.html '//h3[@class="code-header"]' 'impl Deref for I' impl Deref for I { type Target = H; diff --git a/src/test/rustdoc/reexport-dep-foreign-fn.rs b/src/test/rustdoc/reexport-dep-foreign-fn.rs index 6e1dc4539..6694c91d1 100644 --- a/src/test/rustdoc/reexport-dep-foreign-fn.rs +++ b/src/test/rustdoc/reexport-dep-foreign-fn.rs @@ -8,5 +8,5 @@ extern crate all_item_types; // @has 'foo/fn.foo_ffn.html' -// @has - '//*[@class="docblock item-decl"]//code' 'pub unsafe extern "C" fn foo_ffn()' +// @has - '//*[@class="item-decl"]//code' 'pub unsafe extern "C" fn foo_ffn()' pub use all_item_types::foo_ffn; diff --git a/src/test/rustdoc/reexport-doc.rs b/src/test/rustdoc/reexport-doc.rs new file mode 100644 index 000000000..df2c889b4 --- /dev/null +++ b/src/test/rustdoc/reexport-doc.rs @@ -0,0 +1,8 @@ +// aux-build:reexport-doc-aux.rs + +extern crate reexport_doc_aux as dep; + +// @has 'reexport_doc/struct.Foo.html' +// @count - '//p' 'These are the docs for Foo.' 1 +/// These are the docs for Foo. +pub use dep::Foo; diff --git a/src/test/rustdoc/reexports-priv.rs b/src/test/rustdoc/reexports-priv.rs index aea9b9f2b..11364e7f7 100644 --- a/src/test/rustdoc/reexports-priv.rs +++ b/src/test/rustdoc/reexports-priv.rs @@ -5,7 +5,7 @@ extern crate reexports; -// @has 'foo/macro.addr_of.html' '//*[@class="docblock item-decl"]' 'pub macro addr_of($place:expr) {' +// @has 'foo/macro.addr_of.html' '//*[@class="item-decl"]' 'pub macro addr_of($place:expr) {' pub use reexports::addr_of; // @!has 'foo/macro.addr_of_crate.html' pub(crate) use reexports::addr_of_crate; @@ -14,7 +14,7 @@ pub(self) use reexports::addr_of_self; // @!has 'foo/macro.addr_of_local.html' use reexports::addr_of_local; -// @has 'foo/struct.Foo.html' '//*[@class="docblock item-decl"]' 'pub struct Foo;' +// @has 'foo/struct.Foo.html' '//*[@class="item-decl"]' 'pub struct Foo;' pub use reexports::Foo; // @!has 'foo/struct.FooCrate.html' pub(crate) use reexports::FooCrate; @@ -23,7 +23,7 @@ pub(self) use reexports::FooSelf; // @!has 'foo/struct.FooLocal.html' use reexports::FooLocal; -// @has 'foo/enum.Bar.html' '//*[@class="docblock item-decl"]' 'pub enum Bar {' +// @has 'foo/enum.Bar.html' '//*[@class="item-decl"]' 'pub enum Bar {' pub use reexports::Bar; // @!has 'foo/enum.BarCrate.html' pub(crate) use reexports::BarCrate; @@ -50,7 +50,7 @@ pub(self) use reexports::TypeSelf; // @!has 'foo/type.TypeLocal.html' use reexports::TypeLocal; -// @has 'foo/union.Union.html' '//*[@class="docblock item-decl"]' 'pub union Union {' +// @has 'foo/union.Union.html' '//*[@class="item-decl"]' 'pub union Union {' pub use reexports::Union; // @!has 'foo/union.UnionCrate.html' pub(crate) use reexports::UnionCrate; @@ -61,33 +61,33 @@ use reexports::UnionLocal; pub mod outer { pub mod inner { - // @has 'foo/outer/inner/macro.addr_of.html' '//*[@class="docblock item-decl"]' 'pub macro addr_of($place:expr) {' + // @has 'foo/outer/inner/macro.addr_of.html' '//*[@class="item-decl"]' 'pub macro addr_of($place:expr) {' pub use reexports::addr_of; - // @has 'foo/outer/inner/macro.addr_of_crate.html' '//*[@class="docblock item-decl"]' 'pub(crate) macro addr_of_crate($place:expr) {' + // @has 'foo/outer/inner/macro.addr_of_crate.html' '//*[@class="item-decl"]' 'pub(crate) macro addr_of_crate($place:expr) {' pub(crate) use reexports::addr_of_crate; - // @has 'foo/outer/inner/macro.addr_of_super.html' '//*[@class="docblock item-decl"]' 'pub(in outer) macro addr_of_super($place:expr) {' + // @has 'foo/outer/inner/macro.addr_of_super.html' '//*[@class="item-decl"]' 'pub(in outer) macro addr_of_super($place:expr) {' pub(super) use reexports::addr_of_super; // @!has 'foo/outer/inner/macro.addr_of_self.html' pub(self) use reexports::addr_of_self; // @!has 'foo/outer/inner/macro.addr_of_local.html' use reexports::addr_of_local; - // @has 'foo/outer/inner/struct.Foo.html' '//*[@class="docblock item-decl"]' 'pub struct Foo;' + // @has 'foo/outer/inner/struct.Foo.html' '//*[@class="item-decl"]' 'pub struct Foo;' pub use reexports::Foo; - // @has 'foo/outer/inner/struct.FooCrate.html' '//*[@class="docblock item-decl"]' 'pub(crate) struct FooCrate;' + // @has 'foo/outer/inner/struct.FooCrate.html' '//*[@class="item-decl"]' 'pub(crate) struct FooCrate;' pub(crate) use reexports::FooCrate; - // @has 'foo/outer/inner/struct.FooSuper.html' '//*[@class="docblock item-decl"]' 'pub(in outer) struct FooSuper;' + // @has 'foo/outer/inner/struct.FooSuper.html' '//*[@class="item-decl"]' 'pub(in outer) struct FooSuper;' pub(super) use reexports::FooSuper; // @!has 'foo/outer/inner/struct.FooSelf.html' pub(self) use reexports::FooSelf; // @!has 'foo/outer/inner/struct.FooLocal.html' use reexports::FooLocal; - // @has 'foo/outer/inner/enum.Bar.html' '//*[@class="docblock item-decl"]' 'pub enum Bar {' + // @has 'foo/outer/inner/enum.Bar.html' '//*[@class="item-decl"]' 'pub enum Bar {' pub use reexports::Bar; - // @has 'foo/outer/inner/enum.BarCrate.html' '//*[@class="docblock item-decl"]' 'pub(crate) enum BarCrate {' + // @has 'foo/outer/inner/enum.BarCrate.html' '//*[@class="item-decl"]' 'pub(crate) enum BarCrate {' pub(crate) use reexports::BarCrate; - // @has 'foo/outer/inner/enum.BarSuper.html' '//*[@class="docblock item-decl"]' 'pub(in outer) enum BarSuper {' + // @has 'foo/outer/inner/enum.BarSuper.html' '//*[@class="item-decl"]' 'pub(in outer) enum BarSuper {' pub(super) use reexports::BarSuper; // @!has 'foo/outer/inner/enum.BarSelf.html' pub(self) use reexports::BarSelf; @@ -116,11 +116,11 @@ pub mod outer { // @!has 'foo/outer/inner/type.TypeLocal.html' use reexports::TypeLocal; - // @has 'foo/outer/inner/union.Union.html' '//*[@class="docblock item-decl"]' 'pub union Union {' + // @has 'foo/outer/inner/union.Union.html' '//*[@class="item-decl"]' 'pub union Union {' pub use reexports::Union; - // @has 'foo/outer/inner/union.UnionCrate.html' '//*[@class="docblock item-decl"]' 'pub(crate) union UnionCrate {' + // @has 'foo/outer/inner/union.UnionCrate.html' '//*[@class="item-decl"]' 'pub(crate) union UnionCrate {' pub(crate) use reexports::UnionCrate; - // @has 'foo/outer/inner/union.UnionSuper.html' '//*[@class="docblock item-decl"]' 'pub(in outer) union UnionSuper {' + // @has 'foo/outer/inner/union.UnionSuper.html' '//*[@class="item-decl"]' 'pub(in outer) union UnionSuper {' pub(super) use reexports::UnionSuper; // @!has 'foo/outer/inner/union.UnionSelf.html' pub(self) use reexports::UnionSelf; diff --git a/src/test/rustdoc/reexports.rs b/src/test/rustdoc/reexports.rs index 7abcbfb61..9aa6d7224 100644 --- a/src/test/rustdoc/reexports.rs +++ b/src/test/rustdoc/reexports.rs @@ -4,7 +4,7 @@ extern crate reexports; -// @has 'foo/macro.addr_of.html' '//*[@class="docblock item-decl"]' 'pub macro addr_of($place:expr) {' +// @has 'foo/macro.addr_of.html' '//*[@class="item-decl"]' 'pub macro addr_of($place:expr) {' pub use reexports::addr_of; // @!has 'foo/macro.addr_of_crate.html' pub(crate) use reexports::addr_of_crate; @@ -13,7 +13,7 @@ pub(self) use reexports::addr_of_self; // @!has 'foo/macro.addr_of_local.html' use reexports::addr_of_local; -// @has 'foo/struct.Foo.html' '//*[@class="docblock item-decl"]' 'pub struct Foo;' +// @has 'foo/struct.Foo.html' '//*[@class="item-decl"]' 'pub struct Foo;' pub use reexports::Foo; // @!has 'foo/struct.FooCrate.html' pub(crate) use reexports::FooCrate; @@ -22,7 +22,7 @@ pub(self) use reexports::FooSelf; // @!has 'foo/struct.FooLocal.html' use reexports::FooLocal; -// @has 'foo/enum.Bar.html' '//*[@class="docblock item-decl"]' 'pub enum Bar {' +// @has 'foo/enum.Bar.html' '//*[@class="item-decl"]' 'pub enum Bar {' pub use reexports::Bar; // @!has 'foo/enum.BarCrate.html' pub(crate) use reexports::BarCrate; @@ -49,7 +49,7 @@ pub(self) use reexports::TypeSelf; // @!has 'foo/type.TypeLocal.html' use reexports::TypeLocal; -// @has 'foo/union.Union.html' '//*[@class="docblock item-decl"]' 'pub union Union {' +// @has 'foo/union.Union.html' '//*[@class="item-decl"]' 'pub union Union {' pub use reexports::Union; // @!has 'foo/union.UnionCrate.html' pub(crate) use reexports::UnionCrate; @@ -60,7 +60,7 @@ use reexports::UnionLocal; pub mod outer { pub mod inner { - // @has 'foo/outer/inner/macro.addr_of.html' '//*[@class="docblock item-decl"]' 'pub macro addr_of($place:expr) {' + // @has 'foo/outer/inner/macro.addr_of.html' '//*[@class="item-decl"]' 'pub macro addr_of($place:expr) {' pub use reexports::addr_of; // @!has 'foo/outer/inner/macro.addr_of_crate.html' pub(crate) use reexports::addr_of_crate; @@ -71,7 +71,7 @@ pub mod outer { // @!has 'foo/outer/inner/macro.addr_of_local.html' use reexports::addr_of_local; - // @has 'foo/outer/inner/struct.Foo.html' '//*[@class="docblock item-decl"]' 'pub struct Foo;' + // @has 'foo/outer/inner/struct.Foo.html' '//*[@class="item-decl"]' 'pub struct Foo;' pub use reexports::Foo; // @!has 'foo/outer/inner/struct.FooCrate.html' pub(crate) use reexports::FooCrate; @@ -82,7 +82,7 @@ pub mod outer { // @!has 'foo/outer/inner/struct.FooLocal.html' use reexports::FooLocal; - // @has 'foo/outer/inner/enum.Bar.html' '//*[@class="docblock item-decl"]' 'pub enum Bar {' + // @has 'foo/outer/inner/enum.Bar.html' '//*[@class="item-decl"]' 'pub enum Bar {' pub use reexports::Bar; // @!has 'foo/outer/inner/enum.BarCrate.html' pub(crate) use reexports::BarCrate; @@ -115,7 +115,7 @@ pub mod outer { // @!has 'foo/outer/inner/type.TypeLocal.html' use reexports::TypeLocal; - // @has 'foo/outer/inner/union.Union.html' '//*[@class="docblock item-decl"]' 'pub union Union {' + // @has 'foo/outer/inner/union.Union.html' '//*[@class="item-decl"]' 'pub union Union {' pub use reexports::Union; // @!has 'foo/outer/inner/union.UnionCrate.html' pub(crate) use reexports::UnionCrate; diff --git a/src/test/rustdoc/remove-url-from-headings.rs b/src/test/rustdoc/remove-url-from-headings.rs index e2b232a6e..599c429a6 100644 --- a/src/test/rustdoc/remove-url-from-headings.rs +++ b/src/test/rustdoc/remove-url-from-headings.rs @@ -1,7 +1,7 @@ #![crate_name = "foo"] // @has foo/fn.foo.html -// @!has - '//a[@href="http://a.a"]' +// @!has - '//a[@href="http://a.a"]' '' // @has - '//a[@href="#implementing-stuff-somewhere"]' 'Implementing stuff somewhere' // @has - '//a[@href="#another-one-urg"]' 'Another one urg' diff --git a/src/test/rustdoc/rfc-2632-const-trait-impl.rs b/src/test/rustdoc/rfc-2632-const-trait-impl.rs index f3e211e30..602ee1b1b 100644 --- a/src/test/rustdoc/rfc-2632-const-trait-impl.rs +++ b/src/test/rustdoc/rfc-2632-const-trait-impl.rs @@ -18,10 +18,10 @@ pub struct S<T>(T); // @has - '//pre[@class="rust trait"]/code/span[@class="where"]' ': Clone' #[const_trait] pub trait Tr<T> { - // @!has - '//div[@id="method.a"]/h4[@class="code-header"]' '~const' - // @has - '//div[@id="method.a"]/h4[@class="code-header"]/a[@class="trait"]' 'Clone' - // @!has - '//div[@id="method.a"]/h4[@class="code-header"]/span[@class="where"]' '~const' - // @has - '//div[@id="method.a"]/h4[@class="code-header"]/span[@class="where fmt-newline"]' ': Clone' + // @!has - '//section[@id="method.a"]/h4[@class="code-header"]' '~const' + // @has - '//section[@id="method.a"]/h4[@class="code-header"]/a[@class="trait"]' 'Clone' + // @!has - '//section[@id="method.a"]/h4[@class="code-header"]/span[@class="where"]' '~const' + // @has - '//section[@id="method.a"]/h4[@class="code-header"]/span[@class="where fmt-newline"]' ': Clone' fn a<A: ~const Clone + ~const Destruct>() where Option<A>: ~const Clone + ~const Destruct, @@ -30,10 +30,10 @@ pub trait Tr<T> { } // @has - '//section[@id="impl-Tr%3CT%3E-for-T"]' '' -// @!has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header in-band"]' '~const' -// @has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header in-band"]/a[@class="trait"]' 'Clone' -// @!has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header in-band"]/span[@class="where"]' '~const' -// @has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header in-band"]/span[@class="where fmt-newline"]' ': Clone' +// @!has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]' '~const' +// @has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/a[@class="trait"]' 'Clone' +// @!has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/span[@class="where"]' '~const' +// @has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/span[@class="where fmt-newline"]' ': Clone' impl<T: ~const Clone + ~const Destruct> const Tr<T> for T where Option<T>: ~const Clone + ~const Destruct, diff --git a/src/test/rustdoc/rustc-incoherent-impls.rs b/src/test/rustdoc/rustc-incoherent-impls.rs new file mode 100644 index 000000000..3fdefbecc --- /dev/null +++ b/src/test/rustdoc/rustc-incoherent-impls.rs @@ -0,0 +1,28 @@ +// aux-build:incoherent-impl-types.rs +// build-aux-docs + +#![crate_name = "foo"] +#![feature(rustc_attrs)] + +extern crate incoherent_impl_types; + +// The only way this actually shows up is if the type gets inlined. +#[doc(inline)] +pub use incoherent_impl_types::FooTrait; + +// @has foo/trait.FooTrait.html +// @count - '//section[@id="method.do_something"]' 1 +impl dyn FooTrait { + #[rustc_allow_incoherent_impl] + pub fn do_something() {} +} + +#[doc(inline)] +pub use incoherent_impl_types::FooStruct; + +// @has foo/struct.FooStruct.html +// @count - '//section[@id="method.do_something"]' 1 +impl FooStruct { + #[rustc_allow_incoherent_impl] + pub fn do_something() {} +} diff --git a/src/test/rustdoc/safe-intrinsic.rs b/src/test/rustdoc/safe-intrinsic.rs index d3bb8514b..d08abdaeb 100644 --- a/src/test/rustdoc/safe-intrinsic.rs +++ b/src/test/rustdoc/safe-intrinsic.rs @@ -1,5 +1,6 @@ #![feature(intrinsics)] #![feature(no_core)] +#![feature(rustc_attrs)] #![no_core] #![crate_name = "foo"] @@ -7,6 +8,7 @@ extern "rust-intrinsic" { // @has 'foo/fn.abort.html' // @has - '//pre[@class="rust fn"]' 'pub extern "rust-intrinsic" fn abort() -> !' + #[rustc_safe_intrinsic] pub fn abort() -> !; // @has 'foo/fn.unreachable.html' // @has - '//pre[@class="rust fn"]' 'pub unsafe extern "rust-intrinsic" fn unreachable() -> !' diff --git a/src/test/rustdoc/search-index-summaries.rs b/src/test/rustdoc/search-index-summaries.rs index dd9c1a0b4..efd366405 100644 --- a/src/test/rustdoc/search-index-summaries.rs +++ b/src/test/rustdoc/search-index-summaries.rs @@ -1,8 +1,8 @@ #![crate_name = "foo"] -// @has 'search-index.js' 'Foo short link.' -// @!has - 'www.example.com' -// @!has - 'More Foo.' +// @hasraw 'search-index.js' 'Foo short link.' +// @!hasraw - 'www.example.com' +// @!hasraw - 'More Foo.' /// Foo short [link](https://www.example.com/). /// diff --git a/src/test/rustdoc/search-index.rs b/src/test/rustdoc/search-index.rs index f1b78f172..d1d05eb88 100644 --- a/src/test/rustdoc/search-index.rs +++ b/src/test/rustdoc/search-index.rs @@ -2,25 +2,25 @@ use std::ops::Deref; -// @has search-index.js Foo +// @hasraw search-index.js Foo pub use private::Foo; mod private { pub struct Foo; impl Foo { - pub fn test_method() {} // @has - test_method - fn priv_method() {} // @!has - priv_method + pub fn test_method() {} // @hasraw - test_method + fn priv_method() {} // @!hasraw - priv_method } pub trait PrivateTrait { - fn trait_method(&self) {} // @!has - priv_method + fn trait_method(&self) {} // @!hasraw - priv_method } } pub struct Bar; impl Deref for Bar { - // @!has search-index.js Target + // @!hasraw search-index.js Target type Target = Bar; fn deref(&self) -> &Bar { self } } diff --git a/src/test/rustdoc/short-docblock-codeblock.rs b/src/test/rustdoc/short-docblock-codeblock.rs index c6b318b06..3c5fa7b36 100644 --- a/src/test/rustdoc/short-docblock-codeblock.rs +++ b/src/test/rustdoc/short-docblock-codeblock.rs @@ -1,8 +1,6 @@ #![crate_name = "foo"] -// @has foo/index.html '//*[@class="item-right docblock-short"]' "" -// @!has foo/index.html '//*[@class="item-right docblock-short"]' "Some text." -// @!has foo/index.html '//*[@class="item-right docblock-short"]' "let x = 12;" +// @count foo/index.html '//*[@class="item-right docblock-short"]' 0 /// ``` /// let x = 12; diff --git a/src/test/rustdoc/short-docblock.rs b/src/test/rustdoc/short-docblock.rs index 17c44eab0..1a8a689be 100644 --- a/src/test/rustdoc/short-docblock.rs +++ b/src/test/rustdoc/short-docblock.rs @@ -1,7 +1,7 @@ #![crate_name = "foo"] -// @has foo/index.html '//*[@class="item-right docblock-short"]/p' 'fooo' -// @!has foo/index.html '//*[@class="item-right docblock-short"]/p/h1' 'fooo' +// @has foo/index.html '//*[@class="item-right docblock-short"]' 'fooo' +// @!has foo/index.html '//*[@class="item-right docblock-short"]/h1' 'fooo' // @has foo/fn.foo.html '//h2[@id="fooo"]/a[@href="#fooo"]' 'fooo' /// # fooo @@ -9,8 +9,8 @@ /// foo pub fn foo() {} -// @has foo/index.html '//*[@class="item-right docblock-short"]/p' 'mooood' -// @!has foo/index.html '//*[@class="item-right docblock-short"]/p/h2' 'mooood' +// @has foo/index.html '//*[@class="item-right docblock-short"]' 'mooood' +// @!has foo/index.html '//*[@class="item-right docblock-short"]/h2' 'mooood' // @has foo/foo/index.html '//h3[@id="mooood"]/a[@href="#mooood"]' 'mooood' /// ## mooood @@ -18,7 +18,7 @@ pub fn foo() {} /// foo mod pub mod foo {} -// @has foo/index.html '//*[@class="item-right docblock-short"]/p/a[@href=\ +// @has foo/index.html '//*[@class="item-right docblock-short"]/a[@href=\ // "https://nougat.world"]/code' 'nougat' /// [`nougat`](https://nougat.world) diff --git a/src/test/rustdoc/show-const-contents.rs b/src/test/rustdoc/show-const-contents.rs index 48b608859..69e742ee7 100644 --- a/src/test/rustdoc/show-const-contents.rs +++ b/src/test/rustdoc/show-const-contents.rs @@ -1,57 +1,57 @@ // Test that the contents of constants are displayed as part of the // documentation. -// @has show_const_contents/constant.CONST_S.html 'show this' -// @!has show_const_contents/constant.CONST_S.html '; //' +// @hasraw show_const_contents/constant.CONST_S.html 'show this' +// @!hasraw show_const_contents/constant.CONST_S.html '; //' pub const CONST_S: &'static str = "show this"; -// @has show_const_contents/constant.CONST_I32.html '= 42;' -// @!has show_const_contents/constant.CONST_I32.html '; //' +// @hasraw show_const_contents/constant.CONST_I32.html '= 42;' +// @!hasraw show_const_contents/constant.CONST_I32.html '; //' pub const CONST_I32: i32 = 42; -// @has show_const_contents/constant.CONST_I32_HEX.html '= 0x42;' -// @!has show_const_contents/constant.CONST_I32_HEX.html '; //' +// @hasraw show_const_contents/constant.CONST_I32_HEX.html '= 0x42;' +// @!hasraw show_const_contents/constant.CONST_I32_HEX.html '; //' pub const CONST_I32_HEX: i32 = 0x42; -// @has show_const_contents/constant.CONST_NEG_I32.html '= -42;' -// @!has show_const_contents/constant.CONST_NEG_I32.html '; //' +// @hasraw show_const_contents/constant.CONST_NEG_I32.html '= -42;' +// @!hasraw show_const_contents/constant.CONST_NEG_I32.html '; //' pub const CONST_NEG_I32: i32 = -42; -// @has show_const_contents/constant.CONST_EQ_TO_VALUE_I32.html '= 42i32;' -// @!has show_const_contents/constant.CONST_EQ_TO_VALUE_I32.html '// 42i32' +// @hasraw show_const_contents/constant.CONST_EQ_TO_VALUE_I32.html '= 42i32;' +// @!hasraw show_const_contents/constant.CONST_EQ_TO_VALUE_I32.html '// 42i32' pub const CONST_EQ_TO_VALUE_I32: i32 = 42i32; -// @has show_const_contents/constant.CONST_CALC_I32.html '= _; // 43i32' +// @hasraw show_const_contents/constant.CONST_CALC_I32.html '= _; // 43i32' pub const CONST_CALC_I32: i32 = 42 + 1; -// @!has show_const_contents/constant.CONST_REF_I32.html '= &42;' -// @!has show_const_contents/constant.CONST_REF_I32.html '; //' +// @!hasraw show_const_contents/constant.CONST_REF_I32.html '= &42;' +// @!hasraw show_const_contents/constant.CONST_REF_I32.html '; //' pub const CONST_REF_I32: &'static i32 = &42; -// @has show_const_contents/constant.CONST_I32_MAX.html '= i32::MAX; // 2_147_483_647i32' +// @hasraw show_const_contents/constant.CONST_I32_MAX.html '= i32::MAX; // 2_147_483_647i32' pub const CONST_I32_MAX: i32 = i32::MAX; -// @!has show_const_contents/constant.UNIT.html '= ();' -// @!has show_const_contents/constant.UNIT.html '; //' +// @!hasraw show_const_contents/constant.UNIT.html '= ();' +// @!hasraw show_const_contents/constant.UNIT.html '; //' pub const UNIT: () = (); pub struct MyType(i32); -// @!has show_const_contents/constant.MY_TYPE.html '= MyType(42);' -// @!has show_const_contents/constant.MY_TYPE.html '; //' +// @!hasraw show_const_contents/constant.MY_TYPE.html '= MyType(42);' +// @!hasraw show_const_contents/constant.MY_TYPE.html '; //' pub const MY_TYPE: MyType = MyType(42); pub struct MyTypeWithStr(&'static str); -// @!has show_const_contents/constant.MY_TYPE_WITH_STR.html '= MyTypeWithStr("show this");' -// @!has show_const_contents/constant.MY_TYPE_WITH_STR.html '; //' +// @!hasraw show_const_contents/constant.MY_TYPE_WITH_STR.html '= MyTypeWithStr("show this");' +// @!hasraw show_const_contents/constant.MY_TYPE_WITH_STR.html '; //' pub const MY_TYPE_WITH_STR: MyTypeWithStr = MyTypeWithStr("show this"); -// @has show_const_contents/constant.PI.html '= 3.14159265358979323846264338327950288f32;' -// @has show_const_contents/constant.PI.html '; // 3.14159274f32' +// @hasraw show_const_contents/constant.PI.html '= 3.14159265358979323846264338327950288f32;' +// @hasraw show_const_contents/constant.PI.html '; // 3.14159274f32' pub use std::f32::consts::PI; -// @has show_const_contents/constant.MAX.html '= i32::MAX; // 2_147_483_647i32' +// @hasraw show_const_contents/constant.MAX.html '= i32::MAX; // 2_147_483_647i32' #[allow(deprecated, deprecated_in_future)] pub use std::i32::MAX; @@ -61,7 +61,7 @@ macro_rules! int_module { ) } -// @has show_const_contents/constant.MIN.html '= i16::MIN; // -32_768i16' +// @hasraw show_const_contents/constant.MIN.html '= i16::MIN; // -32_768i16' int_module!(i16); // @has show_const_contents/constant.ESCAPE.html //pre '= r#"<script>alert("ESCAPE");</script>"#;' diff --git a/src/test/rustdoc/sidebar-all-page.rs b/src/test/rustdoc/sidebar-all-page.rs new file mode 100644 index 000000000..e74b981de --- /dev/null +++ b/src/test/rustdoc/sidebar-all-page.rs @@ -0,0 +1,35 @@ +#![crate_name = "foo"] + +#![feature(rustdoc_internals)] + +// @has 'foo/all.html' +// @has - '//*[@class="sidebar-elems"]//li' 'Structs' +// @has - '//*[@class="sidebar-elems"]//li' 'Enums' +// @has - '//*[@class="sidebar-elems"]//li' 'Unions' +// @has - '//*[@class="sidebar-elems"]//li' 'Functions' +// @has - '//*[@class="sidebar-elems"]//li' 'Traits' +// @has - '//*[@class="sidebar-elems"]//li' 'Macros' +// @has - '//*[@class="sidebar-elems"]//li' 'Type Definitions' +// @has - '//*[@class="sidebar-elems"]//li' 'Constants' +// @has - '//*[@class="sidebar-elems"]//li' 'Statics' +// @has - '//*[@class="sidebar-elems"]//li' 'Primitive Types' + +pub struct Foo; +pub enum Enum { + A, +} +pub union Bar { + a: u8, + b: u16, +} +pub fn foo() {} +pub trait Trait {} +#[macro_export] +macro_rules! foo { + () => {} +} +pub type Type = u8; +pub const FOO: u8 = 0; +pub static BAR: u8 = 0; +#[doc(primitive = "u8")] +mod u8 {} diff --git a/src/test/rustdoc/sidebar-items.rs b/src/test/rustdoc/sidebar-items.rs index b5b681ab0..6f7afa59b 100644 --- a/src/test/rustdoc/sidebar-items.rs +++ b/src/test/rustdoc/sidebar-items.rs @@ -2,17 +2,17 @@ #![crate_name = "foo"] // @has foo/trait.Foo.html -// @has - '//*[@class="sidebar-title"]/a[@href="#required-methods"]' 'Required Methods' +// @has - '//div[@class="sidebar-elems"]//h3/a[@href="#required-methods"]' 'Required Methods' // @has - '//*[@class="sidebar-elems"]//section//a' 'bar' -// @has - '//*[@class="sidebar-title"]/a[@href="#provided-methods"]' 'Provided Methods' +// @has - '//div[@class="sidebar-elems"]//h3/a[@href="#provided-methods"]' 'Provided Methods' // @has - '//*[@class="sidebar-elems"]//section//a' 'foo' -// @has - '//*[@class="sidebar-title"]/a[@href="#required-associated-consts"]' 'Required Associated Constants' +// @has - '//div[@class="sidebar-elems"]//h3/a[@href="#required-associated-consts"]' 'Required Associated Constants' // @has - '//*[@class="sidebar-elems"]//section//a' 'FOO' -// @has - '//*[@class="sidebar-title"]/a[@href="#provided-associated-consts"]' 'Provided Associated Constants' +// @has - '//div[@class="sidebar-elems"]//h3/a[@href="#provided-associated-consts"]' 'Provided Associated Constants' // @has - '//*[@class="sidebar-elems"]//section//a' 'BAR' -// @has - '//*[@class="sidebar-title"]/a[@href="#required-associated-types"]' 'Required Associated Types' +// @has - '//div[@class="sidebar-elems"]//h3/a[@href="#required-associated-types"]' 'Required Associated Types' // @has - '//*[@class="sidebar-elems"]//section//a' 'Output' -// @has - '//*[@class="sidebar-title"]/a[@href="#provided-associated-types"]' 'Provided Associated Types' +// @has - '//div[@class="sidebar-elems"]//h3/a[@href="#provided-associated-types"]' 'Provided Associated Types' // @has - '//*[@class="sidebar-elems"]//section//a' 'Extra' pub trait Foo { const FOO: usize; @@ -25,7 +25,7 @@ pub trait Foo { } // @has foo/struct.Bar.html -// @has - '//*[@class="sidebar-title"]/a[@href="#fields"]' 'Fields' +// @has - '//div[@class="sidebar-elems"]//h3/a[@href="#fields"]' 'Fields' // @has - '//*[@class="sidebar-elems"]//section//a[@href="#structfield.f"]' 'f' // @has - '//*[@class="sidebar-elems"]//section//a[@href="#structfield.u"]' 'u' // @!has - '//*[@class="sidebar-elems"]//section//a' 'waza' @@ -36,7 +36,7 @@ pub struct Bar { } // @has foo/enum.En.html -// @has - '//*[@class="sidebar-title"]/a[@href="#variants"]' 'Variants' +// @has - '//div[@class="sidebar-elems"]//h3/a[@href="#variants"]' 'Variants' // @has - '//*[@class="sidebar-elems"]//section//a' 'Foo' // @has - '//*[@class="sidebar-elems"]//section//a' 'Bar' pub enum En { @@ -45,7 +45,7 @@ pub enum En { } // @has foo/union.MyUnion.html -// @has - '//*[@class="sidebar-title"]/a[@href="#fields"]' 'Fields' +// @has - '//div[@class="sidebar-elems"]//h3/a[@href="#fields"]' 'Fields' // @has - '//*[@class="sidebar-elems"]//section//a[@href="#structfield.f1"]' 'f1' // @has - '//*[@class="sidebar-elems"]//section//a[@href="#structfield.f2"]' 'f2' // @!has - '//*[@class="sidebar-elems"]//section//a' 'waza' diff --git a/src/test/rustdoc/sidebar-links-to-foreign-impl.rs b/src/test/rustdoc/sidebar-links-to-foreign-impl.rs index 155150396..11e946948 100644 --- a/src/test/rustdoc/sidebar-links-to-foreign-impl.rs +++ b/src/test/rustdoc/sidebar-links-to-foreign-impl.rs @@ -3,12 +3,12 @@ #![crate_name = "foo"] // @has foo/trait.Foo.html -// @has - '//*[@class="sidebar-title"]/a[@href="#foreign-impls"]' 'Implementations on Foreign Types' +// @has - '//div[@class="sidebar-elems"]//h3/a[@href="#foreign-impls"]' 'Implementations on Foreign Types' // @has - '//h2[@id="foreign-impls"]' 'Implementations on Foreign Types' // @has - '//*[@class="sidebar-elems"]//section//a[@href="#impl-Foo-for-u32"]' 'u32' -// @has - '//*[@id="impl-Foo-for-u32"]//h3[@class="code-header in-band"]' 'impl Foo for u32' +// @has - '//*[@id="impl-Foo-for-u32"]//h3[@class="code-header"]' 'impl Foo for u32' // @has - '//*[@class="sidebar-elems"]//section//a[@href="#impl-Foo-for-%26%27a%20str"]' "&'a str" -// @has - '//*[@id="impl-Foo-for-%26%27a%20str"]//h3[@class="code-header in-band"]' "impl<'a> Foo for &'a str" +// @has - '//*[@id="impl-Foo-for-%26%27a%20str"]//h3[@class="code-header"]' "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 9d2c19677..feef4de8d 100644 --- a/src/test/rustdoc/sized_trait.rs +++ b/src/test/rustdoc/sized_trait.rs @@ -1,17 +1,17 @@ #![crate_name = "foo"] // @has foo/struct.Bar.html -// @!has - '//*[@id="impl-Sized"]' +// @!has - '//*[@id="impl-Sized"]' '' pub struct Bar { a: u16, } // @has foo/struct.Foo.html -// @!has - '//*[@id="impl-Sized"]' +// @!has - '//*[@id="impl-Sized"]' '' pub struct Foo<T: ?Sized>(T); // @has foo/struct.Unsized.html -// @has - '//*[@id="impl-Sized-for-Unsized"]//h3[@class="code-header in-band"]' 'impl !Sized for Unsized' +// @has - '//*[@id="impl-Sized-for-Unsized"]//h3[@class="code-header"]' 'impl !Sized for Unsized' pub struct Unsized { data: [u8], } diff --git a/src/test/rustdoc/sort-modules-by-appearance.rs b/src/test/rustdoc/sort-modules-by-appearance.rs index 5be6b9826..b5cc8bc83 100644 --- a/src/test/rustdoc/sort-modules-by-appearance.rs +++ b/src/test/rustdoc/sort-modules-by-appearance.rs @@ -9,5 +9,5 @@ pub mod module_c {} pub mod module_a {} -// @matches 'sort_modules_by_appearance/index.html' '(?s)module_b.*module_c.*module_a' -// @matches 'sort_modules_by_appearance/sidebar-items.js' '"module_b".*"module_c".*"module_a"' +// @matchesraw 'sort_modules_by_appearance/index.html' '(?s)module_b.*module_c.*module_a' +// @matchesraw 'sort_modules_by_appearance/sidebar-items.js' '"module_b".*"module_c".*"module_a"' diff --git a/src/test/rustdoc/source-file.rs b/src/test/rustdoc/source-file.rs index 968899dab..4e1664790 100644 --- a/src/test/rustdoc/source-file.rs +++ b/src/test/rustdoc/source-file.rs @@ -1,5 +1,5 @@ #![crate_name = "foo"] -// @has source-files.js source-file.rs +// @hasraw source-files.js source-file.rs pub struct Foo; diff --git a/src/test/rustdoc/src-links-auto-impls.rs b/src/test/rustdoc/src-links-auto-impls.rs index 69be9aa8d..953563833 100644 --- a/src/test/rustdoc/src-links-auto-impls.rs +++ b/src/test/rustdoc/src-links-auto-impls.rs @@ -1,12 +1,12 @@ #![crate_name = "foo"] // @has foo/struct.Unsized.html -// @has - '//*[@id="impl-Sized-for-Unsized"]/h3[@class="code-header in-band"]' 'impl !Sized for Unsized' +// @has - '//*[@id="impl-Sized-for-Unsized"]/h3[@class="code-header"]' 'impl !Sized for Unsized' // @!has - '//*[@id="impl-Sized-for-Unsized"]//a[@class="srclink"]' 'source' -// @has - '//*[@id="impl-Sync-for-Unsized"]/h3[@class="code-header in-band"]' 'impl Sync for Unsized' +// @has - '//*[@id="impl-Sync-for-Unsized"]/h3[@class="code-header"]' 'impl Sync for Unsized' // @!has - '//*[@id="impl-Sync-for-Unsized"]//a[@class="srclink"]' 'source' -// @has - '//*[@id="impl-Any-for-Unsized"]/h3[@class="code-header in-band"]' 'impl<T> Any for T' -// @has - '//*[@id="impl-Any-for-Unsized"]//a[@class="srclink"]' 'source' +// @has - '//*[@id="impl-Any-for-Unsized"]/h3[@class="code-header"]' 'impl<T> Any for T' +// @has - '//*[@id="impl-Any-for-Unsized"]//a[@class="srclink rightside"]' 'source' pub struct Unsized { data: [u8], } diff --git a/src/test/rustdoc/static-root-path.rs b/src/test/rustdoc/static-root-path.rs index f1d49b9fc..08c055c5b 100644 --- a/src/test/rustdoc/static-root-path.rs +++ b/src/test/rustdoc/static-root-path.rs @@ -1,18 +1,18 @@ // compile-flags:-Z unstable-options --static-root-path /cache/ // @has static_root_path/struct.SomeStruct.html -// @matches - '"/cache/main\.js"' -// @!matches - '"\.\./main\.js"' -// @matches - 'data-root-path="\.\./"' -// @!matches - '"/cache/search-index\.js"' +// @matchesraw - '"/cache/main\.js"' +// @!matchesraw - '"\.\./main\.js"' +// @matchesraw - 'data-root-path="\.\./"' +// @!matchesraw - '"/cache/search-index\.js"' pub struct SomeStruct; // @has src/static_root_path/static-root-path.rs.html -// @matches - '"/cache/source-script\.js"' -// @!matches - '"\.\./\.\./source-script\.js"' -// @matches - '"\.\./\.\./source-files.js"' -// @!matches - '"/cache/source-files\.js"' +// @matchesraw - '"/cache/source-script\.js"' +// @!matchesraw - '"\.\./\.\./source-script\.js"' +// @matchesraw - '"\.\./\.\./source-files.js"' +// @!matchesraw - '"/cache/source-files\.js"' // @has settings.html -// @matches - '/cache/settings\.js' -// @!matches - '\./settings\.js' +// @matchesraw - '/cache/settings\.js' +// @!matchesraw - '\./settings\.js' diff --git a/src/test/rustdoc/strip-enum-variant.no-not-shown.html b/src/test/rustdoc/strip-enum-variant.no-not-shown.html index c4ee1a991..782198956 100644 --- a/src/test/rustdoc/strip-enum-variant.no-not-shown.html +++ b/src/test/rustdoc/strip-enum-variant.no-not-shown.html @@ -1 +1 @@ -<ul><li><a href="#variant.Shown">Shown</a></li></ul>
\ No newline at end of file +<ul class="block"><li><a href="#variant.Shown">Shown</a></li></ul>
\ No newline at end of file diff --git a/src/test/rustdoc/strip-enum-variant.rs b/src/test/rustdoc/strip-enum-variant.rs index f82ffdfed..8753a7dc6 100644 --- a/src/test/rustdoc/strip-enum-variant.rs +++ b/src/test/rustdoc/strip-enum-variant.rs @@ -3,7 +3,7 @@ // @!has - '//code' 'NotShown' // @has - '//code' '// some variants omitted' // Also check that `NotShown` isn't displayed in the sidebar. -// @snapshot no-not-shown - '//*[@class="sidebar-elems"]/section/*[@class="block"][1]/ul' +// @snapshot no-not-shown - '//*[@class="sidebar-elems"]/section/*[@class="block"][1]' pub enum MyThing { Shown, #[doc(hidden)] diff --git a/src/test/rustdoc/synthetic_auto/basic.rs b/src/test/rustdoc/synthetic_auto/basic.rs index 54c54fdbf..7c6a38865 100644 --- a/src/test/rustdoc/synthetic_auto/basic.rs +++ b/src/test/rustdoc/synthetic_auto/basic.rs @@ -1,6 +1,6 @@ // @has basic/struct.Foo.html -// @has - '//h3[@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' +// @has - '//h3[@class="code-header"]' 'impl<T> Send for Foo<T>where T: Send' +// @has - '//h3[@class="code-header"]' '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> { diff --git a/src/test/rustdoc/synthetic_auto/complex.rs b/src/test/rustdoc/synthetic_auto/complex.rs index f9017b90c..43393c21f 100644 --- a/src/test/rustdoc/synthetic_auto/complex.rs +++ b/src/test/rustdoc/synthetic_auto/complex.rs @@ -20,8 +20,8 @@ mod foo { } // @has complex/struct.NotOuter.html -// @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)) \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// "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" pub use foo::{Foo, Inner as NotInner, MyTrait as NotMyTrait, Outer as NotOuter}; diff --git a/src/test/rustdoc/synthetic_auto/crate-local.rs b/src/test/rustdoc/synthetic_auto/crate-local.rs index 58b787dfa..ed01f63f9 100644 --- a/src/test/rustdoc/synthetic_auto/crate-local.rs +++ b/src/test/rustdoc/synthetic_auto/crate-local.rs @@ -3,7 +3,7 @@ pub auto trait Banana {} // @has crate_local/struct.Peach.html -// @has - '//h3[@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' +// @has - '//h3[@class="code-header"]' 'impl Banana for Peach' +// @has - '//h3[@class="code-header"]' 'impl Send for Peach' +// @has - '//h3[@class="code-header"]' '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 ee1393f97..33170a844 100644 --- a/src/test/rustdoc/synthetic_auto/lifetimes.rs +++ b/src/test/rustdoc/synthetic_auto/lifetimes.rs @@ -9,11 +9,11 @@ where {} // @has lifetimes/struct.Foo.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ -// "impl<'c, K> Send for Foo<'c, K> where K: for<'b> Fn(&'b bool) -> &'c u8, 'c: 'static" +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// "impl<'c, K> Send for Foo<'c, K>where K: for<'b> Fn(&'b bool) -> &'c u8, 'c: 'static" // -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ -// "impl<'c, K> Sync for Foo<'c, K> where K: Sync" +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// "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 49bad1622..77c04ad2a 100644 --- a/src/test/rustdoc/synthetic_auto/manual.rs +++ b/src/test/rustdoc/synthetic_auto/manual.rs @@ -1,8 +1,8 @@ // @has manual/struct.Foo.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ -// 'impl<T> Sync for Foo<T> where T: Sync' +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// 'impl<T> Sync for Foo<T>where T: Sync' // -// @has - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ +// @has - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ // 'impl<T> Send for Foo<T>' // // @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 66e749ac3..2c2c848a5 100644 --- a/src/test/rustdoc/synthetic_auto/negative.rs +++ b/src/test/rustdoc/synthetic_auto/negative.rs @@ -3,10 +3,10 @@ pub struct Inner<T: Copy> { } // @has negative/struct.Outer.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ // "impl<T> !Send for Outer<T>" // -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ // "impl<T> !Sync for Outer<T>" pub struct Outer<T: Copy> { inner_field: Inner<T>, diff --git a/src/test/rustdoc/synthetic_auto/nested.rs b/src/test/rustdoc/synthetic_auto/nested.rs index 69edbee61..423bf115a 100644 --- a/src/test/rustdoc/synthetic_auto/nested.rs +++ b/src/test/rustdoc/synthetic_auto/nested.rs @@ -9,11 +9,11 @@ where } // @has nested/struct.Foo.html -// @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"]//h3[@class="code-header"]' \ +// 'impl<T> Send for Foo<T>where T: Copy' // -// @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="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// 'impl<T> Sync for Foo<T>where T: Sync' pub struct Foo<T> { inner_field: Inner<T>, } diff --git a/src/test/rustdoc/synthetic_auto/no-redundancy.rs b/src/test/rustdoc/synthetic_auto/no-redundancy.rs index 16ab876e8..59f336233 100644 --- a/src/test/rustdoc/synthetic_auto/no-redundancy.rs +++ b/src/test/rustdoc/synthetic_auto/no-redundancy.rs @@ -9,8 +9,8 @@ where } // @has no_redundancy/struct.Outer.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ -// "impl<T> Send for Outer<T> where T: Send + Copy" +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// "impl<T> Send for Outer<T>where T: Send + Copy" pub struct Outer<T> { inner_field: Inner<T>, } diff --git a/src/test/rustdoc/synthetic_auto/overflow.rs b/src/test/rustdoc/synthetic_auto/overflow.rs index c132ab6fb..35a487c76 100644 --- a/src/test/rustdoc/synthetic_auto/overflow.rs +++ b/src/test/rustdoc/synthetic_auto/overflow.rs @@ -21,7 +21,7 @@ enum TyData<I: Interner> { struct VariableKind<I: Interner>(I::InternedType); // @has overflow/struct.BoundVarsCollector.html -// @has - '//h3[@class="code-header in-band"]' "impl<'tcx> Send for BoundVarsCollector<'tcx>" +// @has - '//h3[@class="code-header"]' "impl<'tcx> Send for BoundVarsCollector<'tcx>" pub struct BoundVarsCollector<'tcx> { val: VariableKind<RustInterner<'tcx>> } diff --git a/src/test/rustdoc/synthetic_auto/project.rs b/src/test/rustdoc/synthetic_auto/project.rs index 8b0205825..558ff2add 100644 --- a/src/test/rustdoc/synthetic_auto/project.rs +++ b/src/test/rustdoc/synthetic_auto/project.rs @@ -23,11 +23,11 @@ where } // @has project/struct.Foo.html -// @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"]//h3[@class="code-header"]' \ +// "impl<'c, K> Send for Foo<'c, K>where K: MyTrait<MyItem = bool>, 'c: 'static" // -// @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, \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// "impl<'c, K> Sync for Foo<'c, K>where K: MyTrait, <K as MyTrait>::MyItem: OtherTrait, \ // 'c: 'static," pub struct Foo<'c, K: 'c> { inner_field: Inner<'c, K>, diff --git a/src/test/rustdoc/synthetic_auto/self-referential.rs b/src/test/rustdoc/synthetic_auto/self-referential.rs index ccef901b1..c6ae96de7 100644 --- a/src/test/rustdoc/synthetic_auto/self-referential.rs +++ b/src/test/rustdoc/synthetic_auto/self-referential.rs @@ -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"]//h3[@class="code-header in-band"]' \ -// "impl<P1> Send for WriteAndThen<P1> where <P1 as Pattern>::Value: Send" +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// "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; diff --git a/src/test/rustdoc/synthetic_auto/static-region.rs b/src/test/rustdoc/synthetic_auto/static-region.rs index 36e985144..1a76cb919 100644 --- a/src/test/rustdoc/synthetic_auto/static-region.rs +++ b/src/test/rustdoc/synthetic_auto/static-region.rs @@ -3,8 +3,8 @@ pub trait OwnedTrait<'a> { } // @has static_region/struct.Owned.html -// @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" +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// "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, } diff --git a/src/test/rustdoc/table-in-docblock.rs b/src/test/rustdoc/table-in-docblock.rs index 858b58919..194f49f16 100644 --- a/src/test/rustdoc/table-in-docblock.rs +++ b/src/test/rustdoc/table-in-docblock.rs @@ -2,7 +2,7 @@ // @has foo/struct.Foo.html // @count - '//*[@class="docblock"]/div/table' 2 -// @!has - '//*[@class="docblock"]/table' +// @!has - '//*[@class="docblock"]/table' '' /// | hello | hello2 | /// | ----- | ------ | /// | data | data2 | diff --git a/src/test/rustdoc/toggle-item-contents.rs b/src/test/rustdoc/toggle-item-contents.rs index c1df4613e..47a1d62f5 100644 --- a/src/test/rustdoc/toggle-item-contents.rs +++ b/src/test/rustdoc/toggle-item-contents.rs @@ -55,14 +55,14 @@ pub union Union { // @has 'toggle_item_contents/struct.PrivStruct.html' // @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 0 -// @has - '//div[@class="docblock item-decl"]' '/* private fields */' +// @has - '//div[@class="item-decl"]' '/* private fields */' pub struct PrivStruct { a: usize, b: usize, } // @has 'toggle_item_contents/enum.Enum.html' -// @!has - '//details[@class="rustdoc-toggle type-contents-toggle"]' +// @!has - '//details[@class="rustdoc-toggle type-contents-toggle"]' '' pub enum Enum { A, B, C, D { @@ -72,7 +72,7 @@ pub enum Enum { } // @has 'toggle_item_contents/enum.EnumStructVariant.html' -// @!has - '//details[@class="rustdoc-toggle type-contents-toggle"]' +// @!has - '//details[@class="rustdoc-toggle type-contents-toggle"]' '' pub enum EnumStructVariant { A, B, C, D { diff --git a/src/test/rustdoc/toggle-trait-fn.rs b/src/test/rustdoc/toggle-trait-fn.rs index 65e8daeb0..e41422ce7 100644 --- a/src/test/rustdoc/toggle-trait-fn.rs +++ b/src/test/rustdoc/toggle-trait-fn.rs @@ -4,12 +4,12 @@ // summary. Trait methods with no documentation should not be wrapped. // // @has foo/trait.Foo.html -// @has - '//details[@class="rustdoc-toggle"]//summary//h4[@class="code-header"]' 'is_documented()' -// @!has - '//details[@class="rustdoc-toggle"]//summary//h4[@class="code-header"]' 'not_documented()' -// @has - '//details[@class="rustdoc-toggle"]//*[@class="docblock"]' 'is_documented is documented' -// @has - '//details[@class="rustdoc-toggle"]//summary//h4[@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' +// @has - '//details[@class="rustdoc-toggle method-toggle"]//summary//h4[@class="code-header"]' 'is_documented()' +// @!has - '//details[@class="rustdoc-toggle method-toggle"]//summary//h4[@class="code-header"]' 'not_documented()' +// @has - '//details[@class="rustdoc-toggle method-toggle"]//*[@class="docblock"]' 'is_documented is documented' +// @has - '//details[@class="rustdoc-toggle method-toggle"]//summary//h4[@class="code-header"]' 'is_documented_optional()' +// @!has - '//details[@class="rustdoc-toggle method-toggle"]//summary//h4[@class="code-header"]' 'not_documented_optional()' +// @has - '//details[@class="rustdoc-toggle method-toggle"]//*[@class="docblock"]' 'is_documented_optional is documented' pub trait Foo { fn not_documented(); diff --git a/src/test/rustdoc/trait-impl-items-links-and-anchors.rs b/src/test/rustdoc/trait-impl-items-links-and-anchors.rs index b5a97c610..fba594c38 100644 --- a/src/test/rustdoc/trait-impl-items-links-and-anchors.rs +++ b/src/test/rustdoc/trait-impl-items-links-and-anchors.rs @@ -59,7 +59,7 @@ pub struct MyStruct; // We check that associated items with default values aren't generated in the implementors list. impl MyTrait for (u8, u8) { - // @!has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-4"]' + // @!has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-4"]' '' type Assoc = bool; fn trait_function(&self) {} } diff --git a/src/test/rustdoc/trait-impl.rs b/src/test/rustdoc/trait-impl.rs index 4f7e2dfe3..195cdf009 100644 --- a/src/test/rustdoc/trait-impl.rs +++ b/src/test/rustdoc/trait-impl.rs @@ -21,26 +21,26 @@ pub trait Trait { pub struct Struct; impl Trait for Struct { - // @has trait_impl/struct.Struct.html '//*[@id="method.a"]/../../div[@class="docblock"]/p' 'Some long docs' - // @!has - '//*[@id="method.a"]/../../div[@class="docblock"]/p' 'link will be added' - // @has - '//*[@id="method.a"]/../../div[@class="docblock"]/p/a' 'Read more' - // @has - '//*[@id="method.a"]/../../div[@class="docblock"]/p/a/@href' 'trait.Trait.html#tymethod.a' + // @has trait_impl/struct.Struct.html '//*[@id="method.a"]/../../div[@class="docblock"]' 'Some long docs' + // @!has - '//*[@id="method.a"]/../../div[@class="docblock"]' 'link will be added' + // @has - '//*[@id="method.a"]/../../div[@class="docblock"]/a' 'Read more' + // @has - '//*[@id="method.a"]/../../div[@class="docblock"]/a/@href' 'trait.Trait.html#tymethod.a' fn a() {} - // @has - '//*[@id="method.b"]/../../div[@class="docblock"]/p' 'These docs contain' - // @has - '//*[@id="method.b"]/../../div[@class="docblock"]/p/a' 'reference link' - // @has - '//*[@id="method.b"]/../../div[@class="docblock"]/p/a/@href' 'https://example.com' - // @has - '//*[@id="method.b"]/../../div[@class="docblock"]/p/a' 'Read more' - // @has - '//*[@id="method.b"]/../../div[@class="docblock"]/p/a/@href' 'trait.Trait.html#tymethod.b' + // @has - '//*[@id="method.b"]/../../div[@class="docblock"]' 'These docs contain' + // @has - '//*[@id="method.b"]/../../div[@class="docblock"]/a' 'reference link' + // @has - '//*[@id="method.b"]/../../div[@class="docblock"]/a/@href' 'https://example.com' + // @has - '//*[@id="method.b"]/../../div[@class="docblock"]/a' 'Read more' + // @has - '//*[@id="method.b"]/../../div[@class="docblock"]/a/@href' 'trait.Trait.html#tymethod.b' fn b() {} - // @!has - '//*[@id="method.c"]/../../div[@class="docblock"]/p' 'code block' + // @!has - '//*[@id="method.c"]/../../div[@class="docblock"]' 'code block' // @has - '//*[@id="method.c"]/../../div[@class="docblock"]/a' 'Read more' // @has - '//*[@id="method.c"]/../../div[@class="docblock"]/a/@href' 'trait.Trait.html#tymethod.c' fn c() {} - // @has - '//*[@id="method.d"]/../../div[@class="docblock"]/p' 'Escaped formatting a*b*c* works' - // @!has - '//*[@id="method.d"]/../../div[@class="docblock"]/p/em' + // @has - '//*[@id="method.d"]/../../div[@class="docblock"]' 'Escaped formatting a*b*c* works' + // @!has - '//*[@id="method.d"]/../../div[@class="docblock"]/em' '' fn d() {} // @has - '//*[@id="impl-Trait-for-Struct"]/h3//a/@href' 'trait.Trait.html' diff --git a/src/test/rustdoc/trait_alias.rs b/src/test/rustdoc/trait_alias.rs index a0c657d9a..791c099cc 100644 --- a/src/test/rustdoc/trait_alias.rs +++ b/src/test/rustdoc/trait_alias.rs @@ -14,13 +14,13 @@ use std::fmt::Debug; // @has foo/index.html '//a[@class="traitalias"]' 'Foo' // @has foo/traitalias.CopyAlias.html -// @has - '//section[@id="main-content"]/div[@class="docblock item-decl"]/pre' 'trait CopyAlias = Copy;' +// @has - '//section[@id="main-content"]/div[@class="item-decl"]/pre' 'trait CopyAlias = Copy;' pub trait CopyAlias = Copy; // @has foo/traitalias.Alias2.html -// @has - '//section[@id="main-content"]/div[@class="docblock item-decl"]/pre' 'trait Alias2 = Copy + Debug;' +// @has - '//section[@id="main-content"]/div[@class="item-decl"]/pre' 'trait Alias2 = Copy + Debug;' pub trait Alias2 = Copy + Debug; // @has foo/traitalias.Foo.html -// @has - '//section[@id="main-content"]/div[@class="docblock item-decl"]/pre' 'trait Foo<T> = Into<T> + Debug;' +// @has - '//section[@id="main-content"]/div[@class="item-decl"]/pre' 'trait Foo<T> = Into<T> + Debug;' pub trait Foo<T> = Into<T> + Debug; // @has foo/fn.bar.html '//a[@href="traitalias.Alias2.html"]' 'Alias2' pub fn bar<T>() where T: Alias2 {} diff --git a/src/test/rustdoc/traits-in-bodies.rs b/src/test/rustdoc/traits-in-bodies.rs index 6d450a625..a65dd7a54 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: Clone>(T); // @has traits_in_bodies/struct.SomeStruct.html -// @has - '//h3[@class="code-header in-band"]' 'impl Clone for SomeStruct' +// @has - '//h3[@class="code-header"]' '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 - '//h3[@class="code-header in-band"]' 'impl Copy for Point' +// @has - '//h3[@class="code-header"]' 'impl Copy for Point' #[derive(Clone)] pub struct Point { x: i32, @@ -31,7 +31,7 @@ const _FOO: () = { }; // @has traits_in_bodies/struct.Inception.html -// @has - '//h3[@class="code-header in-band"]' 'impl Clone for Inception' +// @has - '//h3[@class="code-header"]' 'impl Clone for Inception' pub struct Inception; static _BAR: usize = { diff --git a/src/test/rustdoc/tuple-struct-fields-doc.rs b/src/test/rustdoc/tuple-struct-fields-doc.rs index 31426131b..8ab1143d1 100644 --- a/src/test/rustdoc/tuple-struct-fields-doc.rs +++ b/src/test/rustdoc/tuple-struct-fields-doc.rs @@ -2,10 +2,10 @@ // @has foo/struct.Foo.html // @has - '//h2[@id="fields"]' 'Tuple Fields' -// @has - '//h3[@class="sidebar-title"]/a[@href="#fields"]' 'Tuple Fields' +// @has - '//div[@class="sidebar-elems"]//h3/a[@href="#fields"]' 'Tuple Fields' // @has - '//*[@id="structfield.0"]' '0: u32' // @has - '//*[@id="main-content"]/div[@class="docblock"]' 'hello' -// @!has - '//*[@id="structfield.1"]' +// @!has - '//*[@id="structfield.1"]' '' // @has - '//*[@id="structfield.2"]' '2: char' // @has - '//*[@id="structfield.3"]' '3: i8' // @has - '//*[@id="main-content"]/div[@class="docblock"]' 'not hello' diff --git a/src/test/rustdoc/type-layout-flag-required.rs b/src/test/rustdoc/type-layout-flag-required.rs index a01fbd229..6bb5e10f8 100644 --- a/src/test/rustdoc/type-layout-flag-required.rs +++ b/src/test/rustdoc/type-layout-flag-required.rs @@ -1,4 +1,4 @@ // Tests that `--show-type-layout` is required in order to show layout info. -// @!has type_layout_flag_required/struct.Foo.html 'Size: ' +// @!hasraw type_layout_flag_required/struct.Foo.html 'Size: ' pub struct Foo(usize); diff --git a/src/test/rustdoc/type-layout.rs b/src/test/rustdoc/type-layout.rs index e5c6e9dc3..5e0a0411a 100644 --- a/src/test/rustdoc/type-layout.rs +++ b/src/test/rustdoc/type-layout.rs @@ -1,84 +1,84 @@ // compile-flags: --show-type-layout -Z unstable-options -// @has type_layout/struct.Foo.html 'Size: ' -// @has - ' bytes' +// @hasraw type_layout/struct.Foo.html 'Size: ' +// @hasraw - ' bytes' // @has - '//*[@id="layout"]/a[@href="#layout"]' '' pub struct Foo { pub a: usize, b: Vec<String>, } -// @has type_layout/enum.Bar.html 'Size: ' -// @has - ' bytes' +// @hasraw type_layout/enum.Bar.html 'Size: ' +// @hasraw - ' bytes' pub enum Bar<'a> { A(String), B(&'a str, (std::collections::HashMap<String, usize>, Foo)), } -// @has type_layout/union.Baz.html 'Size: ' -// @has - ' bytes' +// @hasraw type_layout/union.Baz.html 'Size: ' +// @hasraw - ' bytes' pub union Baz { a: &'static str, b: usize, c: &'static [u8], } -// @has type_layout/struct.X.html 'Size: ' -// @has - ' bytes' +// @hasraw type_layout/struct.X.html 'Size: ' +// @hasraw - ' bytes' pub struct X(usize); -// @has type_layout/struct.Y.html 'Size: ' -// @has - '1 byte' -// @!has - ' bytes' +// @hasraw type_layout/struct.Y.html 'Size: ' +// @hasraw - '1 byte' +// @!hasraw - ' bytes' pub struct Y(u8); -// @has type_layout/struct.Z.html 'Size: ' -// @has - '0 bytes' +// @hasraw type_layout/struct.Z.html 'Size: ' +// @hasraw - '0 bytes' pub struct Z; // We can't compute layout for generic types. -// @has type_layout/struct.Generic.html 'Unable to compute type layout, possibly due to this type having generic parameters' -// @!has - 'Size: ' +// @hasraw type_layout/struct.Generic.html 'Unable to compute type layout, possibly due to this type having generic parameters' +// @!hasraw - 'Size: ' pub struct Generic<T>(T); // We *can*, however, compute layout for types that are only generic over lifetimes, // because lifetimes are a type-system construct. -// @has type_layout/struct.GenericLifetimes.html 'Size: ' -// @has - ' bytes' +// @hasraw type_layout/struct.GenericLifetimes.html 'Size: ' +// @hasraw - ' bytes' pub struct GenericLifetimes<'a>(&'a str); -// @has type_layout/struct.Unsized.html 'Size: ' -// @has - '(unsized)' +// @hasraw type_layout/struct.Unsized.html 'Size: ' +// @hasraw - '(unsized)' pub struct Unsized([u8]); -// @has type_layout/type.TypeAlias.html 'Size: ' -// @has - ' bytes' +// @hasraw type_layout/type.TypeAlias.html 'Size: ' +// @hasraw - ' bytes' pub type TypeAlias = X; -// @has type_layout/type.GenericTypeAlias.html 'Size: ' -// @has - '8 bytes' +// @hasraw type_layout/type.GenericTypeAlias.html 'Size: ' +// @hasraw - '8 bytes' pub type GenericTypeAlias = (Generic<(u32, ())>, Generic<u32>); // Regression test for the rustdoc equivalent of #85103. -// @has type_layout/type.Edges.html 'Encountered an error during type layout; the type failed to be normalized.' +// @hasraw type_layout/type.Edges.html 'Encountered an error during type layout; the type failed to be normalized.' pub type Edges<'a, E> = std::borrow::Cow<'a, [E]>; -// @!has type_layout/trait.MyTrait.html 'Size: ' +// @!hasraw type_layout/trait.MyTrait.html 'Size: ' pub trait MyTrait {} -// @has type_layout/enum.Variants.html 'Size: ' -// @has - '2 bytes' -// @has - '<code>A</code>: 0 bytes' -// @has - '<code>B</code>: 1 byte' +// @hasraw type_layout/enum.Variants.html 'Size: ' +// @hasraw - '2 bytes' +// @hasraw - '<code>A</code>: 0 bytes' +// @hasraw - '<code>B</code>: 1 byte' pub enum Variants { A, B(u8), } -// @has type_layout/enum.WithNiche.html 'Size: ' +// @hasraw type_layout/enum.WithNiche.html 'Size: ' // @has - //p '4 bytes' -// @has - '<code>None</code>: 0 bytes' -// @has - '<code>Some</code>: 4 bytes' +// @hasraw - '<code>None</code>: 0 bytes' +// @hasraw - '<code>Some</code>: 4 bytes' pub enum WithNiche { None, Some(std::num::NonZeroU32), diff --git a/src/test/rustdoc/typedef.rs b/src/test/rustdoc/typedef.rs index 4ecd62cde..d5dfa9484 100644 --- a/src/test/rustdoc/typedef.rs +++ b/src/test/rustdoc/typedef.rs @@ -9,9 +9,9 @@ impl MyStruct { } // @has typedef/type.MyAlias.html -// @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="impl has-srclink"]//h3[@class="code-header"]' 'impl MyAlias' +// @has - '//*[@class="impl has-srclink"]//h3[@class="code-header"]' 'impl MyTrait for MyAlias' +// @hasraw - 'Alias docstring' // @has - '//*[@class="sidebar"]//*[@class="location"]' 'MyAlias' // @has - '//*[@class="sidebar"]//a[@href="#implementations"]' 'Methods' // @has - '//*[@class="sidebar"]//a[@href="#trait-implementations"]' 'Trait Implementations' diff --git a/src/test/rustdoc/universal-impl-trait.rs b/src/test/rustdoc/universal-impl-trait.rs index b10b1b865..f5eabda59 100644 --- a/src/test/rustdoc/universal-impl-trait.rs +++ b/src/test/rustdoc/universal-impl-trait.rs @@ -5,15 +5,15 @@ use std::borrow::Borrow; // @has foo/fn.foo.html // @has - //pre 'foo(' -// @matches - '_x: impl <a class="trait" href="[^"]+/trait\.Clone\.html"' -// @matches - '_z: .+impl.+trait\.Copy\.html.+, impl.+trait\.Clone\.html' +// @matchesraw - '_x: impl <a class="trait" href="[^"]+/trait\.Clone\.html"' +// @matchesraw - '_z: .+impl.+trait\.Copy\.html.+, impl.+trait\.Clone\.html' pub fn foo(_x: impl Clone, _y: i32, _z: (impl Copy, impl Clone)) { } pub trait Trait { // @has foo/trait.Trait.html - // @has - 'method</a>(' - // @matches - '_x: impl <a class="trait" href="[^"]+/trait\.Debug\.html"' + // @hasraw - 'method</a>(' + // @matchesraw - '_x: impl <a class="trait" href="[^"]+/trait\.Debug\.html"' fn method(&self, _x: impl std::fmt::Debug) { } } @@ -22,30 +22,30 @@ pub struct S<T>(T); impl<T> S<T> { // @has foo/struct.S.html - // @has - 'bar</a>(' - // @matches - '_bar: impl <a class="trait" href="[^"]+/trait\.Copy\.html"' + // @hasraw - 'bar</a>(' + // @matchesraw - '_bar: impl <a class="trait" href="[^"]+/trait\.Copy\.html"' pub fn bar(_bar: impl Copy) { } - // @has - 'baz</a>(' - // @matches - '_baz:.+struct\.S\.html.+impl .+trait\.Clone\.html' + // @hasraw - 'baz</a>(' + // @matchesraw - '_baz:.+struct\.S\.html.+impl .+trait\.Clone\.html' pub fn baz(_baz: S<impl Clone>) { } - // @has - 'qux</a>(' - // @matches - 'trait\.Read\.html' + // @hasraw - 'qux</a>(' + // @matchesraw - 'trait\.Read\.html' pub fn qux(_qux: impl IntoIterator<Item = S<impl Read>>) { } } -// @has - 'method</a>(' -// @matches - '_x: impl <a class="trait" href="[^"]+/trait\.Debug\.html"' +// @hasraw - 'method</a>(' +// @matchesraw - '_x: impl <a class="trait" href="[^"]+/trait\.Debug\.html"' impl<T> Trait for S<T> {} // @has foo/fn.much_universe.html -// @matches - 'T:.+Borrow.+impl .+trait\.Trait\.html' -// @matches - 'U:.+IntoIterator.+= impl.+Iterator\.html.+= impl.+Clone\.html' -// @matches - '_: impl .+trait\.Read\.html.+ \+ .+trait\.Clone\.html' +// @matchesraw - 'T:.+Borrow.+impl .+trait\.Trait\.html' +// @matchesraw - 'U:.+IntoIterator.+= impl.+Iterator\.html.+= impl.+Clone\.html' +// @matchesraw - '_: impl .+trait\.Read\.html.+ \+ .+trait\.Clone\.html' pub fn much_universe< T: Borrow<impl Trait>, U: IntoIterator<Item = impl Iterator<Item = impl Clone>>, diff --git a/src/test/rustdoc/version-separator-without-source.rs b/src/test/rustdoc/version-separator-without-source.rs index ae866deba..04ea46a7f 100644 --- a/src/test/rustdoc/version-separator-without-source.rs +++ b/src/test/rustdoc/version-separator-without-source.rs @@ -16,7 +16,7 @@ pub fn foo() {} pub struct Bar; impl Bar { - // @has - '//*[@id="method.bar"]/*[@class="rightside"]' '2.0' + // @has - '//*[@id="method.bar"]/*[@class="since rightside"]' '2.0' // @!has - '//*[@id="method.bar"]/*[@class="rightside"]' '2.0 ยท' #[stable(feature = "foobar", since = "2.0")] pub fn bar() {} diff --git a/src/test/rustdoc/where-clause-order.rs b/src/test/rustdoc/where-clause-order.rs index 3150a8ea0..b8502e10a 100644 --- a/src/test/rustdoc/where-clause-order.rs +++ b/src/test/rustdoc/where-clause-order.rs @@ -7,7 +7,7 @@ where } // @has 'foo/trait.SomeTrait.html' -// @has - "//*[@id='impl-SomeTrait%3C(A%2C%20B%2C%20C%2C%20D%2C%20E)%3E-for-(A%2C%20B%2C%20C%2C%20D%2C%20E)']/h3" "impl<A, B, C, D, E> SomeTrait<(A, B, C, D, E)> for (A, B, C, D, E) where A: PartialOrd<A> + PartialEq<A>, B: PartialOrd<B> + PartialEq<B>, C: PartialOrd<C> + PartialEq<C>, D: PartialOrd<D> + PartialEq<D>, E: PartialOrd<E> + PartialEq<E> + ?Sized, " +// @has - "//*[@id='impl-SomeTrait%3C(A%2C%20B%2C%20C%2C%20D%2C%20E)%3E-for-(A%2C%20B%2C%20C%2C%20D%2C%20E)']/h3" "impl<A, B, C, D, E> SomeTrait<(A, B, C, D, E)> for (A, B, C, D, E)where A: PartialOrd<A> + PartialEq<A>, B: PartialOrd<B> + PartialEq<B>, C: PartialOrd<C> + PartialEq<C>, D: PartialOrd<D> + PartialEq<D>, E: PartialOrd<E> + PartialEq<E> + ?Sized, " impl<A, B, C, D, E> SomeTrait<(A, B, C, D, E)> for (A, B, C, D, E) where A: PartialOrd<A> + PartialEq<A>, diff --git a/src/test/rustdoc/where.SWhere_Simd_item-decl.html b/src/test/rustdoc/where.SWhere_Simd_item-decl.html index 0133bcaeb..6c1b5d315 100644 --- a/src/test/rustdoc/where.SWhere_Simd_item-decl.html +++ b/src/test/rustdoc/where.SWhere_Simd_item-decl.html @@ -1 +1 @@ -<div class="docblock item-decl"><pre class="rust struct"><code>pub struct Simd<T>(_) <br /><span class="where">where<br />    T: <a class="trait" href="trait.MyTrait.html" title="trait foo::MyTrait">MyTrait</a></span>;</code></pre></div>
\ No newline at end of file +<div class="item-decl"><pre class="rust struct"><code>pub struct Simd<T>(_)<br /><span class="where">where<br />    T: <a class="trait" href="trait.MyTrait.html" title="trait foo::MyTrait">MyTrait</a></span>;</code></pre></div>
\ No newline at end of file diff --git a/src/test/rustdoc/where.SWhere_TraitWhere_item-decl.html b/src/test/rustdoc/where.SWhere_TraitWhere_item-decl.html index 54026ff03..24ab77703 100644 --- a/src/test/rustdoc/where.SWhere_TraitWhere_item-decl.html +++ b/src/test/rustdoc/where.SWhere_TraitWhere_item-decl.html @@ -1,3 +1,8 @@ -<div class="docblock item-decl"><pre class="rust trait"><code>pub trait TraitWhere { - type <a href="#associatedtype.Item" class="associatedtype">Item</a><'a><br />    <span class="where">where<br />        Self: 'a</span>; +<div class="item-decl"><pre class="rust trait"><code>pub trait TraitWhere { + type <a href="#associatedtype.Item" class="associatedtype">Item</a><'a><br />    <span class="where">where<br />        Self: 'a</span>; + + fn <a href="#method.func" class="fnname">func</a>(self)<br />    <span class="where">where<br />        Self: <a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span>, + { ... } +<span class="item-spacer" /> fn <a href="#method.lines" class="fnname">lines</a>(self) -> <a class="struct" href="{{channel}}/std/io/struct.Lines.html" title="struct std::io::Lines">Lines</a><Self><br />    <span class="where">where<br />        Self: <a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span>, + { ... } }</code></pre></div>
\ No newline at end of file diff --git a/src/test/rustdoc/where.rs b/src/test/rustdoc/where.rs index 50a5722fb..8b5bce28f 100644 --- a/src/test/rustdoc/where.rs +++ b/src/test/rustdoc/where.rs @@ -1,19 +1,20 @@ -#![feature(generic_associated_types)] #![crate_name = "foo"] +use std::io::Lines; + pub trait MyTrait { fn dummy(&self) { } } -// @has foo/struct.Alpha.html '//pre' "pub struct Alpha<A>(_) where A: MyTrait" +// @has foo/struct.Alpha.html '//pre' "pub struct Alpha<A>(_)where A: MyTrait" pub struct Alpha<A>(A) where A: MyTrait; -// @has foo/trait.Bravo.html '//pre' "pub trait Bravo<B> where B: MyTrait" +// @has foo/trait.Bravo.html '//pre' "pub trait Bravo<B>where B: MyTrait" pub trait Bravo<B> where B: MyTrait { fn get(&self, B: B); } -// @has foo/fn.charlie.html '//pre' "pub fn charlie<C>() where C: MyTrait" +// @has foo/fn.charlie.html '//pre' "pub fn charlie<C>()where C: MyTrait" pub fn charlie<C>() where C: MyTrait {} pub struct Delta<D>(D); -// @has foo/struct.Delta.html '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \ -// "impl<D> Delta<D> where D: MyTrait" +// @has foo/struct.Delta.html '//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// "impl<D> Delta<D>where D: MyTrait" impl<D> Delta<D> where D: MyTrait { pub fn delta() {} } @@ -21,31 +22,41 @@ impl<D> Delta<D> where D: MyTrait { pub struct Echo<E>(E); // @has 'foo/struct.Simd.html' -// @snapshot SWhere_Simd_item-decl - '//div[@class="docblock item-decl"]' +// @snapshot SWhere_Simd_item-decl - '//div[@class="item-decl"]' pub struct Simd<T>([T; 1]) where T: MyTrait; // @has 'foo/trait.TraitWhere.html' -// @snapshot SWhere_TraitWhere_item-decl - '//div[@class="docblock item-decl"]' +// @snapshot SWhere_TraitWhere_item-decl - '//div[@class="item-decl"]' pub trait TraitWhere { type Item<'a> where Self: 'a; + + fn func(self) + where + Self: Sized + {} + + fn lines(self) -> Lines<Self> + where + Self: Sized, + { todo!() } } -// @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"]//h3[@class="code-header in-band"]' \ -// "impl<E> MyTrait for Echo<E> where E: MyTrait" -impl<E> MyTrait for Echo<E> where E: MyTrait {} +// @has foo/struct.Echo.html '//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// "impl<E> MyTrait for Echo<E>where E: MyTrait" +// @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//h3[@class="code-header"]' \ +// "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"]//h3[@class="code-header in-band"]' \ -// "impl<F> MyTrait for Foxtrot<F> where F: MyTrait" -// @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 {} +// @has foo/enum.Foxtrot.html '//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// "impl<F> MyTrait for Foxtrot<F>where F: MyTrait" +// @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//h3[@class="code-header"]' \ +// "impl<F> MyTrait for Foxtrot<F>where F: MyTrait" +impl<F> MyTrait for Foxtrot<F>where F: MyTrait {} // @has foo/type.Golf.html '//pre[@class="rust typedef"]' \ -// "type Golf<T> where T: Clone, = (T, T)" +// "type Golf<T>where T: Clone, = (T, T)" pub type Golf<T> where T: Clone = (T, T); diff --git a/src/test/rustdoc/whitespace-after-where-clause.enum.html b/src/test/rustdoc/whitespace-after-where-clause.enum.html index 9e5bf45ae..c74866f4a 100644 --- a/src/test/rustdoc/whitespace-after-where-clause.enum.html +++ b/src/test/rustdoc/whitespace-after-where-clause.enum.html @@ -1,4 +1,4 @@ -<div class="docblock item-decl"><pre class="rust enum"><code>pub enum Cow<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a> <span class="where fmt-newline">where<br />    B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>>, </span>{ +<div class="item-decl"><pre class="rust enum"><code>pub enum Cow<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a><span class="where fmt-newline">where<br />    B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>>,</span>{ Borrowed(<a class="primitive" href="{{channel}}/std/primitive.reference.html">&'a </a>B), Whatever(<a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>), -}</code></pre></div> +}</code></pre></div>
\ No newline at end of file diff --git a/src/test/rustdoc/whitespace-after-where-clause.enum2.html b/src/test/rustdoc/whitespace-after-where-clause.enum2.html index 6bc47beae..ac7d77598 100644 --- a/src/test/rustdoc/whitespace-after-where-clause.enum2.html +++ b/src/test/rustdoc/whitespace-after-where-clause.enum2.html @@ -1,4 +1,4 @@ -<div class="docblock item-decl"><pre class="rust enum"><code>pub enum Cow2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + 'a> { +<div class="item-decl"><pre class="rust enum"><code>pub enum Cow2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + 'a> { Borrowed(<a class="primitive" href="{{channel}}/std/primitive.reference.html">&'a </a>B), Whatever(<a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>), -}</code></pre></div> +}</code></pre></div>
\ No newline at end of file diff --git a/src/test/rustdoc/whitespace-after-where-clause.rs b/src/test/rustdoc/whitespace-after-where-clause.rs index c36386a2a..4b740b970 100644 --- a/src/test/rustdoc/whitespace-after-where-clause.rs +++ b/src/test/rustdoc/whitespace-after-where-clause.rs @@ -4,7 +4,7 @@ #![crate_name = "foo"] // @has 'foo/trait.ToOwned.html' -// @snapshot trait - '//*[@class="docblock item-decl"]' +// @snapshot trait - '//*[@class="item-decl"]' pub trait ToOwned<T> where T: Clone { @@ -14,7 +14,7 @@ where T: Clone } // @has 'foo/trait.ToOwned2.html' -// @snapshot trait2 - '//*[@class="docblock item-decl"]' +// @snapshot trait2 - '//*[@class="item-decl"]' // There should be a whitespace before `{` in this case! pub trait ToOwned2<T: Clone> { type Owned; @@ -23,7 +23,7 @@ pub trait ToOwned2<T: Clone> { } // @has 'foo/enum.Cow.html' -// @snapshot enum - '//*[@class="docblock item-decl"]' +// @snapshot enum - '//*[@class="item-decl"]' pub enum Cow<'a, B: ?Sized + 'a> where B: ToOwned<Clone>, @@ -33,7 +33,7 @@ where } // @has 'foo/enum.Cow2.html' -// @snapshot enum2 - '//*[@class="docblock item-decl"]' +// @snapshot enum2 - '//*[@class="item-decl"]' // There should be a whitespace before `{` in this case! pub enum Cow2<'a, B: ?Sized + ToOwned<Clone> + 'a> { Borrowed(&'a B), @@ -41,7 +41,7 @@ pub enum Cow2<'a, B: ?Sized + ToOwned<Clone> + 'a> { } // @has 'foo/struct.Struct.html' -// @snapshot struct - '//*[@class="docblock item-decl"]' +// @snapshot struct - '//*[@class="item-decl"]' pub struct Struct<'a, B: ?Sized + 'a> where B: ToOwned<Clone>, @@ -51,7 +51,7 @@ where } // @has 'foo/struct.Struct2.html' -// @snapshot struct2 - '//*[@class="docblock item-decl"]' +// @snapshot struct2 - '//*[@class="item-decl"]' // There should be a whitespace before `{` in this case! pub struct Struct2<'a, B: ?Sized + ToOwned<Clone> + 'a> { pub a: &'a B, @@ -59,7 +59,7 @@ pub struct Struct2<'a, B: ?Sized + ToOwned<Clone> + 'a> { } // @has 'foo/union.Union.html' -// @snapshot union - '//*[@class="docblock item-decl"]' +// @snapshot union - '//*[@class="item-decl"]' pub union Union<'a, B: ?Sized + 'a> where B: ToOwned<Clone>, @@ -69,7 +69,7 @@ where } // @has 'foo/union.Union2.html' -// @snapshot union2 - '//*[@class="docblock item-decl"]' +// @snapshot union2 - '//*[@class="item-decl"]' // There should be a whitespace before `{` in this case! pub union Union2<'a, B: ?Sized + ToOwned<Clone> + 'a> { a: &'a B, diff --git a/src/test/rustdoc/whitespace-after-where-clause.struct.html b/src/test/rustdoc/whitespace-after-where-clause.struct.html index 236cc3b30..1ba1367d2 100644 --- a/src/test/rustdoc/whitespace-after-where-clause.struct.html +++ b/src/test/rustdoc/whitespace-after-where-clause.struct.html @@ -1,4 +1,4 @@ -<div class="docblock item-decl"><pre class="rust struct"><code>pub struct Struct<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a> <span class="where fmt-newline">where<br />    B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>>, </span>{ +<div class="item-decl"><pre class="rust struct"><code>pub struct Struct<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a><span class="where fmt-newline">where<br />    B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>>,</span>{ pub a: <a class="primitive" href="{{channel}}/std/primitive.reference.html">&'a </a>B, pub b: <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>, -}</code></pre></div> +}</code></pre></div>
\ No newline at end of file diff --git a/src/test/rustdoc/whitespace-after-where-clause.struct2.html b/src/test/rustdoc/whitespace-after-where-clause.struct2.html index 47f5c6ba9..fb06b0f77 100644 --- a/src/test/rustdoc/whitespace-after-where-clause.struct2.html +++ b/src/test/rustdoc/whitespace-after-where-clause.struct2.html @@ -1,4 +1,4 @@ -<div class="docblock item-decl"><pre class="rust struct"><code>pub struct Struct2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + 'a> { +<div class="item-decl"><pre class="rust struct"><code>pub struct Struct2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + 'a> { pub a: <a class="primitive" href="{{channel}}/std/primitive.reference.html">&'a </a>B, pub b: <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>, -}</code></pre></div> +}</code></pre></div>
\ No newline at end of file diff --git a/src/test/rustdoc/whitespace-after-where-clause.trait.html b/src/test/rustdoc/whitespace-after-where-clause.trait.html index 98f03b837..16b558237 100644 --- a/src/test/rustdoc/whitespace-after-where-clause.trait.html +++ b/src/test/rustdoc/whitespace-after-where-clause.trait.html @@ -1,6 +1,6 @@ -<div class="docblock item-decl"><pre class="rust trait"><code>pub trait ToOwned<T> <span class="where fmt-newline">where<br />    T: <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>, </span>{ +<div class="item-decl"><pre class="rust trait"><code>pub trait ToOwned<T><span class="where fmt-newline">where<br />    T: <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</span>{ type <a href="#associatedtype.Owned" class="associatedtype">Owned</a>; fn <a href="#tymethod.to_owned" class="fnname">to_owned</a>(&self) -> Self::<a class="associatedtype" href="trait.ToOwned.html#associatedtype.Owned" title="type foo::ToOwned::Owned">Owned</a>; <span class="item-spacer" /> fn <a href="#tymethod.whatever" class="fnname">whatever</a>(&self) -> T; -}</code></pre></div> +}</code></pre></div>
\ No newline at end of file diff --git a/src/test/rustdoc/whitespace-after-where-clause.trait2.html b/src/test/rustdoc/whitespace-after-where-clause.trait2.html index 35052869e..eeca6e1f5 100644 --- a/src/test/rustdoc/whitespace-after-where-clause.trait2.html +++ b/src/test/rustdoc/whitespace-after-where-clause.trait2.html @@ -1,6 +1,6 @@ -<div class="docblock item-decl"><pre class="rust trait"><code>pub trait ToOwned2<T: <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> { +<div class="item-decl"><pre class="rust trait"><code>pub trait ToOwned2<T: <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> { type <a href="#associatedtype.Owned" class="associatedtype">Owned</a>; fn <a href="#tymethod.to_owned" class="fnname">to_owned</a>(&self) -> Self::<a class="associatedtype" href="trait.ToOwned2.html#associatedtype.Owned" title="type foo::ToOwned2::Owned">Owned</a>; <span class="item-spacer" /> fn <a href="#tymethod.whatever" class="fnname">whatever</a>(&self) -> T; -}</code></pre></div> +}</code></pre></div>
\ No newline at end of file diff --git a/src/test/rustdoc/whitespace-after-where-clause.union.html b/src/test/rustdoc/whitespace-after-where-clause.union.html index 97e1bbcf3..0dfb6407d 100644 --- a/src/test/rustdoc/whitespace-after-where-clause.union.html +++ b/src/test/rustdoc/whitespace-after-where-clause.union.html @@ -1,3 +1,3 @@ -<div class="docblock item-decl"><pre class="rust union"><code>pub union Union<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a> <span class="where fmt-newline">where<br />    B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>>, </span>{ +<div class="item-decl"><pre class="rust union"><code>pub union Union<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a><span class="where fmt-newline">where<br />    B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>>,</span>{ /* private fields */ -}</code></pre></div> +}</code></pre></div>
\ No newline at end of file diff --git a/src/test/rustdoc/whitespace-after-where-clause.union2.html b/src/test/rustdoc/whitespace-after-where-clause.union2.html index 6c752a8b4..0d237df53 100644 --- a/src/test/rustdoc/whitespace-after-where-clause.union2.html +++ b/src/test/rustdoc/whitespace-after-where-clause.union2.html @@ -1,3 +1,3 @@ -<div class="docblock item-decl"><pre class="rust union"><code>pub union Union2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + 'a> { +<div class="item-decl"><pre class="rust union"><code>pub union Union2<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + 'a> { /* private fields */ -}</code></pre></div> +}</code></pre></div>
\ No newline at end of file |