diff options
Diffstat (limited to 'tests/rustdoc')
161 files changed, 842 insertions, 461 deletions
diff --git a/tests/rustdoc/anchors.no_const_anchor.html b/tests/rustdoc/anchors.no_const_anchor.html index 75e67330a..a8587829d 100644 --- a/tests/rustdoc/anchors.no_const_anchor.html +++ b/tests/rustdoc/anchors.no_const_anchor.html @@ -1 +1 @@ -<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 +<section id="associatedconstant.YOLO" class="method"><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/tests/rustdoc/anchors.no_const_anchor2.html b/tests/rustdoc/anchors.no_const_anchor2.html index c00251976..4c5e45fea 100644 --- a/tests/rustdoc/anchors.no_const_anchor2.html +++ b/tests/rustdoc/anchors.no_const_anchor2.html @@ -1 +1 @@ -<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 +<section id="associatedconstant.X" class="associatedconstant"><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/tests/rustdoc/anchors.no_method_anchor.html b/tests/rustdoc/anchors.no_method_anchor.html index b9ec8bf4c..44957a5b7 100644 --- a/tests/rustdoc/anchors.no_method_anchor.html +++ b/tests/rustdoc/anchors.no_method_anchor.html @@ -1 +1 @@ -<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="fn">new</a>() -> Self</h4></section>
\ No newline at end of file +<section id="method.new" class="method"><a class="srclink rightside" href="../src/foo/anchors.rs.html#48">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -> Self</h4></section>
\ No newline at end of file diff --git a/tests/rustdoc/anchors.no_trait_method_anchor.html b/tests/rustdoc/anchors.no_trait_method_anchor.html index 4308ddad4..75c2caf87 100644 --- a/tests/rustdoc/anchors.no_trait_method_anchor.html +++ b/tests/rustdoc/anchors.no_trait_method_anchor.html @@ -1 +1 @@ -<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="fn">bar</a>()</h4></section>
\ No newline at end of file +<section id="method.bar" class="method"><a class="srclink rightside" href="../src/foo/anchors.rs.html#23">source</a><h4 class="code-header">fn <a href="#method.bar" class="fn">bar</a>()</h4></section>
\ No newline at end of file diff --git a/tests/rustdoc/anchors.no_tymethod_anchor.html b/tests/rustdoc/anchors.no_tymethod_anchor.html index 91eed8a37..38575eadf 100644 --- a/tests/rustdoc/anchors.no_tymethod_anchor.html +++ b/tests/rustdoc/anchors.no_tymethod_anchor.html @@ -1 +1 @@ -<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="fn">foo</a>()</h4></section>
\ No newline at end of file +<section id="tymethod.foo" class="method"><a class="srclink rightside" href="../src/foo/anchors.rs.html#20">source</a><h4 class="code-header">fn <a href="#tymethod.foo" class="fn">foo</a>()</h4></section>
\ No newline at end of file diff --git a/tests/rustdoc/anchors.no_type_anchor.html b/tests/rustdoc/anchors.no_type_anchor.html index 2c66d5aa3..dd65d98fe 100644 --- a/tests/rustdoc/anchors.no_type_anchor.html +++ b/tests/rustdoc/anchors.no_type_anchor.html @@ -1 +1 @@ -<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 +<section id="associatedtype.T" class="method"><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/tests/rustdoc/anchors.no_type_anchor2.html b/tests/rustdoc/anchors.no_type_anchor2.html index 72a1186bf..f8b59160f 100644 --- a/tests/rustdoc/anchors.no_type_anchor2.html +++ b/tests/rustdoc/anchors.no_type_anchor2.html @@ -1 +1 @@ -<section id="associatedtype.Y" class="associatedtype has-srclink"><h4 class="code-header">type <a href="#associatedtype.Y" class="associatedtype">Y</a> = <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a></h4></section> +<section id="associatedtype.Y" class="associatedtype"><h4 class="code-header">type <a href="#associatedtype.Y" class="associatedtype">Y</a> = <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a></h4></section>
\ No newline at end of file diff --git a/tests/rustdoc/array-links.rs b/tests/rustdoc/array-links.rs index e7c0ee2de..8ee294daa 100644 --- a/tests/rustdoc/array-links.rs +++ b/tests/rustdoc/array-links.rs @@ -4,25 +4,25 @@ pub struct MyBox<T: ?Sized>(*const T); // @has 'foo/fn.alpha.html' -// @snapshot link_slice_u32 - '//div[@class="item-decl"]/pre[@class="rust"]/code' +// @snapshot link_slice_u32 - '//pre[@class="rust item-decl"]/code' pub fn alpha() -> &'static [u32; 1] { loop {} } // @has 'foo/fn.beta.html' -// @snapshot link_slice_generic - '//div[@class="item-decl"]/pre[@class="rust"]/code' +// @snapshot link_slice_generic - '//pre[@class="rust item-decl"]/code' pub fn beta<T>() -> &'static [T; 1] { loop {} } // @has 'foo/fn.gamma.html' -// @snapshot link_box_u32 - '//div[@class="item-decl"]/pre[@class="rust"]/code' +// @snapshot link_box_u32 - '//pre[@class="rust item-decl"]/code' pub fn gamma() -> MyBox<[u32; 1]> { loop {} } // @has 'foo/fn.delta.html' -// @snapshot link_box_generic - '//div[@class="item-decl"]/pre[@class="rust"]/code' +// @snapshot link_box_generic - '//pre[@class="rust item-decl"]/code' pub fn delta<T>() -> MyBox<[T; 1]> { loop {} } diff --git a/tests/rustdoc/assoc-consts.rs b/tests/rustdoc/assoc-consts.rs index 77b139b64..68a11c57b 100644 --- a/tests/rustdoc/assoc-consts.rs +++ b/tests/rustdoc/assoc-consts.rs @@ -1,5 +1,5 @@ pub trait Foo { - // @has assoc_consts/trait.Foo.html '//div[@class="item-decl"]/pre[@class="rust"]' \ + // @has assoc_consts/trait.Foo.html '//pre[@class="rust item-decl"]' \ // 'const FOO: usize = 13usize;' // @has - '//*[@id="associatedconstant.FOO"]' 'const FOO: usize' const FOO: usize = 12 + 1; diff --git a/tests/rustdoc/assoc-item-cast.rs b/tests/rustdoc/assoc-item-cast.rs index ab9702a24..ad8235985 100644 --- a/tests/rustdoc/assoc-item-cast.rs +++ b/tests/rustdoc/assoc-item-cast.rs @@ -10,5 +10,5 @@ pub trait AsExpression<T> { } // @has foo/type.AsExprOf.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'type AsExprOf<Item, Type> = <Item as AsExpression<Type>>::Expression;' +// @has - '//pre[@class="rust item-decl"]' 'type AsExprOf<Item, Type> = <Item as AsExpression<Type>>::Expression;' pub type AsExprOf<Item, Type> = <Item as AsExpression<Type>>::Expression; diff --git a/tests/rustdoc/assoc-types.rs b/tests/rustdoc/assoc-types.rs index de36c8ffe..e74db7578 100644 --- a/tests/rustdoc/assoc-types.rs +++ b/tests/rustdoc/assoc-types.rs @@ -12,8 +12,8 @@ pub trait Index<I: ?Sized> { } // @has assoc_types/fn.use_output.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' '-> &T::Output' -// @has - '//div[@class="item-decl"]/pre[@class="rust"]//a[@href="trait.Index.html#associatedtype.Output"]' 'Output' +// @has - '//pre[@class="rust item-decl"]' '-> &T::Output' +// @has - '//pre[@class="rust item-decl"]//a[@href="trait.Index.html#associatedtype.Output"]' 'Output' pub fn use_output<T: Index<usize>>(obj: &T, index: usize) -> &T::Output { obj.index(index) } @@ -23,13 +23,13 @@ pub trait Feed { } // @has assoc_types/fn.use_input.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'T::Input' -// @has - '//div[@class="item-decl"]/pre[@class="rust"]//a[@href="trait.Feed.html#associatedtype.Input"]' 'Input' +// @has - '//pre[@class="rust item-decl"]' 'T::Input' +// @has - '//pre[@class="rust item-decl"]//a[@href="trait.Feed.html#associatedtype.Input"]' 'Input' pub fn use_input<T: Feed>(_feed: &T, _element: T::Input) { } // @has assoc_types/fn.cmp_input.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'where T::Input: PartialEq<U::Input>' -// @has - '//div[@class="item-decl"]/pre[@class="rust"]//a[@href="trait.Feed.html#associatedtype.Input"]' 'Input' +// @has - '//pre[@class="rust item-decl"]' 'where T::Input: PartialEq<U::Input>' +// @has - '//pre[@class="rust item-decl"]//a[@href="trait.Feed.html#associatedtype.Input"]' 'Input' pub fn cmp_input<T: Feed, U: Feed>(a: &T::Input, b: &U::Input) -> bool where T::Input: PartialEq<U::Input> { diff --git a/tests/rustdoc/async-fn-opaque-item.rs b/tests/rustdoc/async-fn-opaque-item.rs new file mode 100644 index 000000000..a73e84f3f --- /dev/null +++ b/tests/rustdoc/async-fn-opaque-item.rs @@ -0,0 +1,15 @@ +// compile-flags: --document-private-items --crate-type=lib +// edition: 2021 + +// Issue 109931 -- test against accidentally documenting the `impl Future` +// that comes from an async fn desugaring. + +// Check that we don't document an unnamed opaque type +// @!has async_fn_opaque_item/opaque..html + +// Checking there is only a "Functions" header and no "Opaque types". +// @has async_fn_opaque_item/index.html +// @count - '//*[@class="small-section-header"]' 1 +// @has - '//*[@class="small-section-header"]' 'Functions' + +pub async fn test() {} diff --git a/tests/rustdoc/async-fn.rs b/tests/rustdoc/async-fn.rs index fb7ebb5f8..70bcbcb6f 100644 --- a/tests/rustdoc/async-fn.rs +++ b/tests/rustdoc/async-fn.rs @@ -1,35 +1,35 @@ // edition:2018 -// @has async_fn/fn.foo.html '//div[@class="item-decl"]/pre[@class="rust"]' 'pub async fn foo() -> Option<Foo>' +// @has async_fn/fn.foo.html '//pre[@class="rust item-decl"]' 'pub async fn foo() -> Option<Foo>' pub async fn foo() -> Option<Foo> { None } -// @has async_fn/fn.bar.html '//div[@class="item-decl"]/pre[@class="rust"]' 'pub async fn bar(a: i32, b: i32) -> i32' +// @has async_fn/fn.bar.html '//pre[@class="rust item-decl"]' 'pub async fn bar(a: i32, b: i32) -> i32' pub async fn bar(a: i32, b: i32) -> i32 { 0 } -// @has async_fn/fn.baz.html '//div[@class="item-decl"]/pre[@class="rust"]' 'pub async fn baz<T>(a: T) -> T' +// @has async_fn/fn.baz.html '//pre[@class="rust item-decl"]' 'pub async fn baz<T>(a: T) -> T' pub async fn baz<T>(a: T) -> T { a } -// @has async_fn/fn.qux.html '//div[@class="item-decl"]/pre[@class="rust"]' 'pub async unsafe fn qux() -> char' +// @has async_fn/fn.qux.html '//pre[@class="rust item-decl"]' 'pub async unsafe fn qux() -> char' pub async unsafe fn qux() -> char { '⚠' } -// @has async_fn/fn.mut_args.html '//div[@class="item-decl"]/pre[@class="rust"]' 'pub async fn mut_args(a: usize)' +// @has async_fn/fn.mut_args.html '//pre[@class="rust item-decl"]' 'pub async fn mut_args(a: usize)' pub async fn mut_args(mut a: usize) {} -// @has async_fn/fn.mut_ref.html '//div[@class="item-decl"]/pre[@class="rust"]' 'pub async fn mut_ref(x: i32)' +// @has async_fn/fn.mut_ref.html '//pre[@class="rust item-decl"]' 'pub async fn mut_ref(x: i32)' pub async fn mut_ref(ref mut x: i32) {} trait Bar {} impl Bar for () {} -// @has async_fn/fn.quux.html '//div[@class="item-decl"]/pre[@class="rust"]' 'pub async fn quux() -> impl Bar' +// @has async_fn/fn.quux.html '//pre[@class="rust item-decl"]' 'pub async fn quux() -> impl Bar' pub async fn quux() -> impl Bar { () } @@ -50,46 +50,46 @@ pub trait Pattern<'a> {} pub trait Trait<const N: usize> {} // @has async_fn/fn.const_generics.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub async fn const_generics<const N: usize>(_: impl Trait<N>)' +// @has - '//pre[@class="rust item-decl"]' 'pub async fn const_generics<const N: usize>(_: impl Trait<N>)' pub async fn const_generics<const N: usize>(_: impl Trait<N>) {} // test that elided lifetimes are properly elided and not displayed as `'_` // regression test for #63037 // @has async_fn/fn.elided.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub async fn elided(foo: &str) -> &str' +// @has - '//pre[@class="rust item-decl"]' 'pub async fn elided(foo: &str) -> &str' pub async fn elided(foo: &str) -> &str {} // This should really be shown as written, but for implementation reasons it's difficult. // See `impl Clean for TyKind::Ref`. // @has async_fn/fn.user_elided.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub async fn user_elided(foo: &str) -> &str' +// @has - '//pre[@class="rust item-decl"]' 'pub async fn user_elided(foo: &str) -> &str' pub async fn user_elided(foo: &'_ str) -> &str {} // @has async_fn/fn.static_trait.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub async fn static_trait(foo: &str) -> Box<dyn Bar>' +// @has - '//pre[@class="rust item-decl"]' 'pub async fn static_trait(foo: &str) -> Box<dyn Bar>' pub async fn static_trait(foo: &str) -> Box<dyn Bar> {} // @has async_fn/fn.lifetime_for_trait.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "pub async fn lifetime_for_trait(foo: &str) -> Box<dyn Bar + '_>" +// @has - '//pre[@class="rust item-decl"]' "pub async fn lifetime_for_trait(foo: &str) -> Box<dyn Bar + '_>" pub async fn lifetime_for_trait(foo: &str) -> Box<dyn Bar + '_> {} // @has async_fn/fn.elided_in_input_trait.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "pub async fn elided_in_input_trait(t: impl Pattern<'_>)" +// @has - '//pre[@class="rust item-decl"]' "pub async fn elided_in_input_trait(t: impl Pattern<'_>)" pub async fn elided_in_input_trait(t: impl Pattern<'_>) {} struct AsyncFdReadyGuard<'a, T> { x: &'a T } impl Foo { // @has async_fn/struct.Foo.html - // @has - '//*[@class="method has-srclink"]' 'pub async fn complicated_lifetimes( &self, context: &impl Bar) -> impl Iterator<Item = &usize>' + // @has - '//*[@class="method"]' 'pub async fn complicated_lifetimes( &self, context: &impl Bar ) -> impl Iterator<Item = &usize>' pub async fn complicated_lifetimes(&self, context: &impl Bar) -> impl Iterator<Item = &usize> {} // taken from `tokio` as an example of a method that was particularly bad before - // @has - '//*[@class="method has-srclink"]' "pub async fn readable<T>(&self) -> Result<AsyncFdReadyGuard<'_, T>, ()>" + // @has - '//*[@class="method"]' "pub async fn readable<T>(&self) -> Result<AsyncFdReadyGuard<'_, T>, ()>" pub async fn readable<T>(&self) -> Result<AsyncFdReadyGuard<'_, T>, ()> {} - // @has - '//*[@class="method has-srclink"]' "pub async fn mut_self(&mut self)" + // @has - '//*[@class="method"]' "pub async fn mut_self(&mut self)" pub async fn mut_self(&mut self) {} } // test named lifetimes, just in case // @has async_fn/fn.named.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "pub async fn named<'a, 'b>(foo: &'a str) -> &'b str" +// @has - '//pre[@class="rust item-decl"]' "pub async fn named<'a, 'b>(foo: &'a str) -> &'b str" pub async fn named<'a, 'b>(foo: &'a str) -> &'b str {} // @has async_fn/fn.named_trait.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "pub async fn named_trait<'a, 'b>(foo: impl Pattern<'a>) -> impl Pattern<'b>" +// @has - '//pre[@class="rust item-decl"]' "pub async fn named_trait<'a, 'b>(foo: impl Pattern<'a>) -> impl Pattern<'b>" pub async fn named_trait<'a, 'b>(foo: impl Pattern<'a>) -> impl Pattern<'b> {} diff --git a/tests/rustdoc/attribute-rendering.rs b/tests/rustdoc/attribute-rendering.rs index 36e10923c..a652fda16 100644 --- a/tests/rustdoc/attribute-rendering.rs +++ b/tests/rustdoc/attribute-rendering.rs @@ -1,7 +1,7 @@ #![crate_name = "foo"] // @has 'foo/fn.f.html' -// @has - //*[@'class="item-decl"]' '#[export_name = "f"] pub fn f()' +// @has - //*[@'class="rust item-decl"]' '#[export_name = "f"] pub fn f()' #[export_name = "\ f"] pub fn f() {} diff --git a/tests/rustdoc/attributes.rs b/tests/rustdoc/attributes.rs index 70e2e5c29..86333c753 100644 --- a/tests/rustdoc/attributes.rs +++ b/tests/rustdoc/attributes.rs @@ -1,13 +1,13 @@ #![crate_name = "foo"] -// @has foo/fn.f.html '//div[@class="item-decl"]/pre[@class="rust"]' '#[no_mangle]' +// @has foo/fn.f.html '//pre[@class="rust item-decl"]' '#[no_mangle]' #[no_mangle] pub extern "C" fn f() {} -// @has foo/fn.g.html '//div[@class="item-decl"]/pre[@class="rust"]' '#[export_name = "bar"]' +// @has foo/fn.g.html '//pre[@class="rust item-decl"]' '#[export_name = "bar"]' #[export_name = "bar"] pub extern "C" fn g() {} -// @has foo/struct.Repr.html '//div[@class="item-decl"]' '#[repr(C, align(8))]' +// @has foo/struct.Repr.html '//pre[@class="rust item-decl"]' '#[repr(C, align(8))]' #[repr(C, align(8))] pub struct Repr; diff --git a/tests/rustdoc/auxiliary/inline-default-methods.rs b/tests/rustdoc/auxiliary/inline-default-methods.rs index 8a636f449..f06a20b27 100644 --- a/tests/rustdoc/auxiliary/inline-default-methods.rs +++ b/tests/rustdoc/auxiliary/inline-default-methods.rs @@ -4,3 +4,15 @@ pub trait Foo { fn bar(&self); fn foo(&mut self) {} } + +pub trait Bar { + fn bar(&self); + fn foo1(&mut self) {} + fn foo2(&mut self) {} +} + +pub trait Baz { + fn bar1(&self); + fn bar2(&self); + fn foo(&mut self) {} +} diff --git a/tests/rustdoc/auxiliary/issue-85454.rs b/tests/rustdoc/auxiliary/issue-85454.rs index 5143968bb..5db4fe053 100644 --- a/tests/rustdoc/auxiliary/issue-85454.rs +++ b/tests/rustdoc/auxiliary/issue-85454.rs @@ -1,5 +1,5 @@ // @has issue_85454/trait.FromResidual.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub trait FromResidual<R = <Self as Try>::Residual> { fn from_residual(residual: R) -> Self; }' +// @has - '//pre[@class="rust item-decl"]' 'pub trait FromResidual<R = <Self as Try>::Residual> { fn from_residual(residual: R) -> Self; }' pub trait FromResidual<R = <Self as Try>::Residual> { fn from_residual(residual: R) -> Self; } diff --git a/tests/rustdoc/cfg_doc_reexport.rs b/tests/rustdoc/cfg_doc_reexport.rs index addb6709d..a10c84f2c 100644 --- a/tests/rustdoc/cfg_doc_reexport.rs +++ b/tests/rustdoc/cfg_doc_reexport.rs @@ -5,8 +5,8 @@ #![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' +// @has - '//*[@class="item-name"]/*[@class="stab portability"]' 'foobar' +// @has - '//*[@class="item-name"]/*[@class="stab portability"]' 'bar' #[doc(cfg(feature = "foobar"))] mod imp_priv { diff --git a/tests/rustdoc/codeblock-title.rs b/tests/rustdoc/codeblock-title.rs index b9b0b0d1a..761afb8bd 100644 --- a/tests/rustdoc/codeblock-title.rs +++ b/tests/rustdoc/codeblock-title.rs @@ -3,7 +3,7 @@ // @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"]' "ⓘ" +// @has foo/fn.bar.html '//*[@title="This example runs with edition 2018"]' "ⓘ" /// foo /// diff --git a/tests/rustdoc/const-fn.rs b/tests/rustdoc/const-fn.rs index 4366ad4d0..f66161856 100644 --- a/tests/rustdoc/const-fn.rs +++ b/tests/rustdoc/const-fn.rs @@ -1,14 +1,14 @@ #![crate_name = "foo"] // @has foo/fn.bar.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub const fn bar() -> ' +// @has - '//pre[@class="rust item-decl"]' 'pub const fn bar() -> ' /// foo pub const fn bar() -> usize { 2 } // @has foo/struct.Foo.html -// @has - '//*[@class="method has-srclink"]' 'const fn new()' +// @has - '//*[@class="method"]' 'const fn new()' pub struct Foo(usize); impl Foo { diff --git a/tests/rustdoc/const-generics/add-impl.rs b/tests/rustdoc/const-generics/add-impl.rs index b5226ad3f..195e47bc8 100644 --- a/tests/rustdoc/const-generics/add-impl.rs +++ b/tests/rustdoc/const-generics/add-impl.rs @@ -2,7 +2,7 @@ use std::ops::Add; -// @has foo/struct.Simd.html '//div[@class="item-decl"]/pre[@class="rust"]' 'pub struct Simd<T, const WIDTH: usize>' +// @has foo/struct.Simd.html '//pre[@class="rust item-decl"]' 'pub struct Simd<T, const WIDTH: usize>' pub struct Simd<T, const WIDTH: usize> { inner: T, } diff --git a/tests/rustdoc/const-generics/const-generic-defaults.rs b/tests/rustdoc/const-generics/const-generic-defaults.rs index acc3b853e..f781c6a62 100644 --- a/tests/rustdoc/const-generics/const-generic-defaults.rs +++ b/tests/rustdoc/const-generics/const-generic-defaults.rs @@ -1,5 +1,5 @@ #![crate_name = "foo"] -// @has foo/struct.Foo.html '//div[@class="item-decl"]/pre[@class="rust"]' \ +// @has foo/struct.Foo.html '//pre[@class="rust item-decl"]' \ // 'pub struct Foo<const M: usize = 10, const N: usize = M, T = i32>(_);' pub struct Foo<const M: usize = 10, const N: usize = M, T = i32>(T); diff --git a/tests/rustdoc/const-generics/const-generic-slice.rs b/tests/rustdoc/const-generics/const-generic-slice.rs index 4279de91f..80a9ab3f1 100644 --- a/tests/rustdoc/const-generics/const-generic-slice.rs +++ b/tests/rustdoc/const-generics/const-generic-slice.rs @@ -5,7 +5,7 @@ pub trait Array { } // @has foo/trait.Array.html -// @has - '//*[@class="impl has-srclink"]' 'impl<T, const N: usize> Array for [T; N]' +// @has - '//*[@class="impl"]' 'impl<T, const N: usize> Array for [T; N]' impl<T, const N: usize> Array for [T; N] { type Item = T; } diff --git a/tests/rustdoc/const-generics/const-generics-docs.rs b/tests/rustdoc/const-generics/const-generics-docs.rs index 543332d2c..828486a41 100644 --- a/tests/rustdoc/const-generics/const-generics-docs.rs +++ b/tests/rustdoc/const-generics/const-generics-docs.rs @@ -3,26 +3,26 @@ #![crate_name = "foo"] extern crate extern_crate; -// @has foo/fn.extern_fn.html '//div[@class="item-decl"]/pre[@class="rust"]' \ +// @has foo/fn.extern_fn.html '//pre[@class="rust item-decl"]' \ // 'pub fn extern_fn<const N: usize>() -> impl Iterator<Item = [u8; N]>' pub use extern_crate::extern_fn; -// @has foo/struct.ExternTy.html '//div[@class="item-decl"]/pre[@class="rust"]' \ +// @has foo/struct.ExternTy.html '//pre[@class="rust item-decl"]' \ // 'pub struct ExternTy<const N: usize> {' pub use extern_crate::ExternTy; -// @has foo/type.TyAlias.html '//div[@class="item-decl"]/pre[@class="rust"]' \ +// @has foo/type.TyAlias.html '//pre[@class="rust item-decl"]' \ // 'type TyAlias<const N: usize> = ExternTy<N>;' pub use extern_crate::TyAlias; -// @has foo/trait.WTrait.html '//div[@class="item-decl"]/pre[@class="rust"]' \ +// @has foo/trait.WTrait.html '//pre[@class="rust item-decl"]' \ // 'pub trait WTrait<const N: usize, const M: usize>' -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'fn hey<const P: usize>() -> usize' +// @has - '//pre[@class="rust item-decl"]' 'fn hey<const P: usize>() -> usize' pub use extern_crate::WTrait; -// @has foo/trait.Trait.html '//div[@class="item-decl"]/pre[@class="rust"]' \ +// @has foo/trait.Trait.html '//pre[@class="rust item-decl"]' \ // 'pub trait Trait<const N: usize>' // @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"]' \ +// @has - '//*[@id="impl-Trait%3C%7B1+%2B+2%7D%3E-for-u8"]//h3[@class="code-header"]' 'impl Trait<{1 + 2}> for u8' +// @has - '//*[@id="impl-Trait%3CN%3E-for-%5Bu8;+N%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 {} @@ -30,10 +30,10 @@ impl Trait<2> for u8 {} impl Trait<{1 + 2}> for u8 {} impl<const N: usize> Trait<N> for [u8; N] {} -// @has foo/struct.Foo.html '//div[@class="item-decl"]/pre[@class="rust"]' \ -// 'pub struct Foo<const N: usize>where u8: Trait<N>' +// @has foo/struct.Foo.html '//pre[@class="rust item-decl"]' \ +// '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 '//div[@class="item-decl"]/pre[@class="rust"]' 'pub struct Bar<T, const N: usize>(_)' +// @has foo/struct.Bar.html '//pre[@class="rust item-decl"]' '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"]' 'impl<const M: usize> Foo<M>where u8: Trait<M>' @@ -47,7 +47,7 @@ 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"]' 'impl<const M: usize> Bar<u8, M>' +// @has foo/struct.Bar.html '//*[@id="impl-Bar%3Cu8,+M%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>' @@ -56,32 +56,32 @@ impl<const M: usize> Bar<u8, M> { } } -// @has foo/fn.test.html '//div[@class="item-decl"]/pre[@class="rust"]' \ +// @has foo/fn.test.html '//pre[@class="rust item-decl"]' \ // '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 } -// @has foo/fn.a_sink.html '//div[@class="item-decl"]/pre[@class="rust"]' \ +// @has foo/fn.a_sink.html '//pre[@class="rust item-decl"]' \ // 'pub async fn a_sink<const N: usize>(v: [u8; N]) -> impl Trait<N>' pub async fn a_sink<const N: usize>(v: [u8; N]) -> impl Trait<N> { v } -// @has foo/fn.b_sink.html '//div[@class="item-decl"]/pre[@class="rust"]' \ +// @has foo/fn.b_sink.html '//pre[@class="rust item-decl"]' \ // 'pub async fn b_sink<const N: usize>(_: impl Trait<N>)' pub async fn b_sink<const N: usize>(_: impl Trait<N>) {} -// @has foo/fn.concrete.html '//div[@class="item-decl"]/pre[@class="rust"]' \ +// @has foo/fn.concrete.html '//pre[@class="rust item-decl"]' \ // 'pub fn concrete() -> [u8; 22]' pub fn concrete() -> [u8; 3 + std::mem::size_of::<u64>() << 1] { Default::default() } -// @has foo/type.Faz.html '//div[@class="item-decl"]/pre[@class="rust"]' \ +// @has foo/type.Faz.html '//pre[@class="rust item-decl"]' \ // 'type Faz<const N: usize> = [u8; N];' pub type Faz<const N: usize> = [u8; N]; -// @has foo/type.Fiz.html '//div[@class="item-decl"]/pre[@class="rust"]' \ +// @has foo/type.Fiz.html '//pre[@class="rust item-decl"]' \ // 'type Fiz<const N: usize> = [[u8; N]; 48];' pub type Fiz<const N: usize> = [[u8; N]; 3 << 4]; @@ -91,7 +91,7 @@ macro_rules! define_me { } } -// @has foo/struct.Foz.html '//div[@class="item-decl"]/pre[@class="rust"]' \ +// @has foo/struct.Foz.html '//pre[@class="rust item-decl"]' \ // 'pub struct Foz<const N: usize>(_);' define_me!(Foz<N>); @@ -103,13 +103,13 @@ impl<const N: usize> Q for [u8; N] { const ASSOC: usize = N; } -// @has foo/fn.q_user.html '//div[@class="item-decl"]/pre[@class="rust"]' \ +// @has foo/fn.q_user.html '//pre[@class="rust item-decl"]' \ // 'pub fn q_user() -> [u8; 13]' pub fn q_user() -> [u8; <[u8; 13] as Q>::ASSOC] { [0; <[u8; 13] as Q>::ASSOC] } -// @has foo/union.Union.html '//div[@class="item-decl"]/pre[@class="rust"]' \ +// @has foo/union.Union.html '//pre[@class="rust item-decl"]' \ // 'pub union Union<const N: usize>' pub union Union<const N: usize> { // @has - //pre "pub arr: [u8; N]" @@ -118,7 +118,7 @@ pub union Union<const N: usize> { pub another_arr: [(); N], } -// @has foo/enum.Enum.html '//div[@class="item-decl"]/pre[@class="rust"]' \ +// @has foo/enum.Enum.html '//pre[@class="rust item-decl"]' \ // 'pub enum Enum<const N: usize>' pub enum Enum<const N: usize> { // @has - //pre "Variant([u8; N])" diff --git a/tests/rustdoc/const-generics/const-impl.rs b/tests/rustdoc/const-generics/const-impl.rs index 726fb8f0c..152b643bf 100644 --- a/tests/rustdoc/const-generics/const-impl.rs +++ b/tests/rustdoc/const-generics/const-impl.rs @@ -8,21 +8,21 @@ pub enum Order { Unsorted, } -// @has foo/struct.VSet.html '//div[@class="item-decl"]/pre[@class="rust"]' '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"]' '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>' +// @has foo/struct.VSet.html '//pre[@class="rust item-decl"]' 'pub struct VSet<T, const ORDER: Order>' +// @has foo/struct.VSet.html '//*[@id="impl-Send-for-VSet%3CT,+ORDER%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,+ORDER%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"]' 'impl<T> VSet<T, { Order::Sorted }>' +// @has foo/struct.VSet.html '//*[@id="impl-VSet%3CT,+%7B+Order::Sorted+%7D%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"]' 'impl<T> VSet<T, { Order::Unsorted }>' +// @has foo/struct.VSet.html '//*[@id="impl-VSet%3CT,+%7B+Order::Unsorted+%7D%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"]' 'impl Escape<r#"<script>alert("Escape");</script>"#>' +// @has foo/struct.Escape.html '//*[@id="impl-Escape%3Cr%23%22%3Cscript%3Ealert(%22Escape%22);%3C/script%3E%22%23%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/tests/rustdoc/const-generics/generic_const_exprs.rs b/tests/rustdoc/const-generics/generic_const_exprs.rs index c53cf6dcd..e23b3006d 100644 --- a/tests/rustdoc/const-generics/generic_const_exprs.rs +++ b/tests/rustdoc/const-generics/generic_const_exprs.rs @@ -2,6 +2,6 @@ #![feature(generic_const_exprs)] #![allow(incomplete_features)] // make sure that `ConstEvaluatable` predicates dont cause rustdoc to ICE #77647 -// @has foo/struct.Ice.html '//div[@class="item-decl"]/pre[@class="rust"]' \ +// @has foo/struct.Ice.html '//pre[@class="rust item-decl"]' \ // 'pub struct Ice<const N: usize>;' pub struct Ice<const N: usize> where [(); N + 1]:; diff --git a/tests/rustdoc/const-generics/type-alias.rs b/tests/rustdoc/const-generics/type-alias.rs index 72473a112..4b93e72d2 100644 --- a/tests/rustdoc/const-generics/type-alias.rs +++ b/tests/rustdoc/const-generics/type-alias.rs @@ -1,4 +1,4 @@ #![crate_name = "foo"] -// @has foo/type.CellIndex.html '//div[@class="item-decl"]/pre[@class="rust"]' 'type CellIndex<const D: usize> = [i64; D];' +// @has foo/type.CellIndex.html '//pre[@class="rust item-decl"]' 'type CellIndex<const D: usize> = [i64; D];' pub type CellIndex<const D: usize> = [i64; D]; diff --git a/tests/rustdoc/const-intrinsic.rs b/tests/rustdoc/const-intrinsic.rs index 42f6ac792..6d2c6cce2 100644 --- a/tests/rustdoc/const-intrinsic.rs +++ b/tests/rustdoc/const-intrinsic.rs @@ -6,20 +6,20 @@ extern "rust-intrinsic" { // @has 'foo/fn.transmute.html' - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub const unsafe extern "rust-intrinsic" fn transmute<T, U>(_: T) -> U' + // @has - '//pre[@class="rust item-decl"]' 'pub const unsafe extern "rust-intrinsic" fn transmute<T, U>(_: T) -> U' #[stable(since="1.0.0", feature="rust1")] #[rustc_const_stable(feature = "const_transmute", since = "1.56.0")] pub fn transmute<T, U>(_: T) -> U; // @has 'foo/fn.unreachable.html' - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub unsafe extern "rust-intrinsic" fn unreachable() -> !' + // @has - '//pre[@class="rust item-decl"]' 'pub unsafe extern "rust-intrinsic" fn unreachable() -> !' #[stable(since="1.0.0", feature="rust1")] pub fn unreachable() -> !; } extern "C" { // @has 'foo/fn.needs_drop.html' - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub unsafe extern "C" fn needs_drop() -> !' + // @has - '//pre[@class="rust item-decl"]' 'pub unsafe extern "C" fn needs_drop() -> !' #[stable(since="1.0.0", feature="rust1")] pub fn needs_drop() -> !; } diff --git a/tests/rustdoc/const-value-display.rs b/tests/rustdoc/const-value-display.rs index 8d95f0de9..a7548ad2c 100644 --- a/tests/rustdoc/const-value-display.rs +++ b/tests/rustdoc/const-value-display.rs @@ -1,9 +1,9 @@ #![crate_name = "foo"] // @has 'foo/constant.HOUR_IN_SECONDS.html' -// @has - '//*[@class="item-decl"]//code' 'pub const HOUR_IN_SECONDS: u64 = _; // 3_600u64' +// @has - '//*[@class="rust 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="item-decl"]//code' 'pub const NEGATIVE: i64 = _; // -3_600i64' +// @has - '//*[@class="rust item-decl"]//code' 'pub const NEGATIVE: i64 = _; // -3_600i64' pub const NEGATIVE: i64 = -60 * 60; diff --git a/tests/rustdoc/decl-trailing-whitespace.declaration.html b/tests/rustdoc/decl-trailing-whitespace.declaration.html index 02b51b344..d73393633 100644 --- a/tests/rustdoc/decl-trailing-whitespace.declaration.html +++ b/tests/rustdoc/decl-trailing-whitespace.declaration.html @@ -1,7 +1,23 @@ <code>pub trait Write { - fn <a href="#tymethod.poll_write" class="fn">poll_write</a>(<br />        self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>,<br />        cx: &mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>,<br />        buf: &mut [<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>]<br />    ) -> <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>>>; -<span class="item-spacer" /> fn <a href="#tymethod.poll_flush" class="fn">poll_flush</a>(<br />        self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>,<br />        cx: &mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>><br />    ) -> <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>>>; -<span class="item-spacer" /> fn <a href="#tymethod.poll_close" class="fn">poll_close</a>(<br />        self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>,<br />        cx: &mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>><br />    ) -> <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>>>; + // Required methods + fn <a href="#tymethod.poll_write" class="fn">poll_write</a>( + self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, + cx: &mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, + buf: &mut [<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>] + ) -> <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>>>; +<span class="item-spacer" /> fn <a href="#tymethod.poll_flush" class="fn">poll_flush</a>( + self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, + cx: &mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>> + ) -> <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>>>; +<span class="item-spacer" /> fn <a href="#tymethod.poll_close" class="fn">poll_close</a>( + self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, + cx: &mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>> + ) -> <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>>>; - fn <a href="#method.poll_write_vectored" class="fn">poll_write_vectored</a>(<br />        self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>,<br />        cx: &mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>,<br />        bufs: &[<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>]<br />    ) -> <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>>> { ... } + // Provided method + fn <a href="#method.poll_write_vectored" class="fn">poll_write_vectored</a>( + self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, + cx: &mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, + bufs: &[<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>] + ) -> <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>>> { ... } }</code>
\ No newline at end of file diff --git a/tests/rustdoc/decl-trailing-whitespace.rs b/tests/rustdoc/decl-trailing-whitespace.rs index e47edc132..d2a12435d 100644 --- a/tests/rustdoc/decl-trailing-whitespace.rs +++ b/tests/rustdoc/decl-trailing-whitespace.rs @@ -7,7 +7,7 @@ pub struct Error; // @has 'foo/trait.Write.html' pub trait Write { - // @snapshot 'declaration' - '//*[@class="item-decl"]//code' + // @snapshot 'declaration' - '//*[@class="rust item-decl"]//code' fn poll_write( self: Option<String>, cx: &mut Option<String>, diff --git a/tests/rustdoc/deprecated.rs b/tests/rustdoc/deprecated.rs index b3178da98..51860441b 100644 --- a/tests/rustdoc/deprecated.rs +++ b/tests/rustdoc/deprecated.rs @@ -1,6 +1,6 @@ -// @has deprecated/index.html '//*[@class="item-left module-item"]/span[@class="stab deprecated"]' \ +// @has deprecated/index.html '//*[@class="item-name"]/span[@class="stab deprecated"]' \ // 'Deprecated' -// @has - '//*[@class="item-right docblock-short"]' 'Deprecated docs' +// @has - '//*[@class="desc docblock-short"]' 'Deprecated docs' // @has deprecated/struct.S.html '//*[@class="stab deprecated"]' \ // 'Deprecated since 1.0.0: text' @@ -8,7 +8,7 @@ #[deprecated(since = "1.0.0", note = "text")] pub struct S; -// @matches deprecated/index.html '//*[@class="item-right docblock-short"]' '^Docs' +// @matches deprecated/index.html '//*[@class="desc docblock-short"]' '^Docs' /// Docs pub struct T; diff --git a/tests/rustdoc/description.rs b/tests/rustdoc/description.rs index 05ec42822..43cd59ebd 100644 --- a/tests/rustdoc/description.rs +++ b/tests/rustdoc/description.rs @@ -22,3 +22,9 @@ pub mod foo_mod { // 'Only paragraph.' /// Only paragraph. pub fn foo_fn() {} + +// @has 'foo/fn.bar_fn.html' '//meta[@name="description"]/@content' \ +// 'Description with intra-doc link to foo_fn and [nonexistent_item] and foo_fn.' +#[allow(rustdoc::broken_intra_doc_links)] +/// Description with intra-doc link to [foo_fn] and [nonexistent_item] and [foo_fn](self::foo_fn). +pub fn bar_fn() {} diff --git a/tests/rustdoc/doc-assoc-item.rs b/tests/rustdoc/doc-assoc-item.rs index 4f1541865..4d5c9f83e 100644 --- a/tests/rustdoc/doc-assoc-item.rs +++ b/tests/rustdoc/doc-assoc-item.rs @@ -8,7 +8,7 @@ pub trait Bar { fn foo(foo: Self::Fuu); } -// @has doc_assoc_item/struct.Foo.html '//*[@class="impl has-srclink"]' 'impl<T: Bar<Fuu = u32>> Foo<T>' +// @has doc_assoc_item/struct.Foo.html '//*[@class="impl"]' 'impl<T: Bar<Fuu = u32>> Foo<T>' impl<T: Bar<Fuu = u32>> Foo<T> { pub fn new(t: T) -> Foo<T> { Foo { diff --git a/tests/rustdoc/doc-cfg.rs b/tests/rustdoc/doc-cfg.rs index 4cddb0b76..c4702d410 100644 --- a/tests/rustdoc/doc-cfg.rs +++ b/tests/rustdoc/doc-cfg.rs @@ -12,7 +12,7 @@ pub struct Portable; // @has doc_cfg/unix_only/index.html \ // '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \ // 'Available on Unix only.' -// @matches - '//*[@class="item-left module-item"]//*[@class="stab portability"]' '\AARM\Z' +// @matches - '//*[@class="item-name"]//*[@class="stab portability"]' '\AARM\Z' // @count - '//*[@class="stab portability"]' 2 #[doc(cfg(unix))] pub mod unix_only { @@ -42,7 +42,7 @@ pub mod unix_only { // @has doc_cfg/wasi_only/index.html \ // '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \ // 'Available on WASI only.' -// @matches - '//*[@class="item-left module-item"]//*[@class="stab portability"]' '\AWebAssembly\Z' +// @matches - '//*[@class="item-name"]//*[@class="stab portability"]' '\AWebAssembly\Z' // @count - '//*[@class="stab portability"]' 2 #[doc(cfg(target_os = "wasi"))] pub mod wasi_only { @@ -74,7 +74,7 @@ pub mod wasi_only { // the portability header is different on the module view versus the full view // @has doc_cfg/index.html -// @matches - '//*[@class="item-left module-item"]//*[@class="stab portability"]' '\Aavx\Z' +// @matches - '//*[@class="item-name"]//*[@class="stab portability"]' '\Aavx\Z' // @has doc_cfg/fn.uses_target_feature.html // @has - '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \ diff --git a/tests/rustdoc/doc-notable_trait.rs b/tests/rustdoc/doc-notable_trait.rs index 279faf554..d8941769f 100644 --- a/tests/rustdoc/doc-notable_trait.rs +++ b/tests/rustdoc/doc-notable_trait.rs @@ -9,7 +9,7 @@ impl<T: SomeTrait> SomeTrait for Wrapper<T> {} #[doc(notable_trait)] pub trait SomeTrait { // @has doc_notable_trait/trait.SomeTrait.html - // @has - '//a[@class="notable-traits"]/@data-ty' 'Wrapper<Self>' + // @has - '//a[@class="tooltip"]/@data-notable-ty' 'Wrapper<Self>' // @snapshot wrap-me - '//script[@id="notable-traits-data"]' fn wrap_me(self) -> Wrapper<Self> where Self: Sized { Wrapper { @@ -23,7 +23,7 @@ impl SomeTrait for SomeStruct {} impl SomeStruct { // @has doc_notable_trait/struct.SomeStruct.html - // @has - '//a[@class="notable-traits"]/@data-ty' 'SomeStruct' + // @has - '//a[@class="tooltip"]/@data-notable-ty' 'SomeStruct' // @snapshot some-struct-new - '//script[@id="notable-traits-data"]' pub fn new() -> SomeStruct { SomeStruct @@ -31,7 +31,7 @@ impl SomeStruct { } // @has doc_notable_trait/fn.bare_fn.html -// @has - '//a[@class="notable-traits"]/@data-ty' 'SomeStruct' +// @has - '//a[@class="tooltip"]/@data-notable-ty' 'SomeStruct' // @snapshot bare-fn - '//script[@id="notable-traits-data"]' pub fn bare_fn() -> SomeStruct { SomeStruct diff --git a/tests/rustdoc/doc-notable_trait.some-struct-new.html b/tests/rustdoc/doc-notable_trait.some-struct-new.html index 384be6689..e8f4f6000 100644 --- a/tests/rustdoc/doc-notable_trait.some-struct-new.html +++ b/tests/rustdoc/doc-notable_trait.some-struct-new.html @@ -1 +1 @@ -<script type="text/json" id="notable-traits-data">{"SomeStruct":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.SomeStruct.html\" title=\"struct doc_notable_trait::SomeStruct\">SomeStruct</a></code></h3><pre><code><span class=\"where fmt-newline\">impl <a class=\"trait\" href=\"trait.SomeTrait.html\" title=\"trait doc_notable_trait::SomeTrait\">SomeTrait</a> for <a class=\"struct\" href=\"struct.SomeStruct.html\" title=\"struct doc_notable_trait::SomeStruct\">SomeStruct</a></span>","Wrapper<Self>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.Wrapper.html\" title=\"struct doc_notable_trait::Wrapper\">Wrapper</a>&lt;T&gt;</code></h3><pre><code><span class=\"where fmt-newline\">impl&lt;T:&nbsp;<a class=\"trait\" href=\"trait.SomeTrait.html\" title=\"trait doc_notable_trait::SomeTrait\">SomeTrait</a>&gt; <a class=\"trait\" href=\"trait.SomeTrait.html\" title=\"trait doc_notable_trait::SomeTrait\">SomeTrait</a> for <a class=\"struct\" href=\"struct.Wrapper.html\" title=\"struct doc_notable_trait::Wrapper\">Wrapper</a>&lt;T&gt;</span>"}</script>
\ No newline at end of file +<script type="text/json" id="notable-traits-data">{"SomeStruct":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.SomeStruct.html\" title=\"struct doc_notable_trait::SomeStruct\">SomeStruct</a></code></h3><pre><code><span class=\"where fmt-newline\">impl <a class=\"trait\" href=\"trait.SomeTrait.html\" title=\"trait doc_notable_trait::SomeTrait\">SomeTrait</a> for <a class=\"struct\" href=\"struct.SomeStruct.html\" title=\"struct doc_notable_trait::SomeStruct\">SomeStruct</a></span>","Wrapper<Self>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.Wrapper.html\" title=\"struct doc_notable_trait::Wrapper\">Wrapper</a>&lt;T&gt;</code></h3><pre><code><span class=\"where fmt-newline\">impl&lt;T: <a class=\"trait\" href=\"trait.SomeTrait.html\" title=\"trait doc_notable_trait::SomeTrait\">SomeTrait</a>&gt; <a class=\"trait\" href=\"trait.SomeTrait.html\" title=\"trait doc_notable_trait::SomeTrait\">SomeTrait</a> for <a class=\"struct\" href=\"struct.Wrapper.html\" title=\"struct doc_notable_trait::Wrapper\">Wrapper</a>&lt;T&gt;</span>"}</script>
\ No newline at end of file diff --git a/tests/rustdoc/doc-notable_trait.wrap-me.html b/tests/rustdoc/doc-notable_trait.wrap-me.html index 0cc1ee10f..e7909669b 100644 --- a/tests/rustdoc/doc-notable_trait.wrap-me.html +++ b/tests/rustdoc/doc-notable_trait.wrap-me.html @@ -1 +1 @@ -<script type="text/json" id="notable-traits-data">{"Wrapper<Self>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.Wrapper.html\" title=\"struct doc_notable_trait::Wrapper\">Wrapper</a>&lt;T&gt;</code></h3><pre><code><span class=\"where fmt-newline\">impl&lt;T:&nbsp;<a class=\"trait\" href=\"trait.SomeTrait.html\" title=\"trait doc_notable_trait::SomeTrait\">SomeTrait</a>&gt; <a class=\"trait\" href=\"trait.SomeTrait.html\" title=\"trait doc_notable_trait::SomeTrait\">SomeTrait</a> for <a class=\"struct\" href=\"struct.Wrapper.html\" title=\"struct doc_notable_trait::Wrapper\">Wrapper</a>&lt;T&gt;</span>"}</script>
\ No newline at end of file +<script type="text/json" id="notable-traits-data">{"Wrapper<Self>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.Wrapper.html\" title=\"struct doc_notable_trait::Wrapper\">Wrapper</a>&lt;T&gt;</code></h3><pre><code><span class=\"where fmt-newline\">impl&lt;T: <a class=\"trait\" href=\"trait.SomeTrait.html\" title=\"trait doc_notable_trait::SomeTrait\">SomeTrait</a>&gt; <a class=\"trait\" href=\"trait.SomeTrait.html\" title=\"trait doc_notable_trait::SomeTrait\">SomeTrait</a> for <a class=\"struct\" href=\"struct.Wrapper.html\" title=\"struct doc_notable_trait::Wrapper\">Wrapper</a>&lt;T&gt;</span>"}</script>
\ No newline at end of file diff --git a/tests/rustdoc/document-item-with-associated-const-in-where-clause.rs b/tests/rustdoc/document-item-with-associated-const-in-where-clause.rs new file mode 100644 index 000000000..c9408ef33 --- /dev/null +++ b/tests/rustdoc/document-item-with-associated-const-in-where-clause.rs @@ -0,0 +1,17 @@ +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +pub trait Enumerable { + const N: usize; +} + +#[derive(Clone)] +pub struct SymmetricGroup<S> +where + S: Enumerable, + [(); S::N]: Sized, +{ + _phantom: std::marker::PhantomData<S>, +} + +fn main() {} diff --git a/tests/rustdoc/double-quote-escape.rs b/tests/rustdoc/double-quote-escape.rs index 350c89741..4f4436377 100644 --- a/tests/rustdoc/double-quote-escape.rs +++ b/tests/rustdoc/double-quote-escape.rs @@ -7,5 +7,5 @@ pub trait Foo<T> { pub struct Bar; // @has foo/struct.Bar.html -// @has - '//*[@class="sidebar-elems"]//section//a[@href="#impl-Foo%3Cunsafe%20extern%20%22C%22%20fn()%3E-for-Bar"]' 'Foo<unsafe extern "C" fn()>' +// @has - '//*[@class="sidebar-elems"]//section//a[@href="#impl-Foo%3Cunsafe+extern+%22C%22+fn()%3E-for-Bar"]' 'Foo<unsafe extern "C" fn()>' impl Foo<unsafe extern "C" fn()> for Bar {} diff --git a/tests/rustdoc/duplicate-cfg.rs b/tests/rustdoc/duplicate-cfg.rs index 18f3900b2..12846c5c1 100644 --- a/tests/rustdoc/duplicate-cfg.rs +++ b/tests/rustdoc/duplicate-cfg.rs @@ -2,8 +2,8 @@ #![feature(doc_cfg)] // @has 'foo/index.html' -// @matches '-' '//*[@class="item-left module-item"]//*[@class="stab portability"]' '^sync$' -// @has '-' '//*[@class="item-left module-item"]//*[@class="stab portability"]/@title' 'Available on crate feature `sync` only' +// @matches '-' '//*[@class="item-name"]//*[@class="stab portability"]' '^sync$' +// @has '-' '//*[@class="item-name"]//*[@class="stab portability"]/@title' 'Available on crate feature `sync` only' // @has 'foo/struct.Foo.html' // @has '-' '//*[@class="stab portability"]' 'sync' diff --git a/tests/rustdoc/duplicate_impls/issue-33054.rs b/tests/rustdoc/duplicate_impls/issue-33054.rs index c1f95ac91..4c2071b83 100644 --- a/tests/rustdoc/duplicate_impls/issue-33054.rs +++ b/tests/rustdoc/duplicate_impls/issue-33054.rs @@ -3,8 +3,8 @@ // @has issue_33054/impls/struct.Foo.html // @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 +// @count - '//*[@id="trait-implementations-list"]//*[@class="impl"]' 1 +// @count - '//*[@id="main-content"]/div[@id="implementations-list"]/details/summary/*[@class="impl"]' 1 // @has issue_33054/impls/bar/trait.Bar.html // @has - '//h3[@class="code-header"]' 'impl Bar for Foo' // @count - '//*[@class="struct"]' 1 diff --git a/tests/rustdoc/duplicated_impl.rs b/tests/rustdoc/duplicated_impl.rs index 4e901b31c..f32cf3100 100644 --- a/tests/rustdoc/duplicated_impl.rs +++ b/tests/rustdoc/duplicated_impl.rs @@ -7,7 +7,7 @@ // blanket implementations. // @has 'foo/struct.Whatever.html' -// @count - '//*[@id="blanket-implementations-list"]/section[@class="impl has-srclink"]' 1 +// @count - '//*[@id="blanket-implementations-list"]/section[@class="impl"]' 1 pub trait Something<T> { } pub struct Whatever; diff --git a/tests/rustdoc/empty-impl-block-private-with-doc.rs b/tests/rustdoc/empty-impl-block-private-with-doc.rs index 439719961..e6cff97b1 100644 --- a/tests/rustdoc/empty-impl-block-private-with-doc.rs +++ b/tests/rustdoc/empty-impl-block-private-with-doc.rs @@ -10,7 +10,7 @@ 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 +// @count - '//*[@class="impl"]' 'impl Foo' 4 // Impl block only containing private items should not be displayed unless the // `--document-private-items` flag is used. diff --git a/tests/rustdoc/empty-impl-block-private.rs b/tests/rustdoc/empty-impl-block-private.rs index 5caf02065..d44b4a47c 100644 --- a/tests/rustdoc/empty-impl-block-private.rs +++ b/tests/rustdoc/empty-impl-block-private.rs @@ -7,7 +7,7 @@ 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 +// @count - '//*[@class="impl"]' 'impl Foo' 3 // Impl block only containing private items should not be displayed. /// Private diff --git a/tests/rustdoc/empty-impl-block.rs b/tests/rustdoc/empty-impl-block.rs index 95d4db06b..da780580b 100644 --- a/tests/rustdoc/empty-impl-block.rs +++ b/tests/rustdoc/empty-impl-block.rs @@ -8,7 +8,7 @@ pub struct Foo; /// Hello empty impl block! impl Foo {} // We ensure that this empty impl block without doc isn't rendered. -// @count - '//*[@class="impl has-srclink"]' 'impl Foo' 1 +// @count - '//*[@class="impl"]' 'impl Foo' 1 impl Foo {} // Just to ensure that empty trait impl blocks are rendered. diff --git a/tests/rustdoc/fn-pointer-arg-name.rs b/tests/rustdoc/fn-pointer-arg-name.rs index 96c64ac4e..359ca64ee 100644 --- a/tests/rustdoc/fn-pointer-arg-name.rs +++ b/tests/rustdoc/fn-pointer-arg-name.rs @@ -1,5 +1,5 @@ #![crate_name = "foo"] // @has foo/fn.f.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn f(callback: fn(len: usize, foo: u32))' +// @has - '//pre[@class="rust item-decl"]' 'pub fn f(callback: fn(len: usize, foo: u32))' pub fn f(callback: fn(len: usize, foo: u32)) {} diff --git a/tests/rustdoc/generic-associated-types/gats.rs b/tests/rustdoc/generic-associated-types/gats.rs index bcead3115..7ab82bb58 100644 --- a/tests/rustdoc/generic-associated-types/gats.rs +++ b/tests/rustdoc/generic-associated-types/gats.rs @@ -2,7 +2,7 @@ // @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"]' \ @@ -23,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/tests/rustdoc/glob-shadowing-const.rs b/tests/rustdoc/glob-shadowing-const.rs index 5b786cf53..58fe8173e 100644 --- a/tests/rustdoc/glob-shadowing-const.rs +++ b/tests/rustdoc/glob-shadowing-const.rs @@ -15,6 +15,6 @@ mod sub4 { pub use sub4::inner::*; // @has 'foo/index.html' -// @has - '//div[@class="item-right docblock-short"]' '1' -// @!has - '//div[@class="item-right docblock-short"]' '0' +// @has - '//div[@class="desc docblock-short"]' '1' +// @!has - '//div[@class="desc docblock-short"]' '0' fn main() { assert_eq!(X, 1); } diff --git a/tests/rustdoc/glob-shadowing.rs b/tests/rustdoc/glob-shadowing.rs index 66a31c42b..c117b9d64 100644 --- a/tests/rustdoc/glob-shadowing.rs +++ b/tests/rustdoc/glob-shadowing.rs @@ -1,17 +1,17 @@ // @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' +// @count - '//div[@class="item-name"]' 6 +// @!has - '//div[@class="desc docblock-short"]' 'sub1::describe' +// @has - '//div[@class="desc docblock-short"]' 'sub2::describe' -// @!has - '//div[@class="item-right docblock-short"]' 'sub1::describe2' +// @!has - '//div[@class="desc 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="desc docblock-short"]' 'sub1::prelude' +// @has - '//div[@class="desc 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="desc docblock-short"]' 'sub1::Foo (struct)' +// @has - '//div[@class="desc docblock-short"]' 'mod::Foo (function)' -// @has - '//div[@class="item-right docblock-short"]' 'sub4::inner::X' +// @has - '//div[@class="desc docblock-short"]' 'sub4::inner::X' // @has 'glob_shadowing/fn.describe.html' // @has - '//div[@class="docblock"]' 'sub2::describe' diff --git a/tests/rustdoc/hidden-private.rs b/tests/rustdoc/hidden-private.rs new file mode 100644 index 000000000..834ba5231 --- /dev/null +++ b/tests/rustdoc/hidden-private.rs @@ -0,0 +1,50 @@ +// This is a regression test for <https://github.com/rust-lang/rust/issues/106373>. +// It ensures that the items in the `doc(hidden)` const block don't show up in the +// generated docs. + +// compile-flags: --document-private-items + +#![crate_name = "foo"] + +// @has 'foo/index.html' +// @count - '//*[@class="item-table"]//a[@class="struct"]' 2 +// @count - '//*[@class="item-table"]//a[@class="trait"]' 1 +// @count - '//*[@class="item-table"]//a[@class="macro"]' 0 +#[doc(hidden)] +const _: () = { + macro_rules! stry { + () => {}; + } + + struct ShouldBeHidden; + + // @has 'foo/struct.Foo.html' + // @!has - '//*[@class="code-header"]' 'impl Bar for Foo' + #[doc(hidden)] + impl Bar for Foo { + fn bar(&self) { + struct SHouldAlsoBeHidden; + } + } + + // @has 'foo/struct.Private.html' + // @has - '//*[@id="impl-Bar-for-Private"]/*[@class="code-header"]' 'impl Bar for Private' + // @has - '//*[@id="method.bar"]/*[@class="code-header"]' 'fn bar(&self)' + impl Bar for Private { + fn bar(&self) {} + } + + // @has - '//*[@id="impl-Private"]/*[@class="code-header"]' 'impl Private' + // @has - '//*[@id="method.tralala"]/*[@class="code-header"]' 'fn tralala()' + impl Private { + fn tralala() {} + } +}; + + +struct Private; +pub struct Foo; + +pub trait Bar { + fn bar(&self); +} diff --git a/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs b/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs index 406157ce2..d368db909 100644 --- a/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs +++ b/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs @@ -63,7 +63,7 @@ impl<const S: Struct, St: Stage + ?Sized> Helper<S> for St { // this test as long as one can ensure that private fields are not leaked! // // @has hide_complex_unevaluated_const_arguments/trait.Sub.html \ -// '//div[@class="item-decl"]/pre[@class="rust"]' \ +// '//pre[@class="rust item-decl"]' \ // 'pub trait Sub: Sup<{ _ }, { _ }> { }' pub trait Sub: Sup<{ 90 * 20 * 4 }, { Struct { private: () } }> {} diff --git a/tests/rustdoc/impl-in-const-block.rs b/tests/rustdoc/impl-in-const-block.rs new file mode 100644 index 000000000..b44e71352 --- /dev/null +++ b/tests/rustdoc/impl-in-const-block.rs @@ -0,0 +1,43 @@ +// Regression test for #83026. +// The goal of this test is to ensure that impl blocks inside +// const expressions are documented as well. + +#![crate_name = "foo"] + +// @has 'foo/struct.A.html' +// @has - '//*[@id="method.new"]/*[@class="code-header"]' 'pub fn new() -> A' +// @has - '//*[@id="method.bar"]/*[@class="code-header"]' 'pub fn bar(&self)' +// @has - '//*[@id="method.woo"]/*[@class="code-header"]' 'pub fn woo(&self)' +// @has - '//*[@id="method.yoo"]/*[@class="code-header"]' 'pub fn yoo()' +// @has - '//*[@id="method.yuu"]/*[@class="code-header"]' 'pub fn yuu()' +pub struct A; + +const _: () = { + impl A { + const FOO: () = { + impl A { + pub fn woo(&self) {} + } + }; + + pub fn new() -> A { + A + } + } +}; +pub const X: () = { + impl A { + pub fn bar(&self) {} + } +}; + +fn foo() { + impl A { + pub fn yoo() {} + } + const _: () = { + impl A { + pub fn yuu() {} + } + }; +} diff --git a/tests/rustdoc/impl-parts.rs b/tests/rustdoc/impl-parts.rs index 90cbb77cb..f7738060e 100644 --- a/tests/rustdoc/impl-parts.rs +++ b/tests/rustdoc/impl-parts.rs @@ -5,7 +5,7 @@ pub auto trait AnAutoTrait {} pub struct Foo<T> { field: T } -// @has impl_parts/struct.Foo.html '//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// @has impl_parts/struct.Foo.html '//*[@class="impl"]//h3[@class="code-header"]' \ // "impl<T> !AnAutoTrait for Foo<T>where T: Sync + Clone," // @has impl_parts/trait.AnAutoTrait.html '//*[@id="implementors-list"]//h3[@class="code-header"]' \ // "impl<T> !AnAutoTrait for Foo<T>where T: Sync + Clone," diff --git a/tests/rustdoc/inline-default-methods.rs b/tests/rustdoc/inline-default-methods.rs index a4ca928f3..7706cb139 100644 --- a/tests/rustdoc/inline-default-methods.rs +++ b/tests/rustdoc/inline-default-methods.rs @@ -4,6 +4,18 @@ extern crate inline_default_methods; // @has inline_default_methods/trait.Foo.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'fn bar(&self);' -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'fn foo(&mut self) { ... }' +// @has - '//pre[@class="rust item-decl"]' '// Required method fn bar(&self);' +// @has - '//pre[@class="rust item-decl"]' '// Provided method fn foo(&mut self)' pub use inline_default_methods::Foo; + +// @has inline_default_methods/trait.Bar.html +// @has - '//pre[@class="rust item-decl"]' '// Required method fn bar(&self);' +// @has - '//pre[@class="rust item-decl"]' '// Provided methods fn foo1(&mut self)' +// @has - '//pre[@class="rust item-decl"]' 'fn foo2(&mut self)' +pub use inline_default_methods::Bar; + +// @has inline_default_methods/trait.Baz.html +// @has - '//pre[@class="rust item-decl"]' '// Required methods fn bar1(&self);' +// @has - '//pre[@class="rust item-decl"]' 'fn bar2(&self);' +// @has - '//pre[@class="rust item-decl"]' '// Provided method fn foo(&mut self)' +pub use inline_default_methods::Baz; diff --git a/tests/rustdoc/inline_cross/dyn_trait.rs b/tests/rustdoc/inline_cross/dyn_trait.rs index 0da8bfc3a..649d98f71 100644 --- a/tests/rustdoc/inline_cross/dyn_trait.rs +++ b/tests/rustdoc/inline_cross/dyn_trait.rs @@ -4,28 +4,28 @@ // edition:2021 // @has user/type.Ty0.html -// @has - '//*[@class="item-decl"]//code' "dyn for<'any> FnOnce(&'any str) -> bool + 'static" +// @has - '//*[@class="rust item-decl"]//code' "dyn for<'any> FnOnce(&'any str) -> bool + 'static" // FIXME(fmease): Hide default lifetime bound `'static` pub use dyn_trait::Ty0; // @has user/type.Ty1.html -// @has - '//*[@class="item-decl"]//code' "dyn Display + 'obj" +// @has - '//*[@class="rust item-decl"]//code' "dyn Display + 'obj" pub use dyn_trait::Ty1; // @has user/type.Ty2.html -// @has - '//*[@class="item-decl"]//code' "dyn for<'a, 'r> Container<'r, Item<'a, 'static> = ()>" +// @has - '//*[@class="rust item-decl"]//code' "dyn for<'a, 'r> Container<'r, Item<'a, 'static> = ()>" pub use dyn_trait::Ty2; // @has user/type.Ty3.html -// @has - '//*[@class="item-decl"]//code' "&'s (dyn ToString + 's)" +// @has - '//*[@class="rust item-decl"]//code' "&'s (dyn ToString + 's)" // FIXME(fmease): Hide default lifetime bound, render "&'s dyn ToString" pub use dyn_trait::Ty3; // @has user/fn.func0.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "func0(_: &dyn Fn())" +// @has - '//pre[@class="rust item-decl"]' "func0(_: &dyn Fn())" // FIXME(fmease): Show placeholder-lifetime bound, render "func0(_: &(dyn Fn() + '_))" pub use dyn_trait::func0; // @has user/fn.func1.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "func1<'func>(_: &(dyn Fn() + 'func))" +// @has - '//pre[@class="rust item-decl"]' "func1<'func>(_: &(dyn Fn() + 'func))" pub use dyn_trait::func1; diff --git a/tests/rustdoc/inline_cross/impl_trait.rs b/tests/rustdoc/inline_cross/impl_trait.rs index e8587209b..b6a1552bc 100644 --- a/tests/rustdoc/inline_cross/impl_trait.rs +++ b/tests/rustdoc/inline_cross/impl_trait.rs @@ -4,37 +4,37 @@ extern crate impl_trait_aux; // @has impl_trait/fn.func.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "pub fn func<'a>(_x: impl Clone + Into<Vec<u8, Global>> + 'a)" -// @!has - '//div[@class="item-decl"]/pre[@class="rust"]' 'where' +// @has - '//pre[@class="rust item-decl"]' "pub fn func<'a>(_x: impl Clone + Into<Vec<u8, Global>> + 'a)" +// @!has - '//pre[@class="rust item-decl"]' 'where' pub use impl_trait_aux::func; // @has impl_trait/fn.func2.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "func2<T>(" -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "_x: impl Deref<Target = Option<T>> + Iterator<Item = T>," -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "_y: impl Iterator<Item = u8>)" -// @!has - '//div[@class="item-decl"]/pre[@class="rust"]' 'where' +// @has - '//pre[@class="rust item-decl"]' "func2<T>(" +// @has - '//pre[@class="rust item-decl"]' "_x: impl Deref<Target = Option<T>> + Iterator<Item = T>," +// @has - '//pre[@class="rust item-decl"]' "_y: impl Iterator<Item = u8> )" +// @!has - '//pre[@class="rust item-decl"]' 'where' pub use impl_trait_aux::func2; // @has impl_trait/fn.func3.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "func3(" -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "_x: impl Iterator<Item = impl Iterator<Item = u8>> + Clone)" -// @!has - '//div[@class="item-decl"]/pre[@class="rust"]' 'where' +// @has - '//pre[@class="rust item-decl"]' "func3(" +// @has - '//pre[@class="rust item-decl"]' "_x: impl Iterator<Item = impl Iterator<Item = u8>> + Clone)" +// @!has - '//pre[@class="rust item-decl"]' 'where' pub use impl_trait_aux::func3; // @has impl_trait/fn.func4.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "func4<T>(" -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "T: Iterator<Item = impl Clone>," +// @has - '//pre[@class="rust item-decl"]' "func4<T>(" +// @has - '//pre[@class="rust item-decl"]' "T: Iterator<Item = impl Clone>," pub use impl_trait_aux::func4; // @has impl_trait/fn.func5.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "func5(" -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "_f: impl for<'any> Fn(&'any str, &'any str) -> bool + for<'r> Other<T<'r> = ()>," -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "_a: impl for<'alpha, 'beta> Auxiliary<'alpha, Item<'beta> = fn(_: &'beta ())>" -// @!has - '//div[@class="item-decl"]/pre[@class="rust"]' 'where' +// @has - '//pre[@class="rust item-decl"]' "func5(" +// @has - '//pre[@class="rust item-decl"]' "_f: impl for<'any> Fn(&'any str, &'any str) -> bool + for<'r> Other<T<'r> = ()>," +// @has - '//pre[@class="rust item-decl"]' "_a: impl for<'alpha, 'beta> Auxiliary<'alpha, Item<'beta> = fn(_: &'beta ())>" +// @!has - '//pre[@class="rust item-decl"]' 'where' pub use impl_trait_aux::func5; // @has impl_trait/fn.async_fn.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "pub async fn async_fn()" +// @has - '//pre[@class="rust item-decl"]' "pub async fn async_fn()" pub use impl_trait_aux::async_fn; // @has impl_trait/struct.Foo.html diff --git a/tests/rustdoc/inline_cross/issue-24183.rs b/tests/rustdoc/inline_cross/issue-24183.rs index d11b6955f..751a32385 100644 --- a/tests/rustdoc/inline_cross/issue-24183.rs +++ b/tests/rustdoc/inline_cross/issue-24183.rs @@ -5,7 +5,7 @@ // edition: 2021 // @has usr/trait.U.html -// @has - '//*[@class="item-decl"]' "pub trait U {" +// @has - '//*[@class="rust item-decl"]' "pub trait U {" // @has - '//*[@id="method.modified"]' \ // "fn modified(self) -> Self\ // where \ @@ -14,5 +14,5 @@ pub use issue_24183::U; // @has usr/trait.S.html -// @has - '//*[@class="item-decl"]' 'pub trait S: Sized {' +// @has - '//*[@class="rust item-decl"]' 'pub trait S: Sized {' pub use issue_24183::S; diff --git a/tests/rustdoc/inline_cross/issue-31948-1.rs b/tests/rustdoc/inline_cross/issue-31948-1.rs index 6e89167b3..571eaf6be 100644 --- a/tests/rustdoc/inline_cross/issue-31948-1.rs +++ b/tests/rustdoc/inline_cross/issue-31948-1.rs @@ -5,8 +5,8 @@ extern crate rustdoc_nonreachable_impls; // @has issue_31948_1/struct.Wobble.html -// @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"]' 'Bark for' +// @has - '//*[@class="impl"]//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; diff --git a/tests/rustdoc/inline_cross/issue-31948-2.rs b/tests/rustdoc/inline_cross/issue-31948-2.rs index 141e07656..7eae21046 100644 --- a/tests/rustdoc/inline_cross/issue-31948-2.rs +++ b/tests/rustdoc/inline_cross/issue-31948-2.rs @@ -5,9 +5,9 @@ extern crate rustdoc_nonreachable_impls; // @has issue_31948_2/struct.Wobble.html -// @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"]' 'Qux for' +// @has - '//*[@class="impl"]//h3[@class="code-header"]' 'Bark for' +// @has - '//*[@class="impl"]//h3[@class="code-header"]' 'Woof for' // @!has - '//*[@class="impl"]//h3[@class="code-header"]' 'Bar for' pub use rustdoc_nonreachable_impls::hidden::Wobble; diff --git a/tests/rustdoc/inline_cross/issue-31948.rs b/tests/rustdoc/inline_cross/issue-31948.rs index 96fc6ca47..9c271bf4a 100644 --- a/tests/rustdoc/inline_cross/issue-31948.rs +++ b/tests/rustdoc/inline_cross/issue-31948.rs @@ -5,9 +5,9 @@ extern crate rustdoc_nonreachable_impls; // @has issue_31948/struct.Foo.html -// @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"]' 'Bark for' +// @has - '//*[@class="impl"]//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::Foo; diff --git a/tests/rustdoc/inline_cross/macros.rs b/tests/rustdoc/inline_cross/macros.rs index 5daa0d4ba..a41b9c5b1 100644 --- a/tests/rustdoc/inline_cross/macros.rs +++ b/tests/rustdoc/inline_cross/macros.rs @@ -6,9 +6,9 @@ extern crate macros; -// @has foo/index.html '//*[@class="item-left unstable deprecated module-item"]/span[@class="stab deprecated"]' \ +// @has foo/index.html '//*[@class="item-name"]/span[@class="stab deprecated"]' \ // Deprecated -// @has - '//*[@class="item-left unstable deprecated module-item"]/span[@class="stab unstable"]' \ +// @has - '//*[@class="item-name"]/span[@class="stab unstable"]' \ // Experimental // @has foo/macro.my_macro.html diff --git a/tests/rustdoc/internal.rs b/tests/rustdoc/internal.rs index caad43a08..27b089768 100644 --- a/tests/rustdoc/internal.rs +++ b/tests/rustdoc/internal.rs @@ -3,12 +3,12 @@ // 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="desc docblock-short"]/span[@class="stab unstable"]' \ // '' // @!matches internal/index.html \ -// '//*[@class="item-right docblock-short"]/span[@class="stab internal"]' \ +// '//*[@class="desc docblock-short"]/span[@class="stab internal"]' \ // '' -// @matches - '//*[@class="item-right docblock-short"]' 'Docs' +// @matches - '//*[@class="desc docblock-short"]' 'Docs' // @!has internal/struct.S.html '//*[@class="stab unstable"]' '' // @!has internal/struct.S.html '//*[@class="stab internal"]' '' diff --git a/tests/rustdoc/intra-doc/basic.rs b/tests/rustdoc/intra-doc/basic.rs index 39f5c298b..96e21137b 100644 --- a/tests/rustdoc/intra-doc/basic.rs +++ b/tests/rustdoc/intra-doc/basic.rs @@ -1,30 +1,53 @@ // @has basic/index.html // @has - '//a/@href' 'struct.ThisType.html' +// @has - '//a/@title' 'struct basic::ThisType' // @has - '//a/@href' 'struct.ThisType.html#method.this_method' +// @has - '//a/@title' 'method basic::ThisType::this_method' +// @has - '//a/@href' 'struct.ThisType.html#method.this_assoc_fn' +// @has - '//a/@title' 'associated function basic::ThisType::this_assoc_fn' // @has - '//a/@href' 'enum.ThisEnum.html' +// @has - '//a/@title' 'enum basic::ThisEnum' // @has - '//a/@href' 'enum.ThisEnum.html#variant.ThisVariant' +// @has - '//a/@title' 'variant basic::ThisEnum::ThisVariant' // @has - '//a/@href' 'trait.ThisTrait.html' +// @has - '//a/@title' 'trait basic::ThisTrait' // @has - '//a/@href' 'trait.ThisTrait.html#tymethod.this_associated_method' +// @has - '//a/@title' 'method basic::ThisTrait::this_associated_method' +// @has - '//a/@href' 'trait.ThisTrait.html#tymethod.this_associated_fn' +// @has - '//a/@title' 'associated function basic::ThisTrait::this_associated_fn' // @has - '//a/@href' 'trait.ThisTrait.html#associatedtype.ThisAssociatedType' +// @has - '//a/@title' 'associated type basic::ThisTrait::ThisAssociatedType' // @has - '//a/@href' 'trait.ThisTrait.html#associatedconstant.THIS_ASSOCIATED_CONST' +// @has - '//a/@title' 'associated constant basic::ThisTrait::THIS_ASSOCIATED_CONST' // @has - '//a/@href' 'trait.ThisTrait.html' +// @has - '//a/@title' 'trait basic::ThisTrait' // @has - '//a/@href' 'type.ThisAlias.html' +// @has - '//a/@title' 'type basic::ThisAlias' // @has - '//a/@href' 'union.ThisUnion.html' +// @has - '//a/@title' 'union basic::ThisUnion' // @has - '//a/@href' 'fn.this_function.html' +// @has - '//a/@title' 'fn basic::this_function' // @has - '//a/@href' 'constant.THIS_CONST.html' +// @has - '//a/@title' 'constant basic::THIS_CONST' // @has - '//a/@href' 'static.THIS_STATIC.html' +// @has - '//a/@title' 'static basic::THIS_STATIC' // @has - '//a/@href' 'macro.this_macro.html' +// @has - '//a/@title' 'macro basic::this_macro' // @has - '//a/@href' 'trait.SoAmbiguous.html' +// @has - '//a/@title' 'trait basic::SoAmbiguous' // @has - '//a/@href' 'fn.SoAmbiguous.html' +// @has - '//a/@title' 'fn basic::SoAmbiguous' //! In this crate we would like to link to: //! //! * [`ThisType`](ThisType) //! * [`ThisType::this_method`](ThisType::this_method) +//! * [`ThisType::this_assoc_fn`](ThisType::this_assoc_fn) //! * [`ThisEnum`](ThisEnum) //! * [`ThisEnum::ThisVariant`](ThisEnum::ThisVariant) //! * [`ThisEnum::ThisVariantCtor`](ThisEnum::ThisVariantCtor) //! * [`ThisTrait`](ThisTrait) //! * [`ThisTrait::this_associated_method`](ThisTrait::this_associated_method) +//! * [`ThisTrait::this_associated_fn`](ThisTrait::this_associated_fn) //! * [`ThisTrait::ThisAssociatedType`](ThisTrait::ThisAssociatedType) //! * [`ThisTrait::THIS_ASSOCIATED_CONST`](ThisTrait::THIS_ASSOCIATED_CONST) //! * [`ThisAlias`](ThisAlias) @@ -51,13 +74,15 @@ macro_rules! this_macro { pub struct ThisType; impl ThisType { - pub fn this_method() {} + pub fn this_assoc_fn() {} + pub fn this_method(self) {} } pub enum ThisEnum { ThisVariant, ThisVariantCtor(u32), } pub trait ThisTrait { type ThisAssociatedType; const THIS_ASSOCIATED_CONST: u8; - fn this_associated_method(); + fn this_associated_fn(); + fn this_associated_method(&self); } pub type ThisAlias = Result<(), ()>; pub union ThisUnion { this_field: usize, } diff --git a/tests/rustdoc/issue-107995.rs b/tests/rustdoc/issue-107995.rs new file mode 100644 index 000000000..1273e4fdd --- /dev/null +++ b/tests/rustdoc/issue-107995.rs @@ -0,0 +1,28 @@ +// Regression test for <https://github.com/rust-lang/rust/issues/107995>. + +#![crate_name = "foo"] + +// @has 'foo/fn.foo.html' +// @has - '//*[@class="docblock"]//a[@href="fn.bar.html"]' 'bar`' +/// A foo, see also [ bar`] +pub fn foo() {} + +// @has 'foo/fn.bar.html' +// @has - '//*[@class="docblock"]' 'line Path line' +// @has - '//*[@class="docblock"]//a[@href="struct.Path.html"]' 'Path' +#[doc = "line ["] +#[doc = "Path"] +#[doc = "] line"] +pub fn bar() {} + +// @has 'foo/fn.another.html' +// @has - '//*[@class="docblock"]//a[@href="struct.Path.html"]' 'Path' +/// [ `Path`] +pub fn another() {} + +// @has 'foo/fn.last.html' +// @has - '//*[@class="docblock"]//a[@href="struct.Path.html"]' 'Path' +/// [ Path`] +pub fn last() {} + +pub struct Path; diff --git a/tests/rustdoc/issue-108231.rs b/tests/rustdoc/issue-108231.rs new file mode 100644 index 000000000..684f0494f --- /dev/null +++ b/tests/rustdoc/issue-108231.rs @@ -0,0 +1,23 @@ +// Regression test for <https://github.com/rust-lang/rust/issues/108231>. +// Macros with `#[macro_export]` attribute should be visible at the top level +// even if they are inside a doc hidden item. + +#![crate_name = "foo"] + +// @has 'foo/index.html' +// @count - '//*[@id="main-content"]//a[@class="macro"]' 1 +// @has - '//*[@id="main-content"]//a[@class="macro"]' 'foo' + +#[doc(hidden)] +pub mod __internal { + /// This one should be visible. + #[macro_export] + macro_rules! foo { + () => {}; + } + + /// This one should be hidden. + macro_rules! bar { + () => {}; + } +} diff --git a/tests/rustdoc/issue-108281.rs b/tests/rustdoc/issue-108281.rs new file mode 100644 index 000000000..8e1b6ba88 --- /dev/null +++ b/tests/rustdoc/issue-108281.rs @@ -0,0 +1,25 @@ +// Regression test for <https://github.com/rust-lang/rust/issues/108281>. +// It ensures that the attributes on the first reexport are not duplicated. + +#![crate_name = "foo"] + +// @has 'foo/index.html' + +#[doc(hidden)] +pub fn bar() {} +mod sub { + pub fn public() {} +} + +// @matches - '//*[@class="desc docblock-short"]' '^Displayed$' +/// Displayed +#[doc(inline)] +pub use crate::bar as Bar; +// @matches - '//*[@class="desc docblock-short"]' '^Hello\sDisplayed$' +#[doc(inline)] +/// Hello +pub use crate::Bar as Bar2; + +// @matches - '//*[@class="desc docblock-short"]' '^Public$' +/// Public +pub use crate::sub::public as Public; diff --git a/tests/rustdoc/issue-20646.rs b/tests/rustdoc/issue-20646.rs index a774b0ca7..b2ee9c260 100644 --- a/tests/rustdoc/issue-20646.rs +++ b/tests/rustdoc/issue-20646.rs @@ -13,7 +13,7 @@ pub trait Trait { } // @has issue_20646/fn.fun.html \ -// '//div[@class="item-decl"]/pre[@class="rust"]' 'where T: Trait<Output = i32>' +// '//pre[@class="rust item-decl"]' 'where T: Trait<Output = i32>' pub fn fun<T>(_: T) where T: Trait<Output=i32> {} pub mod reexport { @@ -21,6 +21,6 @@ pub mod reexport { // '//*[@id="associatedtype.Output"]' \ // 'type Output' // @has issue_20646/reexport/fn.fun.html \ - // '//div[@class="item-decl"]/pre[@class="rust"]' 'where T: Trait<Output = i32>' + // '//pre[@class="rust item-decl"]' 'where T: Trait<Output = i32>' pub use issue_20646::{Trait, fun}; } diff --git a/tests/rustdoc/issue-20727-2.rs b/tests/rustdoc/issue-20727-2.rs index 026b4f5ac..c1aa9617b 100644 --- a/tests/rustdoc/issue-20727-2.rs +++ b/tests/rustdoc/issue-20727-2.rs @@ -5,18 +5,18 @@ extern crate issue_20727; // @has issue_20727_2/trait.Add.html pub trait Add<RHS = Self> { - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'trait Add<RHS = Self> {' - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'type Output;' + // @has - '//pre[@class="rust item-decl"]' 'trait Add<RHS = Self> {' + // @has - '//pre[@class="rust item-decl"]' 'type Output;' type Output; - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'fn add(self, rhs: RHS) -> Self::Output;' + // @has - '//pre[@class="rust item-decl"]' 'fn add(self, rhs: RHS) -> Self::Output;' fn add(self, rhs: RHS) -> Self::Output; } // @has issue_20727_2/reexport/trait.Add.html pub mod reexport { - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'trait Add<RHS = Self> {' - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'type Output;' - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'fn add(self, rhs: RHS) -> Self::Output;' + // @has - '//pre[@class="rust item-decl"]' 'trait Add<RHS = Self> {' + // @has - '//pre[@class="rust item-decl"]' 'type Output;' + // @has - '//pre[@class="rust item-decl"]' 'fn add(self, rhs: RHS) -> Self::Output;' pub use issue_20727::Add; } diff --git a/tests/rustdoc/issue-20727-3.rs b/tests/rustdoc/issue-20727-3.rs index 741ce8023..2f9d91fc5 100644 --- a/tests/rustdoc/issue-20727-3.rs +++ b/tests/rustdoc/issue-20727-3.rs @@ -7,18 +7,18 @@ pub trait Bar {} // @has issue_20727_3/trait.Deref2.html pub trait Deref2 { - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'trait Deref2 {' - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'type Target: Bar;' + // @has - '//pre[@class="rust item-decl"]' 'trait Deref2 {' + // @has - '//pre[@class="rust item-decl"]' 'type Target: Bar;' type Target: Bar; - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'fn deref(&self) -> Self::Target;' + // @has - '//pre[@class="rust item-decl"]' 'fn deref(&self) -> Self::Target;' fn deref(&self) -> Self::Target; } // @has issue_20727_3/reexport/trait.Deref2.html pub mod reexport { - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'trait Deref2 {' - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'type Target: Bar;' - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'fn deref(&self) -> Self::Target;' + // @has - '//pre[@class="rust item-decl"]' 'trait Deref2 {' + // @has - '//pre[@class="rust item-decl"]' 'type Target: Bar;' + // @has - '//pre[@class="rust item-decl"]' 'fn deref(&self) -> Self::Target;' pub use issue_20727::Deref2; } diff --git a/tests/rustdoc/issue-20727-4.rs b/tests/rustdoc/issue-20727-4.rs index b8fac4da6..ec9f18fc3 100644 --- a/tests/rustdoc/issue-20727-4.rs +++ b/tests/rustdoc/issue-20727-4.rs @@ -5,36 +5,36 @@ extern crate issue_20727; // @has issue_20727_4/trait.Index.html pub trait Index<Idx: ?Sized> { - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'trait Index<Idx: ?Sized> {' - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'type Output: ?Sized' + // @has - '//pre[@class="rust item-decl"]' 'trait Index<Idx: ?Sized> {' + // @has - '//pre[@class="rust item-decl"]' 'type Output: ?Sized' type Output: ?Sized; - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' \ + // @has - '//pre[@class="rust item-decl"]' \ // 'fn index(&self, index: Idx) -> &Self::Output' fn index(&self, index: Idx) -> &Self::Output; } // @has issue_20727_4/trait.IndexMut.html pub trait IndexMut<Idx: ?Sized>: Index<Idx> { - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' \ + // @has - '//pre[@class="rust item-decl"]' \ // 'trait IndexMut<Idx: ?Sized>: Index<Idx> {' - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' \ + // @has - '//pre[@class="rust item-decl"]' \ // 'fn index_mut(&mut self, index: Idx) -> &mut Self::Output;' fn index_mut(&mut self, index: Idx) -> &mut Self::Output; } pub mod reexport { // @has issue_20727_4/reexport/trait.Index.html - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'trait Index<Idx>where Idx: ?Sized,{' - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'type Output: ?Sized' - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' \ + // @has - '//pre[@class="rust item-decl"]' 'trait Index<Idx>where Idx: ?Sized,{' + // @has - '//pre[@class="rust item-decl"]' 'type Output: ?Sized' + // @has - '//pre[@class="rust item-decl"]' \ // 'fn index(&self, index: Idx) -> &Self::Output' pub use issue_20727::Index; // @has issue_20727_4/reexport/trait.IndexMut.html - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' \ + // @has - '//pre[@class="rust item-decl"]' \ // 'trait IndexMut<Idx>: Index<Idx>where Idx: ?Sized,{' - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' \ + // @has - '//pre[@class="rust item-decl"]' \ // 'fn index_mut(&mut self, index: Idx) -> &mut Self::Output;' pub use issue_20727::IndexMut; } diff --git a/tests/rustdoc/issue-20727.rs b/tests/rustdoc/issue-20727.rs index df334821c..266848bee 100644 --- a/tests/rustdoc/issue-20727.rs +++ b/tests/rustdoc/issue-20727.rs @@ -5,20 +5,20 @@ extern crate issue_20727; // @has issue_20727/trait.Deref.html pub trait Deref { - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'trait Deref {' - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'type Target: ?Sized;' + // @has - '//pre[@class="rust item-decl"]' 'trait Deref {' + // @has - '//pre[@class="rust item-decl"]' 'type Target: ?Sized;' type Target: ?Sized; - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' \ + // @has - '//pre[@class="rust item-decl"]' \ // "fn deref<'a>(&'a self) -> &'a Self::Target;" fn deref<'a>(&'a self) -> &'a Self::Target; } // @has issue_20727/reexport/trait.Deref.html pub mod reexport { - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'trait Deref {' - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'type Target: ?Sized;' - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' \ + // @has - '//pre[@class="rust item-decl"]' 'trait Deref {' + // @has - '//pre[@class="rust item-decl"]' 'type Target: ?Sized;' + // @has - '//pre[@class="rust item-decl"]' \ // "fn deref<'a>(&'a self) -> &'a Self::Target;" pub use issue_20727::Deref; } diff --git a/tests/rustdoc/issue-21474.rs b/tests/rustdoc/issue-21474.rs index 43ce13fd9..5de26abac 100644 --- a/tests/rustdoc/issue-21474.rs +++ b/tests/rustdoc/issue-21474.rs @@ -7,5 +7,5 @@ mod inner { pub trait Blah { } // @count issue_21474/struct.What.html \ -// '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]' 1 +// '//*[@id="trait-implementations-list"]//*[@class="impl"]' 1 pub struct What; diff --git a/tests/rustdoc/issue-22038.rs b/tests/rustdoc/issue-22038.rs index 19e626ba1..de6cc7870 100644 --- a/tests/rustdoc/issue-22038.rs +++ b/tests/rustdoc/issue-22038.rs @@ -1,19 +1,19 @@ extern "C" { // @has issue_22038/fn.foo1.html \ - // '//div[@class="item-decl"]/pre[@class="rust"]' 'pub unsafe extern "C" fn foo1()' + // '//pre[@class="rust item-decl"]' 'pub unsafe extern "C" fn foo1()' pub fn foo1(); } extern "system" { // @has issue_22038/fn.foo2.html \ - // '//div[@class="item-decl"]/pre[@class="rust"]' 'pub unsafe extern "system" fn foo2()' + // '//pre[@class="rust item-decl"]' 'pub unsafe extern "system" fn foo2()' pub fn foo2(); } // @has issue_22038/fn.bar.html \ -// '//div[@class="item-decl"]/pre[@class="rust"]' 'pub extern "C" fn bar()' +// '//pre[@class="rust item-decl"]' 'pub extern "C" fn bar()' pub extern "C" fn bar() {} // @has issue_22038/fn.baz.html \ -// '//div[@class="item-decl"]/pre[@class="rust"]' 'pub extern "system" fn baz()' +// '//pre[@class="rust item-decl"]' 'pub extern "system" fn baz()' pub extern "system" fn baz() {} diff --git a/tests/rustdoc/issue-32374.rs b/tests/rustdoc/issue-32374.rs index 8d2c27cf3..985bf03a1 100644 --- a/tests/rustdoc/issue-32374.rs +++ b/tests/rustdoc/issue-32374.rs @@ -2,11 +2,11 @@ #![doc(issue_tracker_base_url = "https://issue_url/")] #![unstable(feature = "test", issue = "32374")] -// @matches issue_32374/index.html '//*[@class="item-left unstable deprecated module-item"]/span[@class="stab deprecated"]' \ +// @matches issue_32374/index.html '//*[@class="item-name"]/span[@class="stab deprecated"]' \ // 'Deprecated' -// @matches issue_32374/index.html '//*[@class="item-left unstable deprecated module-item"]/span[@class="stab unstable"]' \ +// @matches issue_32374/index.html '//*[@class="item-name"]/span[@class="stab unstable"]' \ // 'Experimental' -// @matches issue_32374/index.html '//*[@class="item-right docblock-short"]/text()' 'Docs' +// @matches issue_32374/index.html '//*[@class="desc docblock-short"]/text()' 'Docs' // @has issue_32374/struct.T.html '//*[@class="stab deprecated"]/span' '👎' // @has issue_32374/struct.T.html '//*[@class="stab deprecated"]/span' \ diff --git a/tests/rustdoc/issue-33302.rs b/tests/rustdoc/issue-33302.rs index b4c52e2f1..a316f3ad9 100644 --- a/tests/rustdoc/issue-33302.rs +++ b/tests/rustdoc/issue-33302.rs @@ -6,23 +6,23 @@ macro_rules! make { pub struct S; // @has issue_33302/constant.CST.html \ - // '//div[@class="item-decl"]/pre[@class="rust"]' 'pub const CST: i32' + // '//pre[@class="rust item-decl"]' 'pub const CST: i32' pub const CST: i32 = ($n * $n); // @has issue_33302/static.ST.html \ - // '//div[@class="item-decl"]/pre[@class="rust"]' 'pub static ST: i32' + // '//pre[@class="rust item-decl"]' 'pub static ST: i32' pub static ST: i32 = ($n * $n); pub trait T<X> { fn ignore(_: &X) {} const C: X; // @has issue_33302/trait.T.html \ - // '//div[@class="item-decl"]/pre[@class="rust"]' 'const D: i32' + // '//pre[@class="rust item-decl"]' 'const D: i32' // @has - '//*[@id="associatedconstant.D"]' 'const D: i32' const D: i32 = ($n * $n); } // @has issue_33302/struct.S.html \ - // '//*[@class="impl has-srclink"]' 'impl T<[i32; 16]> for S' + // '//*[@class="impl"]' 'impl T<[i32; 16]> for S' // @has - '//*[@id="associatedconstant.C"]' 'const C: [i32; 16]' // @has - '//*[@id="associatedconstant.D"]' 'const D: i32' impl T<[i32; ($n * $n)]> for S { @@ -30,7 +30,7 @@ macro_rules! make { } // @has issue_33302/struct.S.html \ - // '//*[@class="impl has-srclink"]' 'impl T<[i32; 16]> for S' + // '//*[@class="impl"]' 'impl T<[i32; 16]> for S' // @has - '//*[@id="associatedconstant.C-1"]' 'const C: (i32,)' // @has - '//*[@id="associatedconstant.D-1"]' 'const D: i32' impl T<(i32,)> for S { @@ -38,7 +38,7 @@ macro_rules! make { } // @has issue_33302/struct.S.html \ - // '//*[@class="impl has-srclink"]' 'impl T<(i32, i32)> for S' + // '//*[@class="impl"]' 'impl T<(i32, i32)> for S' // @has - '//*[@id="associatedconstant.C-2"]' 'const C: (i32, i32)' // @has - '//*[@id="associatedconstant.D-2"]' 'const D: i32' impl T<(i32, i32)> for S { diff --git a/tests/rustdoc/issue-34928.rs b/tests/rustdoc/issue-34928.rs index 91b677574..4184086f6 100644 --- a/tests/rustdoc/issue-34928.rs +++ b/tests/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/tests/rustdoc/issue-45584.rs b/tests/rustdoc/issue-45584.rs index 86479e6fb..8a5f04138 100644 --- a/tests/rustdoc/issue-45584.rs +++ b/tests/rustdoc/issue-45584.rs @@ -4,12 +4,12 @@ pub trait Bar<T, U> {} // @has 'foo/struct.Foo1.html' pub struct Foo1; -// @count - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]' 1 -// @has - '//*[@class="impl has-srclink"]' "impl Bar<Foo1, &'static Foo1> for Foo1" +// @count - '//*[@id="trait-implementations-list"]//*[@class="impl"]' 1 +// @has - '//*[@class="impl"]' "impl Bar<Foo1, &'static Foo1> for Foo1" impl Bar<Foo1, &'static Foo1> for Foo1 {} // @has 'foo/struct.Foo2.html' pub struct Foo2; -// @count - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]' 1 -// @has - '//*[@class="impl has-srclink"]' "impl Bar<&'static Foo2, Foo2> for u8" +// @count - '//*[@id="trait-implementations-list"]//*[@class="impl"]' 1 +// @has - '//*[@class="impl"]' "impl Bar<&'static Foo2, Foo2> for u8" impl Bar<&'static Foo2, Foo2> for u8 {} diff --git a/tests/rustdoc/issue-46377.rs b/tests/rustdoc/issue-46377.rs index 4489f038c..1311b4721 100644 --- a/tests/rustdoc/issue-46377.rs +++ b/tests/rustdoc/issue-46377.rs @@ -1,3 +1,3 @@ -// @has 'issue_46377/index.html' '//*[@class="item-right docblock-short"]' 'Check out this struct!' +// @has 'issue_46377/index.html' '//*[@class="desc docblock-short"]' 'Check out this struct!' /// # Check out this struct! pub struct SomeStruct; diff --git a/tests/rustdoc/issue-50159.rs b/tests/rustdoc/issue-50159.rs index 04bc4f304..13bedd5db 100644 --- a/tests/rustdoc/issue-50159.rs +++ b/tests/rustdoc/issue-50159.rs @@ -14,7 +14,7 @@ impl<B, C> Signal2 for B where B: Signal<Item = C> { // @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 +// @count - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]' 5 pub struct Switch<B: Signal> { pub inner: <B as Signal2>::Item2, } diff --git a/tests/rustdoc/issue-51236.rs b/tests/rustdoc/issue-51236.rs index 1c7aa9c7e..04664805a 100644 --- a/tests/rustdoc/issue-51236.rs +++ b/tests/rustdoc/issue-51236.rs @@ -7,7 +7,7 @@ pub mod traits { } // @has issue_51236/struct.Owned.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//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/tests/rustdoc/issue-53812.rs b/tests/rustdoc/issue-53812.rs index c68ffd521..dc1eb304c 100644 --- a/tests/rustdoc/issue-53812.rs +++ b/tests/rustdoc/issue-53812.rs @@ -12,9 +12,9 @@ macro_rules! array_impls { } // @has issue_53812/trait.MyIterator.html -// @has - '//*[@id="implementors-list"]/*[@class="impl has-srclink"][1]' 'MyStruct<[T; 0]>' -// @has - '//*[@id="implementors-list"]/*[@class="impl has-srclink"][2]' 'MyStruct<[T; 1]>' -// @has - '//*[@id="implementors-list"]/*[@class="impl has-srclink"][3]' 'MyStruct<[T; 2]>' -// @has - '//*[@id="implementors-list"]/*[@class="impl has-srclink"][4]' 'MyStruct<[T; 3]>' -// @has - '//*[@id="implementors-list"]/*[@class="impl has-srclink"][5]' 'MyStruct<[T; 10]>' +// @has - '//*[@id="implementors-list"]/*[@class="impl"][1]' 'MyStruct<[T; 0]>' +// @has - '//*[@id="implementors-list"]/*[@class="impl"][2]' 'MyStruct<[T; 1]>' +// @has - '//*[@id="implementors-list"]/*[@class="impl"][3]' 'MyStruct<[T; 2]>' +// @has - '//*[@id="implementors-list"]/*[@class="impl"][4]' 'MyStruct<[T; 3]>' +// @has - '//*[@id="implementors-list"]/*[@class="impl"][5]' 'MyStruct<[T; 10]>' array_impls! { 10 3 2 1 0 } diff --git a/tests/rustdoc/issue-54705.rs b/tests/rustdoc/issue-54705.rs index 7b7290ab4..a886eb0de 100644 --- a/tests/rustdoc/issue-54705.rs +++ b/tests/rustdoc/issue-54705.rs @@ -1,10 +1,10 @@ pub trait ScopeHandle<'scope> {} // @has issue_54705/struct.ScopeFutureContents.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//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"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//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/tests/rustdoc/issue-55321.rs b/tests/rustdoc/issue-55321.rs index 22a18ef90..d3c2070d9 100644 --- a/tests/rustdoc/issue-55321.rs +++ b/tests/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"]' \ +// @has - '//*[@id="trait-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ // "impl !Send for A" -// @has - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// @has - '//*[@id="trait-implementations-list"]//*[@class="impl"]//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"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ // "impl<T> !Send for B<T>" -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ // "impl<T> !Sync for B<T>" pub struct B<T: ?Sized>(A, Box<T>); diff --git a/tests/rustdoc/issue-55364.rs b/tests/rustdoc/issue-55364.rs index 14a6f5041..941cb3ce1 100644 --- a/tests/rustdoc/issue-55364.rs +++ b/tests/rustdoc/issue-55364.rs @@ -29,8 +29,8 @@ pub mod subone { // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.foo.html"]' 'foo' // @has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.bar.html"]' 'bar' // Though there should be such links later -// @has - '//section[@id="main-content"]/div[@class="item-table"]//div[@class="item-left module-item"]/a[@class="fn"][@href="fn.foo.html"]' 'foo' -// @has - '//section[@id="main-content"]/div[@class="item-table"]//div[@class="item-left module-item"]/a[@class="fn"][@href="fn.bar.html"]' 'bar' +// @has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="item-name"]/a[@class="fn"][@href="fn.foo.html"]' 'foo' +// @has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="item-name"]/a[@class="fn"][@href="fn.bar.html"]' 'bar' /// See either [foo] or [bar]. pub mod subtwo { @@ -68,8 +68,8 @@ pub mod subthree { // Next we go *deeper* - In order to ensure it's not just "this or parent" // we test `crate::` and a `super::super::...` chain // @has issue_55364/subfour/subfive/subsix/subseven/subeight/index.html -// @has - '//section[@id="main-content"]/div[@class="item-table"]//div[@class="item-right docblock-short"]//a[@href="../../../../../subone/fn.foo.html"]' 'other foo' -// @has - '//section[@id="main-content"]/div[@class="item-table"]//div[@class="item-right docblock-short"]//a[@href="../../../../../subtwo/fn.bar.html"]' 'other bar' +// @has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="desc docblock-short"]//a[@href="../../../../../subone/fn.foo.html"]' 'other foo' +// @has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="desc docblock-short"]//a[@href="../../../../../subtwo/fn.bar.html"]' 'other bar' pub mod subfour { pub mod subfive { pub mod subsix { diff --git a/tests/rustdoc/issue-56822.rs b/tests/rustdoc/issue-56822.rs index b4eef344b..c9a743357 100644 --- a/tests/rustdoc/issue-56822.rs +++ b/tests/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"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//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/tests/rustdoc/issue-60726.rs b/tests/rustdoc/issue-60726.rs index fbb0f82ae..e337e4a4f 100644 --- a/tests/rustdoc/issue-60726.rs +++ b/tests/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"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ // "impl<T> !Send for IntoIter<T>" -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ // "impl<T> !Sync for IntoIter<T>" pub struct IntoIter<T>{ hello:DynTrait<FooInterface<T>>, diff --git a/tests/rustdoc/issue-76501.rs b/tests/rustdoc/issue-76501.rs index a90e0fea0..5caea0ec9 100644 --- a/tests/rustdoc/issue-76501.rs +++ b/tests/rustdoc/issue-76501.rs @@ -8,7 +8,7 @@ pub const fn bloop() -> i32 { pub struct Struct {} impl Struct { - // @has 'issue_76501/struct.Struct.html' '//*[@class="method has-srclink"]' \ + // @has 'issue_76501/struct.Struct.html' '//*[@class="method"]' \ // 'pub const fn blurp() -> i32' /// A useless function that always returns 1. pub const fn blurp() -> i32 { diff --git a/tests/rustdoc/issue-78673.rs b/tests/rustdoc/issue-78673.rs index 2e4bec254..d09141c32 100644 --- a/tests/rustdoc/issue-78673.rs +++ b/tests/rustdoc/issue-78673.rs @@ -7,8 +7,8 @@ pub trait AnAmazingTrait {} impl<T: Something> AnAmazingTrait for T {} // @has 'issue_78673/struct.MyStruct.html' -// @has - '//*[@class="impl has-srclink"]' 'AnAmazingTrait for MyStruct' -// @!has - '//*[@class="impl has-srclink"]' 'AnAmazingTrait for T' +// @has - '//*[@class="impl"]' 'AnAmazingTrait for MyStruct' +// @!has - '//*[@class="impl"]' 'AnAmazingTrait for T' pub struct MyStruct; impl AnAmazingTrait for MyStruct {} @@ -16,8 +16,8 @@ impl AnAmazingTrait for MyStruct {} // generic structs may have _both_ specific and blanket impls that apply // @has 'issue_78673/struct.AnotherStruct.html' -// @has - '//*[@class="impl has-srclink"]' 'AnAmazingTrait for AnotherStruct<()>' -// @has - '//*[@class="impl has-srclink"]' 'AnAmazingTrait for T' +// @has - '//*[@class="impl"]' 'AnAmazingTrait for AnotherStruct<()>' +// @has - '//*[@class="impl"]' 'AnAmazingTrait for T' pub struct AnotherStruct<T>(T); impl<T: Something> Something for AnotherStruct<T> {} diff --git a/tests/rustdoc/issue-83375-multiple-mods-w-same-name-doc-inline-last-item.rs b/tests/rustdoc/issue-83375-multiple-mods-w-same-name-doc-inline-last-item.rs index d3a7a870b..9bce25846 100644 --- a/tests/rustdoc/issue-83375-multiple-mods-w-same-name-doc-inline-last-item.rs +++ b/tests/rustdoc/issue-83375-multiple-mods-w-same-name-doc-inline-last-item.rs @@ -11,6 +11,6 @@ pub mod sub { #[doc(inline)] pub use sub::*; -// @count foo/index.html '//a[@class="mod"][@title="foo::prelude mod"]' 1 +// @count foo/index.html '//a[@class="mod"][@title="mod foo::prelude"]' 1 // @count foo/prelude/index.html '//div[@class="item-row"]' 0 pub mod prelude {} diff --git a/tests/rustdoc/issue-83375-multiple-mods-w-same-name-doc-inline.rs b/tests/rustdoc/issue-83375-multiple-mods-w-same-name-doc-inline.rs index b83692509..d0960dfef 100644 --- a/tests/rustdoc/issue-83375-multiple-mods-w-same-name-doc-inline.rs +++ b/tests/rustdoc/issue-83375-multiple-mods-w-same-name-doc-inline.rs @@ -8,7 +8,7 @@ pub mod sub { } } -// @count foo/index.html '//a[@class="mod"][@title="foo::prelude mod"]' 1 +// @count foo/index.html '//a[@class="mod"][@title="mod foo::prelude"]' 1 // @count foo/prelude/index.html '//div[@class="item-row"]' 0 pub mod prelude {} diff --git a/tests/rustdoc/issue-85454.rs b/tests/rustdoc/issue-85454.rs index 74fc22b31..5a49a9d06 100644 --- a/tests/rustdoc/issue-85454.rs +++ b/tests/rustdoc/issue-85454.rs @@ -5,7 +5,7 @@ extern crate issue_85454; // @has foo/trait.FromResidual.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub trait FromResidual<R = <Self as Try>::Residual> { fn from_residual(residual: R) -> Self; }' +// @has - '//pre[@class="rust item-decl"]' 'pub trait FromResidual<R = <Self as Try>::Residual> { // Required method fn from_residual(residual: R) -> Self; }' pub trait FromResidual<R = <Self as Try>::Residual> { fn from_residual(residual: R) -> Self; } @@ -24,6 +24,6 @@ pub enum ControlFlow<B, C = ()> { pub mod reexport { // @has foo/reexport/trait.FromResidual.html - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub trait FromResidual<R = <Self as Try>::Residual> { fn from_residual(residual: R) -> Self; }' + // @has - '//pre[@class="rust item-decl"]' 'pub trait FromResidual<R = <Self as Try>::Residual> { // Required method fn from_residual(residual: R) -> Self; }' pub use issue_85454::*; } diff --git a/tests/rustdoc/issue-95873.rs b/tests/rustdoc/issue-95873.rs index ff33fb63a..83f1f2f75 100644 --- a/tests/rustdoc/issue-95873.rs +++ b/tests/rustdoc/issue-95873.rs @@ -1,2 +1,2 @@ -// @has issue_95873/index.html "//*[@class='item-left import-item']" "pub use ::std as x;" +// @has issue_95873/index.html "//*[@class='item-name']" "pub use ::std as x;" pub use ::std as x; diff --git a/tests/rustdoc/issue-98697.rs b/tests/rustdoc/issue-98697.rs index 884b63ac9..5d5aee1fe 100644 --- a/tests/rustdoc/issue-98697.rs +++ b/tests/rustdoc/issue-98697.rs @@ -8,8 +8,8 @@ extern crate issue_98697_reexport_with_anonymous_lifetime; -// @has issue_98697/fn.repro.html '//div[@class="item-decl"]/pre[@class="rust"]/code' 'fn repro<F>()where F: Fn(&str)' -// @!has issue_98697/fn.repro.html '//div[@class="item-decl"]/pre[@class="rust"]/code' 'for<' +// @has issue_98697/fn.repro.html '//pre[@class="rust item-decl"]/code' 'fn repro<F>()where F: Fn(&str)' +// @!has issue_98697/fn.repro.html '//pre[@class="rust item-decl"]/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"]' 'impl MyTrait<&Extra> for Extra' diff --git a/tests/rustdoc/issue-99221-multiple-structs-w-same-name.rs b/tests/rustdoc/issue-99221-multiple-structs-w-same-name.rs index 41e64726a..ba29a77eb 100644 --- a/tests/rustdoc/issue-99221-multiple-structs-w-same-name.rs +++ b/tests/rustdoc/issue-99221-multiple-structs-w-same-name.rs @@ -9,6 +9,6 @@ extern crate issue_99221_aux; pub use issue_99221_aux::*; -// @count foo/index.html '//a[@class="struct"][@title="foo::Print struct"]' 1 +// @count foo/index.html '//a[@class="struct"][@title="struct foo::Print"]' 1 pub struct Print; diff --git a/tests/rustdoc/issue-99734-multiple-foreigns-w-same-name.rs b/tests/rustdoc/issue-99734-multiple-foreigns-w-same-name.rs index 3208fea05..b56ec6e11 100644 --- a/tests/rustdoc/issue-99734-multiple-foreigns-w-same-name.rs +++ b/tests/rustdoc/issue-99734-multiple-foreigns-w-same-name.rs @@ -9,7 +9,7 @@ extern crate issue_99734_aux; pub use issue_99734_aux::*; -// @count foo/index.html '//a[@class="fn"][@title="foo::main fn"]' 1 +// @count foo/index.html '//a[@class="fn"][@title="fn foo::main"]' 1 extern "C" { pub fn main() -> std::ffi::c_int; diff --git a/tests/rustdoc/issue-99734-multiple-mods-w-same-name.rs b/tests/rustdoc/issue-99734-multiple-mods-w-same-name.rs index b2f9b8b46..8f5d6fa3d 100644 --- a/tests/rustdoc/issue-99734-multiple-mods-w-same-name.rs +++ b/tests/rustdoc/issue-99734-multiple-mods-w-same-name.rs @@ -9,6 +9,6 @@ extern crate issue_99734_aux; pub use issue_99734_aux::*; -// @count foo/index.html '//a[@class="mod"][@title="foo::task mod"]' 1 +// @count foo/index.html '//a[@class="mod"][@title="mod foo::task"]' 1 pub mod task {} diff --git a/tests/rustdoc/item-desc-list-at-start.item-table.html b/tests/rustdoc/item-desc-list-at-start.item-table.html new file mode 100644 index 000000000..72bde573c --- /dev/null +++ b/tests/rustdoc/item-desc-list-at-start.item-table.html @@ -0,0 +1 @@ +<ul class="item-table"><li><div class="item-name"><a class="constant" href="constant.MY_CONSTANT.html" title="constant item_desc_list_at_start::MY_CONSTANT">MY_CONSTANT</a></div><div class="desc docblock-short">Groups: <code>SamplePatternSGIS</code>, <code>SamplePatternEXT</code></div></li></ul>
\ No newline at end of file diff --git a/tests/rustdoc/item-desc-list-at-start.rs b/tests/rustdoc/item-desc-list-at-start.rs new file mode 100644 index 000000000..d88c61d33 --- /dev/null +++ b/tests/rustdoc/item-desc-list-at-start.rs @@ -0,0 +1,9 @@ +// @has item_desc_list_at_start/index.html +// @count - '//ul[@class="item-table"]/li/div/li' 0 +// @count - '//ul[@class="item-table"]/li' 1 +// @snapshot item-table - '//ul[@class="item-table"]' + +// based on https://docs.rs/gl_constants/0.1.1/src/gl_constants/lib.rs.html#16 + +/// * Groups: `SamplePatternSGIS`, `SamplePatternEXT` +pub const MY_CONSTANT: usize = 0; diff --git a/tests/rustdoc/legacy-const-generic.rs b/tests/rustdoc/legacy-const-generic.rs index 14533624e..3a488bdd2 100644 --- a/tests/rustdoc/legacy-const-generic.rs +++ b/tests/rustdoc/legacy-const-generic.rs @@ -2,14 +2,14 @@ #![feature(rustc_attrs)] // @has 'foo/fn.foo.html' -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'fn foo(x: usize, const Y: usize, z: usize) -> [usize; 3]' +// @has - '//pre[@class="rust item-decl"]' 'fn foo(x: usize, const Y: usize, z: usize) -> [usize; 3]' #[rustc_legacy_const_generics(1)] pub fn foo<const Y: usize>(x: usize, z: usize) -> [usize; 3] { [x, Y, z] } // @has 'foo/fn.bar.html' -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'fn bar(x: usize, const Y: usize, const Z: usize) -> [usize; 3]' +// @has - '//pre[@class="rust item-decl"]' 'fn bar(x: usize, const Y: usize, const Z: usize) -> [usize; 3]' #[rustc_legacy_const_generics(1, 2)] pub fn bar<const Y: usize, const Z: usize>(x: usize) -> [usize; 3] { [x, Y, z] diff --git a/tests/rustdoc/lifetime-name.rs b/tests/rustdoc/lifetime-name.rs index 0fb660591..15e09f516 100644 --- a/tests/rustdoc/lifetime-name.rs +++ b/tests/rustdoc/lifetime-name.rs @@ -1,5 +1,5 @@ #![crate_name = "foo"] // @has 'foo/type.Resolutions.html' -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "pub type Resolutions<'tcx> = &'tcx u8;" +// @has - '//pre[@class="rust item-decl"]' "pub type Resolutions<'tcx> = &'tcx u8;" pub type Resolutions<'tcx> = &'tcx u8; diff --git a/tests/rustdoc/macro-higher-kinded-function.rs b/tests/rustdoc/macro-higher-kinded-function.rs index b8c52b7b7..a45ef37a7 100644 --- a/tests/rustdoc/macro-higher-kinded-function.rs +++ b/tests/rustdoc/macro-higher-kinded-function.rs @@ -11,8 +11,8 @@ macro_rules! gen { } // @has 'foo/struct.Providers.html' -// @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 - '//*[@class="rust item-decl"]//code' "pub a: for<'tcx> fn(_: TyCtxt<'tcx>, _: u8) -> i8," +// @has - '//*[@class="rust 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/tests/rustdoc/markdown-summaries.rs b/tests/rustdoc/markdown-summaries.rs deleted file mode 100644 index 31e7072b5..000000000 --- a/tests/rustdoc/markdown-summaries.rs +++ /dev/null @@ -1,27 +0,0 @@ -#![crate_type = "lib"] -#![crate_name = "summaries"] - -//! This *summary* has a [link] and `code`. -//! -//! This is the second paragraph. -//! -//! [link]: https://example.com - -// @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; - -// @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; - -// @!hasraw summaries/sidebar-items.js 'block should not be rendered' diff --git a/tests/rustdoc/mut-params.rs b/tests/rustdoc/mut-params.rs index 3b862e651..e403b7b78 100644 --- a/tests/rustdoc/mut-params.rs +++ b/tests/rustdoc/mut-params.rs @@ -5,7 +5,7 @@ pub struct Foo; -// @count foo/struct.Foo.html '//*[@class="impl-items"]//*[@class="method has-srclink"]' 2 +// @count foo/struct.Foo.html '//*[@class="impl-items"]//*[@class="method"]' 2 // @!has - '//*[@class="impl-items"]//*[@class="method"]' 'mut' impl Foo { pub fn foo(mut self) {} @@ -13,6 +13,6 @@ impl Foo { pub fn bar(mut bar: ()) {} } -// @count foo/fn.baz.html '//div[@class="item-decl"]/pre[@class="rust"]' 1 -// @!has - '//div[@class="item-decl"]/pre[@class="rust"]' 'mut' +// @count foo/fn.baz.html '//pre[@class="rust item-decl"]' 1 +// @!has - '//pre[@class="rust item-decl"]' 'mut' pub fn baz(mut foo: Foo) {} diff --git a/tests/rustdoc/negative-impl.rs b/tests/rustdoc/negative-impl.rs index af19c784d..51223af67 100644 --- a/tests/rustdoc/negative-impl.rs +++ b/tests/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"]' \ +// @matches negative_impl/struct.Alpha.html '//*[@class="impl"]//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"]' "\ +// @matches negative_impl/struct.Bravo.html '//*[@class="impl"]//h3[@class="code-header"]' "\ // impl<B> !Send for Bravo<B>" impl<B> !Send for Bravo<B> {} diff --git a/tests/rustdoc/normalize-assoc-item.rs b/tests/rustdoc/normalize-assoc-item.rs index 659480479..af7b2f955 100644 --- a/tests/rustdoc/normalize-assoc-item.rs +++ b/tests/rustdoc/normalize-assoc-item.rs @@ -19,12 +19,12 @@ impl Trait for isize { type X = <() as Trait>::X; } -// @has 'normalize_assoc_item/fn.f.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn f() -> isize' +// @has 'normalize_assoc_item/fn.f.html' '//pre[@class="rust item-decl"]' 'pub fn f() -> isize' pub fn f() -> <usize as Trait>::X { 0 } -// @has 'normalize_assoc_item/fn.f2.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn f2() -> fn() -> i32' +// @has 'normalize_assoc_item/fn.f2.html' '//pre[@class="rust item-decl"]' 'pub fn f2() -> fn() -> i32' pub fn f2() -> <isize as Trait>::X { todo!() } @@ -49,10 +49,10 @@ impl<Inner: Trait> Trait for Generic<Inner> { // These can't be normalized because they depend on a generic parameter. // However the user can choose whether the text should be displayed as `Inner::X` or `<Inner as Trait>::X`. -// @has 'normalize_assoc_item/struct.Unknown.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub struct Unknown<Inner: Trait>(pub <Inner as Trait>::X);' +// @has 'normalize_assoc_item/struct.Unknown.html' '//pre[@class="rust item-decl"]' 'pub struct Unknown<Inner: Trait>(pub <Inner as Trait>::X);' pub struct Unknown<Inner: Trait>(pub <Inner as Trait>::X); -// @has 'normalize_assoc_item/struct.Unknown2.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub struct Unknown2<Inner: Trait>(pub Inner::X);' +// @has 'normalize_assoc_item/struct.Unknown2.html' '//pre[@class="rust item-decl"]' 'pub struct Unknown2<Inner: Trait>(pub Inner::X);' pub struct Unknown2<Inner: Trait>(pub Inner::X); trait Lifetimes<'a> { @@ -63,20 +63,20 @@ impl<'a> Lifetimes<'a> for usize { type Y = &'a isize; } -// @has 'normalize_assoc_item/fn.g.html' '//div[@class="item-decl"]/pre[@class="rust"]' "pub fn g() -> &isize" +// @has 'normalize_assoc_item/fn.g.html' '//pre[@class="rust item-decl"]' "pub fn g() -> &isize" pub fn g() -> <usize as Lifetimes<'static>>::Y { &0 } -// @has 'normalize_assoc_item/constant.A.html' '//div[@class="item-decl"]/pre[@class="rust"]' "pub const A: &isize" +// @has 'normalize_assoc_item/constant.A.html' '//pre[@class="rust item-decl"]' "pub const A: &isize" pub const A: <usize as Lifetimes<'static>>::Y = &0; // test cross-crate re-exports extern crate inner; -// @has 'normalize_assoc_item/fn.foo.html' '//div[@class="item-decl"]/pre[@class="rust"]' "pub fn foo() -> i32" +// @has 'normalize_assoc_item/fn.foo.html' '//pre[@class="rust item-decl"]' "pub fn foo() -> i32" pub use inner::foo; -// @has 'normalize_assoc_item/fn.h.html' '//div[@class="item-decl"]/pre[@class="rust"]' "pub fn h<T>() -> IntoIter<T, Global>" +// @has 'normalize_assoc_item/fn.h.html' '//pre[@class="rust item-decl"]' "pub fn h<T>() -> IntoIter<T, Global>" pub fn h<T>() -> <Vec<T> as IntoIterator>::IntoIter { vec![].into_iter() } diff --git a/tests/rustdoc/playground-arg.rs b/tests/rustdoc/playground-arg.rs index 69c896265..f3811fe0b 100644 --- a/tests/rustdoc/playground-arg.rs +++ b/tests/rustdoc/playground-arg.rs @@ -10,4 +10,4 @@ pub fn dummy() {} // ensure that `extern crate foo;` was inserted into code snips automatically: -// @matches foo/index.html '//a[@class="test-arrow"][@href="https://example.com/?code=%23!%5Ballow(unused)%5D%0Aextern%20crate%20r%23foo%3B%0Afn%20main()%20%7B%0Ause%20foo%3A%3Adummy%3B%0Adummy()%3B%0A%7D&edition=2015"]' "Run" +// @matches foo/index.html '//a[@class="test-arrow"][@href="https://example.com/?code=%23!%5Ballow(unused)%5D%0Aextern+crate+r%23foo;%0Afn+main()+%7B%0Ause+foo::dummy;%0Adummy();%0A%7D&edition=2015"]' "Run" diff --git a/tests/rustdoc/playground.rs b/tests/rustdoc/playground.rs index 877ea1cfb..5c7fa33ef 100644 --- a/tests/rustdoc/playground.rs +++ b/tests/rustdoc/playground.rs @@ -22,6 +22,6 @@ //! } //! ``` -// @matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0A%20%20%20%20println!(%22Hello%2C%20world!%22)%3B%0A%7D&edition=2015"]' "Run" -// @matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0Afn%20main()%20%7B%0Aprintln!(%22Hello%2C%20world!%22)%3B%0A%7D&edition=2015"]' "Run" -// @matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0A%23!%5Bfeature(something)%5D%0A%0Afn%20main()%20%7B%0A%20%20%20%20println!(%22Hello%2C%20world!%22)%3B%0A%7D&version=nightly&edition=2015"]' "Run" +// @matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0Aprintln!(%22Hello,+world!%22);%0A%7D&edition=2015"]' "Run" +// @matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0A++++println!(%22Hello,+world!%22);%0A%7D&edition=2015"]' "Run" +// @matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0A%23!%5Bfeature(something)%5D%0A%0Afn+main()+%7B%0A++++println!(%22Hello,+world!%22);%0A%7D&version=nightly&edition=2015"]' "Run" diff --git a/tests/rustdoc/primitive-reference.rs b/tests/rustdoc/primitive-reference.rs index c3a5eb6d3..10efbefd2 100644 --- a/tests/rustdoc/primitive-reference.rs +++ b/tests/rustdoc/primitive-reference.rs @@ -13,7 +13,7 @@ // @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 +// @count - '//*[@class="impl"]' 1 // @has - '//*[@id="impl-Foo%3C%26A%3E-for-%26B"]/*[@class="code-header"]' \ // 'impl<A, B> Foo<&A> for &B' #[doc(primitive = "reference")] diff --git a/tests/rustdoc/primitive-tuple-variadic.rs b/tests/rustdoc/primitive-tuple-variadic.rs index db7cfd60c..846028bbb 100644 --- a/tests/rustdoc/primitive-tuple-variadic.rs +++ b/tests/rustdoc/primitive-tuple-variadic.rs @@ -6,13 +6,13 @@ pub trait Foo {} // @has foo/trait.Foo.html -// @has - '//section[@id="impl-Foo-for-(T%2C)"]/h3' 'impl<T> Foo for (T₁, T₂, …, Tₙ)' +// @has - '//section[@id="impl-Foo-for-(T,)"]/h3' 'impl<T> Foo for (T₁, T₂, …, Tₙ)' #[doc(fake_variadic)] impl<T> Foo for (T,) {} pub trait Bar {} // @has foo/trait.Bar.html -// @has - '//section[@id="impl-Bar-for-(U%2C)"]/h3' 'impl<U: Foo> Bar for (U₁, U₂, …, Uₙ)' +// @has - '//section[@id="impl-Bar-for-(U,)"]/h3' 'impl<U: Foo> Bar for (U₁, U₂, …, Uₙ)' #[doc(fake_variadic)] impl<U: Foo> Bar for (U,) {} diff --git a/tests/rustdoc/pub-method.rs b/tests/rustdoc/pub-method.rs index 0dca3f672..ea4791579 100644 --- a/tests/rustdoc/pub-method.rs +++ b/tests/rustdoc/pub-method.rs @@ -3,15 +3,15 @@ #![crate_name = "foo"] // @has foo/fn.bar.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn bar() -> ' +// @has - '//pre[@class="rust item-decl"]' 'pub fn bar() -> ' /// foo pub fn bar() -> usize { 2 } // @has foo/struct.Foo.html -// @has - '//*[@class="method has-srclink"]' 'pub fn new()' -// @has - '//*[@class="method has-srclink"]' 'fn not_pub()' +// @has - '//*[@class="method"]' 'pub fn new()' +// @has - '//*[@class="method"]' 'fn not_pub()' pub struct Foo(usize); impl Foo { diff --git a/tests/rustdoc/range-arg-pattern.rs b/tests/rustdoc/range-arg-pattern.rs index bdbcc47c9..d0d9111bb 100644 --- a/tests/rustdoc/range-arg-pattern.rs +++ b/tests/rustdoc/range-arg-pattern.rs @@ -1,5 +1,5 @@ #![crate_name = "foo"] // @has foo/fn.f.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn f(_: u8)' +// @has - '//pre[@class="rust item-decl"]' 'pub fn f(_: u8)' pub fn f(0u8..=255: u8) {} diff --git a/tests/rustdoc/redirect.rs b/tests/rustdoc/redirect.rs index e3a14c7a7..5b7a76e1a 100644 --- a/tests/rustdoc/redirect.rs +++ b/tests/rustdoc/redirect.rs @@ -9,9 +9,10 @@ pub trait Foo {} // @has redirect/index.html // @has - '//code' 'pub use reexp_stripped::Bar' // @has - '//code/a' 'Bar' +// @has - '//a[@href="../reexp_stripped/hidden/struct.Bar.html"]' 'Bar' // @has reexp_stripped/hidden/struct.Bar.html -// @has - '//p/a' '../../reexp_stripped/struct.Bar.html' // @has 'reexp_stripped/struct.Bar.html' +// @has - '//a[@href="struct.Bar.html"]' 'Bar' #[doc(no_inline)] pub use reexp_stripped::Bar; impl Foo for Bar {} diff --git a/tests/rustdoc/reexport-attr-merge.rs b/tests/rustdoc/reexport-attr-merge.rs new file mode 100644 index 000000000..f6c23a136 --- /dev/null +++ b/tests/rustdoc/reexport-attr-merge.rs @@ -0,0 +1,33 @@ +// Regression test for <https://github.com/rust-lang/rust/issues/59368>. +// The goal is to ensure that `doc(hidden)`, `doc(inline)` and `doc(no_inline)` +// are not copied from an item when inlined. + +#![crate_name = "foo"] +#![feature(doc_cfg)] + +// @has 'foo/index.html' + +#[doc(hidden, cfg(feature = "foo"))] +pub struct Foo; + +#[doc(hidden, no_inline, cfg(feature = "bar"))] +pub use Foo as Foo1; + +#[doc(hidden, inline)] +pub use Foo1 as Foo2; + +// First we ensure that only the reexport `Bar2` and the inlined struct `Bar` +// are inlined. +// @count - '//a[@class="struct"]' 2 +// Then we check that both `cfg` are displayed. +// @has - '//*[@class="stab portability"]' 'foo' +// @has - '//*[@class="stab portability"]' 'bar' +// And finally we check that the only element displayed is `Bar`. +// @has - '//a[@class="struct"]' 'Bar' +#[doc(inline)] +pub use Foo2 as Bar; + +// This one should appear but `Bar2` won't be linked because there is no +// `#[doc(inline)]`. +// @has - '//*[@id="reexport.Bar2"]' 'pub use Foo2 as Bar2;' +pub use Foo2 as Bar2; diff --git a/tests/rustdoc/reexport-check.rs b/tests/rustdoc/reexport-check.rs index db1f90c69..5908d2150 100644 --- a/tests/rustdoc/reexport-check.rs +++ b/tests/rustdoc/reexport-check.rs @@ -4,15 +4,17 @@ extern crate reexport_check; // @!has 'foo/index.html' '//code' 'pub use self::i32;' -// @has 'foo/index.html' '//div[@class="item-left deprecated module-item"]' 'i32' // @has 'foo/i32/index.html' #[allow(deprecated, deprecated_in_future)] pub use std::i32; // @!has 'foo/index.html' '//code' 'pub use self::string::String;' -// @has 'foo/index.html' '//div[@class="item-left module-item"]' 'String' +// @has 'foo/index.html' '//div[@class="item-name"]' 'String' pub use std::string::String; -// @has 'foo/index.html' '//div[@class="item-right docblock-short"]' 'Docs in original' +// i32 is deprecated, String is not +// @count 'foo/index.html' '//span[@class="stab deprecated"]' 1 + +// @has 'foo/index.html' '//div[@class="desc docblock-short"]' 'Docs in original' // this is a no-op, but shows what happens if there's an attribute that isn't a doc-comment #[doc(inline)] pub use reexport_check::S; diff --git a/tests/rustdoc/reexport-dep-foreign-fn.rs b/tests/rustdoc/reexport-dep-foreign-fn.rs index 6694c91d1..e7f5720d5 100644 --- a/tests/rustdoc/reexport-dep-foreign-fn.rs +++ b/tests/rustdoc/reexport-dep-foreign-fn.rs @@ -8,5 +8,5 @@ extern crate all_item_types; // @has 'foo/fn.foo_ffn.html' -// @has - '//*[@class="item-decl"]//code' 'pub unsafe extern "C" fn foo_ffn()' +// @has - '//*[@class="rust item-decl"]//code' 'pub unsafe extern "C" fn foo_ffn()' pub use all_item_types::foo_ffn; diff --git a/tests/rustdoc/reexport-hidden-macro.rs b/tests/rustdoc/reexport-hidden-macro.rs new file mode 100644 index 000000000..afcfa9796 --- /dev/null +++ b/tests/rustdoc/reexport-hidden-macro.rs @@ -0,0 +1,22 @@ +// Ensure that inlined reexport of hidden macros is working as expected. +// Part of <https://github.com/rust-lang/rust/issues/59368>. + +#![crate_name = "foo"] + +// @has 'foo/index.html' +// @has - '//*[@id="main-content"]//a[@href="macro.Macro2.html"]' 'Macro2' + +// @has 'foo/macro.Macro2.html' +// @has - '//*[@class="docblock"]' 'Displayed' + +#[macro_export] +#[doc(hidden)] +macro_rules! foo { + () => {}; +} + +/// not displayed +pub use crate::foo as Macro; +/// Displayed +#[doc(inline)] +pub use crate::foo as Macro2; diff --git a/tests/rustdoc/reexport-macro.rs b/tests/rustdoc/reexport-macro.rs new file mode 100644 index 000000000..c4dec703a --- /dev/null +++ b/tests/rustdoc/reexport-macro.rs @@ -0,0 +1,23 @@ +// Ensure that macros are correctly reexported and that they get both the comment from the +// `pub use` and from the macro. + +#![crate_name = "foo"] + +// @has 'foo/macro.foo.html' +// @!has - '//*[@class="toggle top-doc"]/*[@class="docblock"]' 'x y' +// @has - '//*[@class="toggle top-doc"]/*[@class="docblock"]' 'y' +#[macro_use] +mod my_module { + /// y + #[macro_export] + macro_rules! foo { + () => (); + } +} + +// @has 'foo/another_mod/macro.bar.html' +// @has - '//*[@class="toggle top-doc"]/*[@class="docblock"]' 'x y' +pub mod another_mod { + /// x + pub use crate::foo as bar; +} diff --git a/tests/rustdoc/reexports-of-same-name.rs b/tests/rustdoc/reexports-of-same-name.rs new file mode 100644 index 000000000..fe6f1b38c --- /dev/null +++ b/tests/rustdoc/reexports-of-same-name.rs @@ -0,0 +1,26 @@ +// This test ensures that there are 4 imports as expected: +// * 2 for `Foo` +// * 2 for `Bar` + +#![crate_name = "foo"] + +// @has 'foo/index.html' + +pub mod nested { + /// Foo the struct + pub struct Foo {} + + #[allow(non_snake_case)] + /// Foo the function + pub fn Foo() {} +} + +// @count - '//*[@id="main-content"]//code' 'pub use nested::Foo;' 2 +// @has - '//*[@id="reexport.Foo"]//a[@href="nested/struct.Foo.html"]' 'Foo' +// @has - '//*[@id="reexport.Foo-1"]//a[@href="nested/fn.Foo.html"]' 'Foo' +pub use nested::Foo; + +// @count - '//*[@id="main-content"]//code' 'pub use Foo as Bar;' 2 +// @has - '//*[@id="reexport.Bar"]//a[@href="nested/struct.Foo.html"]' 'Foo' +// @has - '//*[@id="reexport.Bar-1"]//a[@href="nested/fn.Foo.html"]' 'Foo' +pub use Foo as Bar; diff --git a/tests/rustdoc/reexports-priv.rs b/tests/rustdoc/reexports-priv.rs index 35c90ba5d..571d7f06f 100644 --- a/tests/rustdoc/reexports-priv.rs +++ b/tests/rustdoc/reexports-priv.rs @@ -5,7 +5,7 @@ extern crate reexports; -// @has 'foo/macro.addr_of.html' '//*[@class="item-decl"]' 'pub macro addr_of($place:expr) {' +// @has 'foo/macro.addr_of.html' '//*[@class="rust 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="item-decl"]' 'pub struct Foo;' +// @has 'foo/struct.Foo.html' '//*[@class="rust 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="item-decl"]' 'pub enum Bar {' +// @has 'foo/enum.Bar.html' '//*[@class="rust item-decl"]' 'pub enum Bar {' pub use reexports::Bar; // @!has 'foo/enum.BarCrate.html' pub(crate) use reexports::BarCrate; @@ -32,7 +32,7 @@ pub(self) use reexports::BarSelf; // @!has 'foo/enum.BarLocal.html' use reexports::BarLocal; -// @has 'foo/fn.foo.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn foo()' +// @has 'foo/fn.foo.html' '//pre[@class="rust item-decl"]' 'pub fn foo()' pub use reexports::foo; // @!has 'foo/fn.foo_crate.html' pub(crate) use reexports::foo_crate; @@ -41,7 +41,7 @@ pub(self) use reexports::foo_self; // @!has 'foo/fn.foo_local.html' use reexports::foo_local; -// @has 'foo/type.Type.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub type Type =' +// @has 'foo/type.Type.html' '//pre[@class="rust item-decl"]' 'pub type Type =' pub use reexports::Type; // @!has 'foo/type.TypeCrate.html' pub(crate) use reexports::TypeCrate; @@ -50,7 +50,7 @@ pub(self) use reexports::TypeSelf; // @!has 'foo/type.TypeLocal.html' use reexports::TypeLocal; -// @has 'foo/union.Union.html' '//*[@class="item-decl"]' 'pub union Union {' +// @has 'foo/union.Union.html' '//*[@class="rust item-decl"]' 'pub union Union {' pub use reexports::Union; // @!has 'foo/union.UnionCrate.html' pub(crate) use reexports::UnionCrate; @@ -61,66 +61,66 @@ use reexports::UnionLocal; pub mod outer { pub mod inner { - // @has 'foo/outer/inner/macro.addr_of.html' '//*[@class="item-decl"]' 'pub macro addr_of($place:expr) {' + // @has 'foo/outer/inner/macro.addr_of.html' '//*[@class="rust item-decl"]' 'pub macro addr_of($place:expr) {' pub use reexports::addr_of; - // @has 'foo/outer/inner/macro.addr_of_crate.html' '//*[@class="item-decl"]' 'pub(crate) macro addr_of_crate($place:expr) {' + // @has 'foo/outer/inner/macro.addr_of_crate.html' '//*[@class="rust 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="item-decl"]' 'pub(in outer) macro addr_of_super($place:expr) {' + // @has 'foo/outer/inner/macro.addr_of_super.html' '//*[@class="rust 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="item-decl"]' 'pub struct Foo;' + // @has 'foo/outer/inner/struct.Foo.html' '//*[@class="rust item-decl"]' 'pub struct Foo;' pub use reexports::Foo; - // @has 'foo/outer/inner/struct.FooCrate.html' '//*[@class="item-decl"]' 'pub(crate) struct FooCrate;' + // @has 'foo/outer/inner/struct.FooCrate.html' '//*[@class="rust item-decl"]' 'pub(crate) struct FooCrate;' pub(crate) use reexports::FooCrate; - // @has 'foo/outer/inner/struct.FooSuper.html' '//*[@class="item-decl"]' 'pub(in outer) struct FooSuper;' + // @has 'foo/outer/inner/struct.FooSuper.html' '//*[@class="rust 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="item-decl"]' 'pub enum Bar {' + // @has 'foo/outer/inner/enum.Bar.html' '//*[@class="rust item-decl"]' 'pub enum Bar {' pub use reexports::Bar; - // @has 'foo/outer/inner/enum.BarCrate.html' '//*[@class="item-decl"]' 'pub(crate) enum BarCrate {' + // @has 'foo/outer/inner/enum.BarCrate.html' '//*[@class="rust item-decl"]' 'pub(crate) enum BarCrate {' pub(crate) use reexports::BarCrate; - // @has 'foo/outer/inner/enum.BarSuper.html' '//*[@class="item-decl"]' 'pub(in outer) enum BarSuper {' + // @has 'foo/outer/inner/enum.BarSuper.html' '//*[@class="rust item-decl"]' 'pub(in outer) enum BarSuper {' pub(super) use reexports::BarSuper; // @!has 'foo/outer/inner/enum.BarSelf.html' pub(self) use reexports::BarSelf; // @!has 'foo/outer/inner/enum.BarLocal.html' use reexports::BarLocal; - // @has 'foo/outer/inner/fn.foo.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn foo()' + // @has 'foo/outer/inner/fn.foo.html' '//pre[@class="rust item-decl"]' 'pub fn foo()' pub use reexports::foo; - // @has 'foo/outer/inner/fn.foo_crate.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub(crate) fn foo_crate()' + // @has 'foo/outer/inner/fn.foo_crate.html' '//pre[@class="rust item-decl"]' 'pub(crate) fn foo_crate()' pub(crate) use reexports::foo_crate; - // @has 'foo/outer/inner/fn.foo_super.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub(in outer) fn foo_super()' + // @has 'foo/outer/inner/fn.foo_super.html' '//pre[@class="rust item-decl"]' 'pub(in outer) fn foo_super( )' pub(super) use::reexports::foo_super; // @!has 'foo/outer/inner/fn.foo_self.html' pub(self) use reexports::foo_self; // @!has 'foo/outer/inner/fn.foo_local.html' use reexports::foo_local; - // @has 'foo/outer/inner/type.Type.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub type Type =' + // @has 'foo/outer/inner/type.Type.html' '//pre[@class="rust item-decl"]' 'pub type Type =' pub use reexports::Type; - // @has 'foo/outer/inner/type.TypeCrate.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub(crate) type TypeCrate =' + // @has 'foo/outer/inner/type.TypeCrate.html' '//pre[@class="rust item-decl"]' 'pub(crate) type TypeCrate =' pub(crate) use reexports::TypeCrate; - // @has 'foo/outer/inner/type.TypeSuper.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub(in outer) type TypeSuper =' + // @has 'foo/outer/inner/type.TypeSuper.html' '//pre[@class="rust item-decl"]' 'pub(in outer) type TypeSuper =' pub(super) use reexports::TypeSuper; // @!has 'foo/outer/inner/type.TypeSelf.html' pub(self) use reexports::TypeSelf; // @!has 'foo/outer/inner/type.TypeLocal.html' use reexports::TypeLocal; - // @has 'foo/outer/inner/union.Union.html' '//*[@class="item-decl"]' 'pub union Union {' + // @has 'foo/outer/inner/union.Union.html' '//*[@class="rust item-decl"]' 'pub union Union {' pub use reexports::Union; - // @has 'foo/outer/inner/union.UnionCrate.html' '//*[@class="item-decl"]' 'pub(crate) union UnionCrate {' + // @has 'foo/outer/inner/union.UnionCrate.html' '//*[@class="rust item-decl"]' 'pub(crate) union UnionCrate {' pub(crate) use reexports::UnionCrate; - // @has 'foo/outer/inner/union.UnionSuper.html' '//*[@class="item-decl"]' 'pub(in outer) union UnionSuper {' + // @has 'foo/outer/inner/union.UnionSuper.html' '//*[@class="rust 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/tests/rustdoc/reexports.rs b/tests/rustdoc/reexports.rs index 65d305c6d..3c51ac395 100644 --- a/tests/rustdoc/reexports.rs +++ b/tests/rustdoc/reexports.rs @@ -4,7 +4,7 @@ extern crate reexports; -// @has 'foo/macro.addr_of.html' '//*[@class="item-decl"]' 'pub macro addr_of($place:expr) {' +// @has 'foo/macro.addr_of.html' '//*[@class="rust 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="item-decl"]' 'pub struct Foo;' +// @has 'foo/struct.Foo.html' '//*[@class="rust 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="item-decl"]' 'pub enum Bar {' +// @has 'foo/enum.Bar.html' '//*[@class="rust item-decl"]' 'pub enum Bar {' pub use reexports::Bar; // @!has 'foo/enum.BarCrate.html' pub(crate) use reexports::BarCrate; @@ -31,7 +31,7 @@ pub(self) use reexports::BarSelf; // @!has 'foo/enum.BarLocal.html' use reexports::BarLocal; -// @has 'foo/fn.foo.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn foo()' +// @has 'foo/fn.foo.html' '//pre[@class="rust item-decl"]' 'pub fn foo()' pub use reexports::foo; // @!has 'foo/fn.foo_crate.html' pub(crate) use reexports::foo_crate; @@ -40,7 +40,7 @@ pub(self) use reexports::foo_self; // @!has 'foo/fn.foo_local.html' use reexports::foo_local; -// @has 'foo/type.Type.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub type Type =' +// @has 'foo/type.Type.html' '//pre[@class="rust item-decl"]' 'pub type Type =' pub use reexports::Type; // @!has 'foo/type.TypeCrate.html' pub(crate) use reexports::TypeCrate; @@ -49,7 +49,7 @@ pub(self) use reexports::TypeSelf; // @!has 'foo/type.TypeLocal.html' use reexports::TypeLocal; -// @has 'foo/union.Union.html' '//*[@class="item-decl"]' 'pub union Union {' +// @has 'foo/union.Union.html' '//*[@class="rust 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="item-decl"]' 'pub macro addr_of($place:expr) {' + // @has 'foo/outer/inner/macro.addr_of.html' '//*[@class="rust 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="item-decl"]' 'pub struct Foo;' + // @has 'foo/outer/inner/struct.Foo.html' '//*[@class="rust 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="item-decl"]' 'pub enum Bar {' + // @has 'foo/outer/inner/enum.Bar.html' '//*[@class="rust item-decl"]' 'pub enum Bar {' pub use reexports::Bar; // @!has 'foo/outer/inner/enum.BarCrate.html' pub(crate) use reexports::BarCrate; @@ -93,7 +93,7 @@ pub mod outer { // @!has 'foo/outer/inner/enum.BarLocal.html' use reexports::BarLocal; - // @has 'foo/outer/inner/fn.foo.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn foo()' + // @has 'foo/outer/inner/fn.foo.html' '//pre[@class="rust item-decl"]' 'pub fn foo()' pub use reexports::foo; // @!has 'foo/outer/inner/fn.foo_crate.html' pub(crate) use reexports::foo_crate; @@ -104,7 +104,7 @@ pub mod outer { // @!has 'foo/outer/inner/fn.foo_local.html' use reexports::foo_local; - // @has 'foo/outer/inner/type.Type.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub type Type =' + // @has 'foo/outer/inner/type.Type.html' '//pre[@class="rust item-decl"]' 'pub type Type =' pub use reexports::Type; // @!has 'foo/outer/inner/type.TypeCrate.html' pub(crate) use reexports::TypeCrate; @@ -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="item-decl"]' 'pub union Union {' + // @has 'foo/outer/inner/union.Union.html' '//*[@class="rust item-decl"]' 'pub union Union {' pub use reexports::Union; // @!has 'foo/outer/inner/union.UnionCrate.html' pub(crate) use reexports::UnionCrate; diff --git a/tests/rustdoc/rfc-2632-const-trait-impl.rs b/tests/rustdoc/rfc-2632-const-trait-impl.rs index a229a4e29..1120302ac 100644 --- a/tests/rustdoc/rfc-2632-const-trait-impl.rs +++ b/tests/rustdoc/rfc-2632-const-trait-impl.rs @@ -12,10 +12,10 @@ use std::marker::Destruct; pub struct S<T>(T); -// @!has foo/trait.Tr.html '//div[@class="item-decl"]/pre[@class="rust"]/code/a[@class="trait"]' '~const' -// @has - '//div[@class="item-decl"]/pre[@class="rust"]/code/a[@class="trait"]' 'Clone' -// @!has - '//div[@class="item-decl"]/pre[@class="rust"]/code/span[@class="where"]' '~const' -// @has - '//div[@class="item-decl"]/pre[@class="rust"]/code/span[@class="where"]' ': Clone' +// @!has foo/trait.Tr.html '//pre[@class="rust item-decl"]/code/a[@class="trait"]' '~const' +// @has - '//pre[@class="rust item-decl"]/code/a[@class="trait"]' 'Clone' +// @!has - '//pre[@class="rust item-decl"]/code/span[@class="where"]' '~const' +// @has - '//pre[@class="rust item-decl"]/code/span[@class="where"]' ': Clone' #[const_trait] pub trait Tr<T> { // @!has - '//section[@id="method.a"]/h4[@class="code-header"]' '~const' @@ -45,10 +45,10 @@ where } } -// @!has foo/fn.foo.html '//div[@class="item-decl"]/pre[@class="rust"]/code/a[@class="trait"]' '~const' -// @has - '//div[@class="item-decl"]/pre[@class="rust"]/code/a[@class="trait"]' 'Clone' -// @!has - '//div[@class="item-decl"]/pre[@class="rust"]/code/span[@class="where fmt-newline"]' '~const' -// @has - '//div[@class="item-decl"]/pre[@class="rust"]/code/span[@class="where fmt-newline"]' ': Clone' +// @!has foo/fn.foo.html '//pre[@class="rust item-decl"]/code/a[@class="trait"]' '~const' +// @has - '//pre[@class="rust item-decl"]/code/a[@class="trait"]' 'Clone' +// @!has - '//pre[@class="rust item-decl"]/code/span[@class="where fmt-newline"]' '~const' +// @has - '//pre[@class="rust item-decl"]/code/span[@class="where fmt-newline"]' ': Clone' pub const fn foo<F: ~const Clone + ~const Destruct>() where Option<F>: ~const Clone + ~const Destruct, diff --git a/tests/rustdoc/safe-intrinsic.rs b/tests/rustdoc/safe-intrinsic.rs index 0b65bf1df..c508909f9 100644 --- a/tests/rustdoc/safe-intrinsic.rs +++ b/tests/rustdoc/safe-intrinsic.rs @@ -7,16 +7,16 @@ extern "rust-intrinsic" { // @has 'foo/fn.abort.html' - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub extern "rust-intrinsic" fn abort() -> !' + // @has - '//pre[@class="rust item-decl"]' 'pub extern "rust-intrinsic" fn abort() -> !' #[rustc_safe_intrinsic] pub fn abort() -> !; // @has 'foo/fn.unreachable.html' - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub unsafe extern "rust-intrinsic" fn unreachable() -> !' + // @has - '//pre[@class="rust item-decl"]' 'pub unsafe extern "rust-intrinsic" fn unreachable() -> !' pub fn unreachable() -> !; } extern "C" { // @has 'foo/fn.needs_drop.html' - // @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub unsafe extern "C" fn needs_drop() -> !' + // @has - '//pre[@class="rust item-decl"]' 'pub unsafe extern "C" fn needs_drop() -> !' pub fn needs_drop() -> !; } diff --git a/tests/rustdoc/short-docblock-codeblock.rs b/tests/rustdoc/short-docblock-codeblock.rs index 3c5fa7b36..7ecd80b8c 100644 --- a/tests/rustdoc/short-docblock-codeblock.rs +++ b/tests/rustdoc/short-docblock-codeblock.rs @@ -1,6 +1,6 @@ #![crate_name = "foo"] -// @count foo/index.html '//*[@class="item-right docblock-short"]' 0 +// @count foo/index.html '//*[@class="desc docblock-short"]' 0 /// ``` /// let x = 12; diff --git a/tests/rustdoc/short-docblock.rs b/tests/rustdoc/short-docblock.rs index 1a8a689be..791d3547c 100644 --- a/tests/rustdoc/short-docblock.rs +++ b/tests/rustdoc/short-docblock.rs @@ -1,7 +1,7 @@ #![crate_name = "foo"] -// @has foo/index.html '//*[@class="item-right docblock-short"]' 'fooo' -// @!has foo/index.html '//*[@class="item-right docblock-short"]/h1' 'fooo' +// @has foo/index.html '//*[@class="desc docblock-short"]' 'fooo' +// @!has foo/index.html '//*[@class="desc 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"]' 'mooood' -// @!has foo/index.html '//*[@class="item-right docblock-short"]/h2' 'mooood' +// @has foo/index.html '//*[@class="desc docblock-short"]' 'mooood' +// @!has foo/index.html '//*[@class="desc 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"]/a[@href=\ +// @has foo/index.html '//*[@class="desc docblock-short"]/a[@href=\ // "https://nougat.world"]/code' 'nougat' /// [`nougat`](https://nougat.world) diff --git a/tests/rustdoc/sidebar-links-to-foreign-impl.rs b/tests/rustdoc/sidebar-links-to-foreign-impl.rs index 11e946948..caa17dfbb 100644 --- a/tests/rustdoc/sidebar-links-to-foreign-impl.rs +++ b/tests/rustdoc/sidebar-links-to-foreign-impl.rs @@ -7,8 +7,8 @@ // @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"]' '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"]' "impl<'a> Foo for &'a str" +// @has - "//*[@class=\"sidebar-elems\"]//section//a[@href=\"#impl-Foo-for-%26'a+str\"]" "&'a str" +// @has - "//*[@id=\"impl-Foo-for-%26'a+str\"]//h3[@class=\"code-header\"]" "impl<'a> Foo for &'a str" pub trait Foo {} impl Foo for u32 {} diff --git a/tests/rustdoc/slice-links.rs b/tests/rustdoc/slice-links.rs index 67137fdca..6dea3b74e 100644 --- a/tests/rustdoc/slice-links.rs +++ b/tests/rustdoc/slice-links.rs @@ -4,25 +4,25 @@ pub struct MyBox<T: ?Sized>(*const T); // @has 'foo/fn.alpha.html' -// @snapshot link_slice_u32 - '//div[@class="item-decl"]/pre[@class="rust"]/code' +// @snapshot link_slice_u32 - '//pre[@class="rust item-decl"]/code' pub fn alpha() -> &'static [u32] { loop {} } // @has 'foo/fn.beta.html' -// @snapshot link_slice_generic - '//div[@class="item-decl"]/pre[@class="rust"]/code' +// @snapshot link_slice_generic - '//pre[@class="rust item-decl"]/code' pub fn beta<T>() -> &'static [T] { loop {} } // @has 'foo/fn.gamma.html' -// @snapshot link_box_u32 - '//div[@class="item-decl"]/pre[@class="rust"]/code' +// @snapshot link_box_u32 - '//pre[@class="rust item-decl"]/code' pub fn gamma() -> MyBox<[u32]> { loop {} } // @has 'foo/fn.delta.html' -// @snapshot link_box_generic - '//div[@class="item-decl"]/pre[@class="rust"]/code' +// @snapshot link_box_generic - '//pre[@class="rust item-decl"]/code' pub fn delta<T>() -> MyBox<[T]> { loop {} } diff --git a/tests/rustdoc/spotlight-from-dependency.rs b/tests/rustdoc/spotlight-from-dependency.rs index 090ad187d..426759c7b 100644 --- a/tests/rustdoc/spotlight-from-dependency.rs +++ b/tests/rustdoc/spotlight-from-dependency.rs @@ -3,7 +3,7 @@ use std::iter::Iterator; // @has foo/struct.Odd.html -// @has - '//*[@id="method.new"]//a[@class="notable-traits"]/@data-ty' 'Odd' +// @has - '//*[@id="method.new"]//a[@class="tooltip"]/@data-notable-ty' 'Odd' // @snapshot odd - '//script[@id="notable-traits-data"]' pub struct Odd { current: usize, diff --git a/tests/rustdoc/struct-arg-pattern.rs b/tests/rustdoc/struct-arg-pattern.rs index 3bfb43a0b..6f06c8c9c 100644 --- a/tests/rustdoc/struct-arg-pattern.rs +++ b/tests/rustdoc/struct-arg-pattern.rs @@ -4,7 +4,7 @@ struct BodyId { hir_id: usize, } -// @has 'foo/fn.body_owner.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn body_owner(_: BodyId)' +// @has 'foo/fn.body_owner.html' '//pre[@class="rust item-decl"]' 'pub fn body_owner(_: BodyId)' pub fn body_owner(BodyId { hir_id }: BodyId) { // ... } diff --git a/tests/rustdoc/synthetic_auto/basic.rs b/tests/rustdoc/synthetic_auto/basic.rs index 7c6a38865..043ac2414 100644 --- a/tests/rustdoc/synthetic_auto/basic.rs +++ b/tests/rustdoc/synthetic_auto/basic.rs @@ -1,8 +1,8 @@ // @has basic/struct.Foo.html // @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 +// @count - '//*[@id="implementations-list"]//*[@class="impl"]' 0 +// @count - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]' 5 pub struct Foo<T> { field: T, } diff --git a/tests/rustdoc/synthetic_auto/complex.rs b/tests/rustdoc/synthetic_auto/complex.rs index 43393c21f..4c39f0bf1 100644 --- a/tests/rustdoc/synthetic_auto/complex.rs +++ b/tests/rustdoc/synthetic_auto/complex.rs @@ -20,7 +20,7 @@ mod foo { } // @has complex/struct.NotOuter.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//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" diff --git a/tests/rustdoc/synthetic_auto/lifetimes.rs b/tests/rustdoc/synthetic_auto/lifetimes.rs index 33170a844..71265b307 100644 --- a/tests/rustdoc/synthetic_auto/lifetimes.rs +++ b/tests/rustdoc/synthetic_auto/lifetimes.rs @@ -9,10 +9,10 @@ where {} // @has lifetimes/struct.Foo.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//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"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//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/tests/rustdoc/synthetic_auto/manual.rs b/tests/rustdoc/synthetic_auto/manual.rs index 77c04ad2a..7fc8447df 100644 --- a/tests/rustdoc/synthetic_auto/manual.rs +++ b/tests/rustdoc/synthetic_auto/manual.rs @@ -1,12 +1,12 @@ // @has manual/struct.Foo.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//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"]' \ +// @has - '//*[@id="trait-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ // 'impl<T> Send for Foo<T>' // -// @count - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]' 1 -// @count - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]' 4 +// @count - '//*[@id="trait-implementations-list"]//*[@class="impl"]' 1 +// @count - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]' 4 pub struct Foo<T> { field: T, } diff --git a/tests/rustdoc/synthetic_auto/negative.rs b/tests/rustdoc/synthetic_auto/negative.rs index 2c2c848a5..97da2d574 100644 --- a/tests/rustdoc/synthetic_auto/negative.rs +++ b/tests/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"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ // "impl<T> !Send for Outer<T>" // -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ // "impl<T> !Sync for Outer<T>" pub struct Outer<T: Copy> { inner_field: Inner<T>, diff --git a/tests/rustdoc/synthetic_auto/nested.rs b/tests/rustdoc/synthetic_auto/nested.rs index 423bf115a..e4aead71b 100644 --- a/tests/rustdoc/synthetic_auto/nested.rs +++ b/tests/rustdoc/synthetic_auto/nested.rs @@ -9,10 +9,10 @@ where } // @has nested/struct.Foo.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//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"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ // 'impl<T> Sync for Foo<T>where T: Sync' pub struct Foo<T> { inner_field: Inner<T>, diff --git a/tests/rustdoc/synthetic_auto/no-redundancy.rs b/tests/rustdoc/synthetic_auto/no-redundancy.rs index 59f336233..ea57d7388 100644 --- a/tests/rustdoc/synthetic_auto/no-redundancy.rs +++ b/tests/rustdoc/synthetic_auto/no-redundancy.rs @@ -9,7 +9,7 @@ where } // @has no_redundancy/struct.Outer.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//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/tests/rustdoc/synthetic_auto/project.rs b/tests/rustdoc/synthetic_auto/project.rs index 558ff2add..7c9412ae9 100644 --- a/tests/rustdoc/synthetic_auto/project.rs +++ b/tests/rustdoc/synthetic_auto/project.rs @@ -23,10 +23,10 @@ where } // @has project/struct.Foo.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//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"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//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> { diff --git a/tests/rustdoc/synthetic_auto/self-referential.rs b/tests/rustdoc/synthetic_auto/self-referential.rs index c6ae96de7..145a2b7e0 100644 --- a/tests/rustdoc/synthetic_auto/self-referential.rs +++ b/tests/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"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//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/tests/rustdoc/synthetic_auto/static-region.rs b/tests/rustdoc/synthetic_auto/static-region.rs index 1a76cb919..9dc6211ec 100644 --- a/tests/rustdoc/synthetic_auto/static-region.rs +++ b/tests/rustdoc/synthetic_auto/static-region.rs @@ -3,7 +3,7 @@ pub trait OwnedTrait<'a> { } // @has static_region/struct.Owned.html -// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//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/tests/rustdoc/test-parens.rs b/tests/rustdoc/test-parens.rs index f5fdb1f52..9640b96b6 100644 --- a/tests/rustdoc/test-parens.rs +++ b/tests/rustdoc/test-parens.rs @@ -1,5 +1,5 @@ #![crate_name = "foo"] // @has foo/fn.foo.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' "_: &(dyn ToString + 'static)" +// @has - '//pre[@class="rust item-decl"]' "_: &(dyn ToString + 'static)" pub fn foo(_: &(ToString + 'static)) {} diff --git a/tests/rustdoc/toggle-item-contents.rs b/tests/rustdoc/toggle-item-contents.rs index 5d34ec09b..1f7450438 100644 --- a/tests/rustdoc/toggle-item-contents.rs +++ b/tests/rustdoc/toggle-item-contents.rs @@ -55,7 +55,7 @@ pub union Union { // @has 'toggle_item_contents/struct.PrivStruct.html' // @count - '//details[@class="toggle type-contents-toggle"]' 0 -// @has - '//div[@class="item-decl"]' '/* private fields */' +// @has - '//pre[@class="rust item-decl"]' '/* private fields */' pub struct PrivStruct { a: usize, b: usize, @@ -81,8 +81,8 @@ pub enum EnumStructVariant { } // @has 'toggle_item_contents/enum.LargeEnum.html' -// @count - '//div[@class="item-decl"]/pre//details[@class="toggle type-contents-toggle"]' 1 -// @has - '//div[@class="item-decl"]/pre//details[@class="toggle type-contents-toggle"]' 'Show 13 variants' +// @count - '//pre[@class="rust item-decl"]//details[@class="toggle type-contents-toggle"]' 1 +// @has - '//pre[@class="rust item-decl"]//details[@class="toggle type-contents-toggle"]' 'Show 13 variants' pub enum LargeEnum { A, B, C, D, E, F(u8), G, H, I, J, K, L, M } diff --git a/tests/rustdoc/trait_alias.rs b/tests/rustdoc/trait_alias.rs index 791c099cc..5c3f82c6b 100644 --- a/tests/rustdoc/trait_alias.rs +++ b/tests/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="item-decl"]/pre' 'trait CopyAlias = Copy;' +// @has - '//section[@id="main-content"]/pre[@class="rust item-decl"]' 'trait CopyAlias = Copy;' pub trait CopyAlias = Copy; // @has foo/traitalias.Alias2.html -// @has - '//section[@id="main-content"]/div[@class="item-decl"]/pre' 'trait Alias2 = Copy + Debug;' +// @has - '//section[@id="main-content"]/pre[@class="rust item-decl"]' 'trait Alias2 = Copy + Debug;' pub trait Alias2 = Copy + Debug; // @has foo/traitalias.Foo.html -// @has - '//section[@id="main-content"]/div[@class="item-decl"]/pre' 'trait Foo<T> = Into<T> + Debug;' +// @has - '//section[@id="main-content"]/pre[@class="rust item-decl"]' '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/tests/rustdoc/tuple-struct-fields-doc.rs b/tests/rustdoc/tuple-struct-fields-doc.rs index d72c10f2b..2836ddedc 100644 --- a/tests/rustdoc/tuple-struct-fields-doc.rs +++ b/tests/rustdoc/tuple-struct-fields-doc.rs @@ -19,7 +19,7 @@ pub struct Foo( ); // @has foo/enum.Bar.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'BarVariant(String),' +// @has - '//pre[@class="rust item-decl"]' 'BarVariant(String),' // @matches - '//*[@id="variant.BarVariant.fields"]/h4' '^Tuple Fields$' // @has - '//*[@id="variant.BarVariant.field.0"]' '0: String' // @has - '//*[@id="variant.BarVariant.fields"]//*[@class="docblock"]' 'Hello docs' diff --git a/tests/rustdoc/tuples.rs b/tests/rustdoc/tuples.rs index e716de8b5..0ea5b5bfa 100644 --- a/tests/rustdoc/tuples.rs +++ b/tests/rustdoc/tuples.rs @@ -1,20 +1,20 @@ #![crate_name = "foo"] // @has foo/fn.tuple0.html //pre 'pub fn tuple0(x: ())' -// @snapshot link_unit - '//div[@class="item-decl"]/pre[@class="rust"]/code' +// @snapshot link_unit - '//pre[@class="rust item-decl"]/code' pub fn tuple0(x: ()) -> () { x } // @has foo/fn.tuple1.html //pre 'pub fn tuple1(x: (i32,)) -> (i32,)' -// @snapshot link1_i32 - '//div[@class="item-decl"]/pre[@class="rust"]/code' +// @snapshot link1_i32 - '//pre[@class="rust item-decl"]/code' pub fn tuple1(x: (i32,)) -> (i32,) { x } // @has foo/fn.tuple2.html //pre 'pub fn tuple2(x: (i32, i32)) -> (i32, i32)' -// @snapshot link2_i32 - '//div[@class="item-decl"]/pre[@class="rust"]/code' +// @snapshot link2_i32 - '//pre[@class="rust item-decl"]/code' pub fn tuple2(x: (i32, i32)) -> (i32, i32) { x } // @has foo/fn.tuple1_t.html //pre 'pub fn tuple1_t<T>(x: (T,)) -> (T,)' -// @snapshot link1_t - '//div[@class="item-decl"]/pre[@class="rust"]/code' +// @snapshot link1_t - '//pre[@class="rust item-decl"]/code' pub fn tuple1_t<T>(x: (T,)) -> (T,) { x } // @has foo/fn.tuple2_t.html //pre 'pub fn tuple2_t<T>(x: (T, T)) -> (T, T)' -// @snapshot link2_t - '//div[@class="item-decl"]/pre[@class="rust"]/code' +// @snapshot link2_t - '//pre[@class="rust item-decl"]/code' pub fn tuple2_t<T>(x: (T, T)) -> (T, T) { x } // @has foo/fn.tuple2_tu.html //pre 'pub fn tuple2_tu<T, U>(x: (T, U)) -> (T, U)' -// @snapshot link2_tu - '//div[@class="item-decl"]/pre[@class="rust"]/code' +// @snapshot link2_tu - '//pre[@class="rust item-decl"]/code' pub fn tuple2_tu<T, U>(x: (T, U)) -> (T, U) { x } diff --git a/tests/rustdoc/typedef.rs b/tests/rustdoc/typedef.rs index d5dfa9484..63e2973c7 100644 --- a/tests/rustdoc/typedef.rs +++ b/tests/rustdoc/typedef.rs @@ -9,8 +9,8 @@ impl MyStruct { } // @has typedef/type.MyAlias.html -// @has - '//*[@class="impl has-srclink"]//h3[@class="code-header"]' 'impl MyAlias' -// @has - '//*[@class="impl has-srclink"]//h3[@class="code-header"]' 'impl MyTrait for MyAlias' +// @has - '//*[@class="impl"]//h3[@class="code-header"]' 'impl MyAlias' +// @has - '//*[@class="impl"]//h3[@class="code-header"]' 'impl MyTrait for MyAlias' // @hasraw - 'Alias docstring' // @has - '//*[@class="sidebar"]//*[@class="location"]' 'MyAlias' // @has - '//*[@class="sidebar"]//a[@href="#implementations"]' 'Methods' diff --git a/tests/rustdoc/unit-return.rs b/tests/rustdoc/unit-return.rs index 353cd1c47..6ddfa0c4d 100644 --- a/tests/rustdoc/unit-return.rs +++ b/tests/rustdoc/unit-return.rs @@ -4,14 +4,14 @@ extern crate unit_return; -// @has 'foo/fn.f0.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'F: FnMut(u8) + Clone' +// @has 'foo/fn.f0.html' '//pre[@class="rust item-decl"]' 'F: FnMut(u8) + Clone' pub fn f0<F: FnMut(u8) + Clone>(f: F) {} -// @has 'foo/fn.f1.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'F: FnMut(u16) + Clone' +// @has 'foo/fn.f1.html' '//pre[@class="rust item-decl"]' 'F: FnMut(u16) + Clone' pub fn f1<F: FnMut(u16) -> () + Clone>(f: F) {} -// @has 'foo/fn.f2.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'F: FnMut(u32) + Clone' +// @has 'foo/fn.f2.html' '//pre[@class="rust item-decl"]' 'F: FnMut(u32) + Clone' pub use unit_return::f2; -// @has 'foo/fn.f3.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'F: FnMut(u64) + Clone' +// @has 'foo/fn.f3.html' '//pre[@class="rust item-decl"]' 'F: FnMut(u64) + Clone' pub use unit_return::f3; diff --git a/tests/rustdoc/where-clause-order.rs b/tests/rustdoc/where-clause-order.rs index b8502e10a..b10f8f685 100644 --- a/tests/rustdoc/where-clause-order.rs +++ b/tests/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,+B,+C,+D,+E)%3E-for-(A,+B,+C,+D,+E)']/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/tests/rustdoc/where-sized.rs b/tests/rustdoc/where-sized.rs index c0c085e6a..c1ac834b2 100644 --- a/tests/rustdoc/where-sized.rs +++ b/tests/rustdoc/where-sized.rs @@ -1,6 +1,6 @@ #![crate_name = "foo"] // @has foo/fn.foo.html -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn foo<X, Y: ?Sized>(_: &X)' -// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'where X: ?Sized,' +// @has - '//pre[@class="rust item-decl"]' 'pub fn foo<X, Y: ?Sized>(_: &X)' +// @has - '//pre[@class="rust item-decl"]' 'where X: ?Sized,' pub fn foo<X, Y: ?Sized>(_: &X) where X: ?Sized {} diff --git a/tests/rustdoc/where.SWhere_Simd_item-decl.html b/tests/rustdoc/where.SWhere_Simd_item-decl.html index f84cb3753..ef4294c8f 100644 --- a/tests/rustdoc/where.SWhere_Simd_item-decl.html +++ b/tests/rustdoc/where.SWhere_Simd_item-decl.html @@ -1 +1,3 @@ -<div class="item-decl"><pre class="rust"><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 +<pre class="rust item-decl"><code>pub struct Simd<T>(_) +<span class="where">where + T: <a class="trait" href="trait.MyTrait.html" title="trait foo::MyTrait">MyTrait</a></span>;</code></pre>
\ No newline at end of file diff --git a/tests/rustdoc/where.SWhere_TraitWhere_item-decl.html b/tests/rustdoc/where.SWhere_TraitWhere_item-decl.html index 85b626674..e8ab061e6 100644 --- a/tests/rustdoc/where.SWhere_TraitWhere_item-decl.html +++ b/tests/rustdoc/where.SWhere_TraitWhere_item-decl.html @@ -1,8 +1,13 @@ -<div class="item-decl"><pre class="rust"><code>pub trait TraitWhere { - type <a href="#associatedtype.Item" class="associatedtype">Item</a><'a><br />    <span class="where">where<br />        Self: 'a</span>; +<pre class="rust item-decl"><code>pub trait TraitWhere { + type <a href="#associatedtype.Item" class="associatedtype">Item</a><'a> + <span class="where">where Self: 'a</span>; - fn <a href="#method.func" class="fn">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="fn">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 + // Provided methods + fn <a href="#method.func" class="fn">func</a>(self) + <span class="where">where 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="fn">lines</a>(self) -> <a class="struct" href="{{channel}}/std/io/struct.Lines.html" title="struct std::io::Lines">Lines</a><Self> + <span class="where">where 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.merge" class="fn">merge</a><T>(self, a: T) + <span class="where">where Self: <a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, + T: <a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... } +}</code></pre>
\ No newline at end of file diff --git a/tests/rustdoc/where.rs b/tests/rustdoc/where.rs index 3ac0c6872..8b8a126e8 100644 --- a/tests/rustdoc/where.rs +++ b/tests/rustdoc/where.rs @@ -4,7 +4,7 @@ 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" pub trait Bravo<B> where B: MyTrait { fn get(&self, B: B); } @@ -13,7 +13,7 @@ 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"]' \ +// @has foo/struct.Delta.html '//*[@class="impl"]//h3[@class="code-header"]' \ // "impl<D> Delta<D>where D: MyTrait" impl<D> Delta<D> where D: MyTrait { pub fn delta() {} @@ -22,13 +22,13 @@ impl<D> Delta<D> where D: MyTrait { pub struct Echo<E>(E); // @has 'foo/struct.Simd.html' -// @snapshot SWhere_Simd_item-decl - '//div[@class="item-decl"]' +// @snapshot SWhere_Simd_item-decl - '//pre[@class="rust item-decl"]' pub struct Simd<T>([T; 1]) where T: MyTrait; // @has 'foo/trait.TraitWhere.html' -// @snapshot SWhere_TraitWhere_item-decl - '//div[@class="item-decl"]' +// @snapshot SWhere_TraitWhere_item-decl - '//pre[@class="rust item-decl"]' pub trait TraitWhere { type Item<'a> where Self: 'a; @@ -41,9 +41,15 @@ pub trait TraitWhere { where Self: Sized, { todo!() } + + fn merge<T>(self, a: T) + where + Self: Sized, + T: Sized, + { todo!() } } -// @has foo/struct.Echo.html '//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ +// @has foo/struct.Echo.html '//*[@class="impl"]//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" @@ -51,12 +57,12 @@ 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"]' \ +// @has foo/enum.Foxtrot.html '//*[@class="impl"]//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 '//div[@class="item-decl"]/pre[@class="rust"]' \ +// @has foo/type.Golf.html '//pre[@class="rust item-decl"]' \ // "type Golf<T>where T: Clone, = (T, T)" pub type Golf<T> where T: Clone = (T, T); diff --git a/tests/rustdoc/whitespace-after-where-clause.enum.html b/tests/rustdoc/whitespace-after-where-clause.enum.html index 20bde549a..20b60b68e 100644 --- a/tests/rustdoc/whitespace-after-where-clause.enum.html +++ b/tests/rustdoc/whitespace-after-where-clause.enum.html @@ -1,4 +1,5 @@ -<div class="item-decl"><pre class="rust"><code>pub enum Cow<'a, B><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>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ - Borrowed(<a class="primitive" href="{{channel}}/std/primitive.reference.html">&'a </a>B), +<pre class="rust item-decl"><code>pub enum Cow<'a, B><span class="where fmt-newline">where + 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>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ + Borrowed(<a class="primitive" href="{{channel}}/std/primitive.reference.html">&'a B</a>), Whatever(<a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>), -}</code></pre></div>
\ No newline at end of file +}</code></pre>
\ No newline at end of file diff --git a/tests/rustdoc/whitespace-after-where-clause.enum2.html b/tests/rustdoc/whitespace-after-where-clause.enum2.html index d9fc0c223..065ce757d 100644 --- a/tests/rustdoc/whitespace-after-where-clause.enum2.html +++ b/tests/rustdoc/whitespace-after-where-clause.enum2.html @@ -1,4 +1,4 @@ -<div class="item-decl"><pre class="rust"><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), +<pre class="rust item-decl"><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 B</a>), Whatever(<a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>), -}</code></pre></div>
\ No newline at end of file +}</code></pre>
\ No newline at end of file diff --git a/tests/rustdoc/whitespace-after-where-clause.rs b/tests/rustdoc/whitespace-after-where-clause.rs index 4b740b970..b540c7c97 100644 --- a/tests/rustdoc/whitespace-after-where-clause.rs +++ b/tests/rustdoc/whitespace-after-where-clause.rs @@ -4,7 +4,7 @@ #![crate_name = "foo"] // @has 'foo/trait.ToOwned.html' -// @snapshot trait - '//*[@class="item-decl"]' +// @snapshot trait - '//*[@class="rust item-decl"]' pub trait ToOwned<T> where T: Clone { @@ -14,7 +14,7 @@ where T: Clone } // @has 'foo/trait.ToOwned2.html' -// @snapshot trait2 - '//*[@class="item-decl"]' +// @snapshot trait2 - '//*[@class="rust 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="item-decl"]' +// @snapshot enum - '//*[@class="rust 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="item-decl"]' +// @snapshot enum2 - '//*[@class="rust 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="item-decl"]' +// @snapshot struct - '//*[@class="rust 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="item-decl"]' +// @snapshot struct2 - '//*[@class="rust 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="item-decl"]' +// @snapshot union - '//*[@class="rust 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="item-decl"]' +// @snapshot union2 - '//*[@class="rust 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/tests/rustdoc/whitespace-after-where-clause.struct.html b/tests/rustdoc/whitespace-after-where-clause.struct.html index f375265d7..948ddc499 100644 --- a/tests/rustdoc/whitespace-after-where-clause.struct.html +++ b/tests/rustdoc/whitespace-after-where-clause.struct.html @@ -1,4 +1,5 @@ -<div class="item-decl"><pre class="rust"><code>pub struct Struct<'a, B><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>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ - pub a: <a class="primitive" href="{{channel}}/std/primitive.reference.html">&'a </a>B, +<pre class="rust item-decl"><code>pub struct Struct<'a, B><span class="where fmt-newline">where + 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>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ + pub a: <a class="primitive" href="{{channel}}/std/primitive.reference.html">&'a B</a>, pub b: <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>, -}</code></pre></div>
\ No newline at end of file +}</code></pre>
\ No newline at end of file diff --git a/tests/rustdoc/whitespace-after-where-clause.struct2.html b/tests/rustdoc/whitespace-after-where-clause.struct2.html index 1c59962eb..c647e8d71 100644 --- a/tests/rustdoc/whitespace-after-where-clause.struct2.html +++ b/tests/rustdoc/whitespace-after-where-clause.struct2.html @@ -1,4 +1,4 @@ -<div class="item-decl"><pre class="rust"><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, +<pre class="rust item-decl"><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 B</a>, pub b: <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>, -}</code></pre></div>
\ No newline at end of file +}</code></pre>
\ No newline at end of file diff --git a/tests/rustdoc/whitespace-after-where-clause.trait.html b/tests/rustdoc/whitespace-after-where-clause.trait.html index a2df06e77..0928b48e6 100644 --- a/tests/rustdoc/whitespace-after-where-clause.trait.html +++ b/tests/rustdoc/whitespace-after-where-clause.trait.html @@ -1,6 +1,8 @@ -<div class="item-decl"><pre class="rust"><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>{ +<pre class="rust item-decl"><code>pub trait ToOwned<T><span class="where fmt-newline">where + 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>; + // Required methods fn <a href="#tymethod.to_owned" class="fn">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="fn">whatever</a>(&self) -> T; -}</code></pre></div>
\ No newline at end of file +}</code></pre>
\ No newline at end of file diff --git a/tests/rustdoc/whitespace-after-where-clause.trait2.html b/tests/rustdoc/whitespace-after-where-clause.trait2.html index 2bfd6f768..e6fafde1e 100644 --- a/tests/rustdoc/whitespace-after-where-clause.trait2.html +++ b/tests/rustdoc/whitespace-after-where-clause.trait2.html @@ -1,6 +1,7 @@ -<div class="item-decl"><pre class="rust"><code>pub trait ToOwned2<T: <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> { +<pre class="rust item-decl"><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>; + // Required methods fn <a href="#tymethod.to_owned" class="fn">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="fn">whatever</a>(&self) -> T; -}</code></pre></div>
\ No newline at end of file +}</code></pre>
\ No newline at end of file diff --git a/tests/rustdoc/whitespace-after-where-clause.union.html b/tests/rustdoc/whitespace-after-where-clause.union.html index 066f8f87b..38b6cb8b5 100644 --- a/tests/rustdoc/whitespace-after-where-clause.union.html +++ b/tests/rustdoc/whitespace-after-where-clause.union.html @@ -1,3 +1,4 @@ -<div class="item-decl"><pre class="rust"><code>pub union Union<'a, B><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>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ +<pre class="rust item-decl"><code>pub union Union<'a, B><span class="where fmt-newline">where + 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>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ /* private fields */ -}</code></pre></div>
\ No newline at end of file +}</code></pre>
\ No newline at end of file diff --git a/tests/rustdoc/whitespace-after-where-clause.union2.html b/tests/rustdoc/whitespace-after-where-clause.union2.html index 6b48c5dbd..66ad30c92 100644 --- a/tests/rustdoc/whitespace-after-where-clause.union2.html +++ b/tests/rustdoc/whitespace-after-where-clause.union2.html @@ -1,3 +1,3 @@ -<div class="item-decl"><pre class="rust"><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> { +<pre class="rust item-decl"><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>
\ No newline at end of file +}</code></pre>
\ No newline at end of file diff --git a/tests/rustdoc/wrapping.rs b/tests/rustdoc/wrapping.rs index 178b8adc3..dd5c70032 100644 --- a/tests/rustdoc/wrapping.rs +++ b/tests/rustdoc/wrapping.rs @@ -1,5 +1,5 @@ use std::fmt::Debug; -// @has 'wrapping/fn.foo.html' '//div[@class="item-decl"]/pre[@class="rust"]' 'pub fn foo() -> impl Debug' -// @count - '//div[@class="item-decl"]/pre[@class="rust"]/br' 0 +// @has 'wrapping/fn.foo.html' '//pre[@class="rust item-decl"]' 'pub fn foo() -> impl Debug' +// @count - '//pre[@class="rust item-decl"]/br' 0 pub fn foo() -> impl Debug {} |