summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /tests/rustdoc
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/rustdoc')
-rw-r--r--tests/rustdoc/deref/deref-const-fn.rs (renamed from tests/rustdoc/deref-const-fn.rs)0
-rw-r--r--tests/rustdoc/deref/deref-multiple-impl-blocks.rs43
-rw-r--r--tests/rustdoc/deref/deref-mut-methods.rs (renamed from tests/rustdoc/deref-mut-methods.rs)0
-rw-r--r--tests/rustdoc/deref/deref-recursive-pathbuf.rs (renamed from tests/rustdoc/deref-recursive-pathbuf.rs)0
-rw-r--r--tests/rustdoc/deref/deref-recursive.rs (renamed from tests/rustdoc/deref-recursive.rs)0
-rw-r--r--tests/rustdoc/deref/deref-slice-core.rs (renamed from tests/rustdoc/deref-slice-core.rs)0
-rw-r--r--tests/rustdoc/deref/deref-to-primitive.rs (renamed from tests/rustdoc/deref-to-primitive.rs)0
-rw-r--r--tests/rustdoc/deref/deref-typedef.rs (renamed from tests/rustdoc/deref-typedef.rs)0
-rw-r--r--tests/rustdoc/deref/escape-deref-methods.rs (renamed from tests/rustdoc/escape-deref-methods.rs)0
-rw-r--r--tests/rustdoc/deref/issue-100679-sidebar-links-deref.rs (renamed from tests/rustdoc/issue-100679-sidebar-links-deref.rs)0
-rw-r--r--tests/rustdoc/deref/recursive-deref-sidebar.rs (renamed from tests/rustdoc/recursive-deref-sidebar.rs)0
-rw-r--r--tests/rustdoc/deref/recursive-deref.rs (renamed from tests/rustdoc/recursive-deref.rs)0
-rw-r--r--tests/rustdoc/hide-complex-unevaluated-const-arguments.rs8
-rw-r--r--tests/rustdoc/impl-alias-substituted.rs9
-rw-r--r--tests/rustdoc/inherent-projections.rs44
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/repr.rs22
-rw-r--r--tests/rustdoc/inline_cross/repr.rs29
-rw-r--r--tests/rustdoc/intra-doc/inherent-associated-types.rs45
-rw-r--r--tests/rustdoc/issue-106142.rs14
-rw-r--r--tests/rustdoc/issue-110422-inner-private.rs64
-rw-r--r--tests/rustdoc/issue-110629-private-type-cycle.rs19
-rw-r--r--tests/rustdoc/issue-111064-reexport-trait-from-hidden-2.rs31
-rw-r--r--tests/rustdoc/issue-111064-reexport-trait-from-hidden.rs21
-rw-r--r--tests/rustdoc/issue-46506-pub-reexport-of-pub-reexport.rs24
-rw-r--r--tests/rustdoc/issue-60522-duplicated-glob-reexport.rs39
-rw-r--r--tests/rustdoc/issue-94183-blanket-impl-reexported-trait.rs31
-rw-r--r--tests/rustdoc/nested-items-issue-111415.rs36
-rw-r--r--tests/rustdoc/playground-arg.rs2
-rw-r--r--tests/rustdoc/reexport-doc-hidden.rs3
-rw-r--r--tests/rustdoc/reexport-hidden-macro.rs2
-rw-r--r--tests/rustdoc/reexport-of-doc-hidden.rs42
-rw-r--r--tests/rustdoc/rfc-2632-const-trait-impl.rs40
-rw-r--r--tests/rustdoc/test-strikethrough.rs13
33 files changed, 552 insertions, 29 deletions
diff --git a/tests/rustdoc/deref-const-fn.rs b/tests/rustdoc/deref/deref-const-fn.rs
index 8ecca6d12..8ecca6d12 100644
--- a/tests/rustdoc/deref-const-fn.rs
+++ b/tests/rustdoc/deref/deref-const-fn.rs
diff --git a/tests/rustdoc/deref/deref-multiple-impl-blocks.rs b/tests/rustdoc/deref/deref-multiple-impl-blocks.rs
new file mode 100644
index 000000000..fa3607c5f
--- /dev/null
+++ b/tests/rustdoc/deref/deref-multiple-impl-blocks.rs
@@ -0,0 +1,43 @@
+#![crate_name="foo"]
+
+use std::ops::{Deref, DerefMut};
+
+// @has foo/struct.Vec.html
+// @count - '//h2[@id="deref-methods-Slice"]' 1
+// @count - '//div[@id="deref-methods-Slice-1"]' 1
+// @count - '//div[@id="deref-methods-Slice-1"][@class="impl-items"]' 1
+// @count - '//div[@id="deref-methods-Slice-1"]/div[@class="impl-items"]' 0
+pub struct Vec;
+
+pub struct Slice;
+
+impl Deref for Vec {
+ type Target = Slice;
+ fn deref(&self) -> &Slice {
+ &Slice
+ }
+}
+
+impl DerefMut for Vec {
+ fn deref_mut(&mut self) -> &mut Slice {
+ &mut Slice
+ }
+}
+
+impl Slice {
+ pub fn sort_floats(&mut self) {
+ todo!();
+ }
+}
+
+impl Slice {
+ pub fn sort(&mut self) {
+ todo!();
+ }
+}
+
+impl Slice {
+ pub fn len(&self) {
+ todo!();
+ }
+}
diff --git a/tests/rustdoc/deref-mut-methods.rs b/tests/rustdoc/deref/deref-mut-methods.rs
index fdf843422..fdf843422 100644
--- a/tests/rustdoc/deref-mut-methods.rs
+++ b/tests/rustdoc/deref/deref-mut-methods.rs
diff --git a/tests/rustdoc/deref-recursive-pathbuf.rs b/tests/rustdoc/deref/deref-recursive-pathbuf.rs
index be2b42b5a..be2b42b5a 100644
--- a/tests/rustdoc/deref-recursive-pathbuf.rs
+++ b/tests/rustdoc/deref/deref-recursive-pathbuf.rs
diff --git a/tests/rustdoc/deref-recursive.rs b/tests/rustdoc/deref/deref-recursive.rs
index 0436f2f86..0436f2f86 100644
--- a/tests/rustdoc/deref-recursive.rs
+++ b/tests/rustdoc/deref/deref-recursive.rs
diff --git a/tests/rustdoc/deref-slice-core.rs b/tests/rustdoc/deref/deref-slice-core.rs
index cccf273a8..cccf273a8 100644
--- a/tests/rustdoc/deref-slice-core.rs
+++ b/tests/rustdoc/deref/deref-slice-core.rs
diff --git a/tests/rustdoc/deref-to-primitive.rs b/tests/rustdoc/deref/deref-to-primitive.rs
index 527de780d..527de780d 100644
--- a/tests/rustdoc/deref-to-primitive.rs
+++ b/tests/rustdoc/deref/deref-to-primitive.rs
diff --git a/tests/rustdoc/deref-typedef.rs b/tests/rustdoc/deref/deref-typedef.rs
index 32424d13e..32424d13e 100644
--- a/tests/rustdoc/deref-typedef.rs
+++ b/tests/rustdoc/deref/deref-typedef.rs
diff --git a/tests/rustdoc/escape-deref-methods.rs b/tests/rustdoc/deref/escape-deref-methods.rs
index 66919d73e..66919d73e 100644
--- a/tests/rustdoc/escape-deref-methods.rs
+++ b/tests/rustdoc/deref/escape-deref-methods.rs
diff --git a/tests/rustdoc/issue-100679-sidebar-links-deref.rs b/tests/rustdoc/deref/issue-100679-sidebar-links-deref.rs
index f09d23206..f09d23206 100644
--- a/tests/rustdoc/issue-100679-sidebar-links-deref.rs
+++ b/tests/rustdoc/deref/issue-100679-sidebar-links-deref.rs
diff --git a/tests/rustdoc/recursive-deref-sidebar.rs b/tests/rustdoc/deref/recursive-deref-sidebar.rs
index 619f40eff..619f40eff 100644
--- a/tests/rustdoc/recursive-deref-sidebar.rs
+++ b/tests/rustdoc/deref/recursive-deref-sidebar.rs
diff --git a/tests/rustdoc/recursive-deref.rs b/tests/rustdoc/deref/recursive-deref.rs
index aa38485c4..aa38485c4 100644
--- a/tests/rustdoc/recursive-deref.rs
+++ b/tests/rustdoc/deref/recursive-deref.rs
diff --git a/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs b/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs
index d368db909..6006354eb 100644
--- a/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs
+++ b/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs
@@ -29,7 +29,7 @@ pub trait Stage {
//
// @has - '//*[@id="associatedconstant.ARRAY1"]' \
// 'const ARRAY1: [u8; { _ }]'
- const ARRAY1: [u8; Struct::new(/* ... */) + Self::ABSTRACT * 1_000];
+ const ARRAY1: [u8; Struct::new(/* ... */).do_something(Self::ABSTRACT * 1_000)];
// @has - '//*[@id="associatedconstant.VERBOSE"]' \
// 'const VERBOSE: [u16; { _ }]'
@@ -73,10 +73,14 @@ pub struct Struct { private: () }
impl Struct {
const fn new() -> Self { Self { private: () } }
+ const fn do_something(self, x: usize) -> usize {
+ x
+ }
}
-
+/* FIXME(const-trait): readd this
impl const std::ops::Add<usize> for Struct {
type Output = usize;
fn add(self, _: usize) -> usize { 0 }
}
+*/
diff --git a/tests/rustdoc/impl-alias-substituted.rs b/tests/rustdoc/impl-alias-substituted.rs
new file mode 100644
index 000000000..82dfffe5f
--- /dev/null
+++ b/tests/rustdoc/impl-alias-substituted.rs
@@ -0,0 +1,9 @@
+pub struct Matrix<T, const N: usize, const M: usize>([[T; N]; M]);
+
+pub type Vector<T, const N: usize> = Matrix<T, N, 1>;
+
+// @has "impl_alias_substituted/struct.Matrix.html" '//*[@class="impl"]//h3[@class="code-header"]' \
+// "impl<T: Copy> Matrix<T, 3, 1>"
+impl<T: Copy> Vector<T, 3> {
+ pub fn test() {}
+}
diff --git a/tests/rustdoc/inherent-projections.rs b/tests/rustdoc/inherent-projections.rs
new file mode 100644
index 000000000..9bda0acaf
--- /dev/null
+++ b/tests/rustdoc/inherent-projections.rs
@@ -0,0 +1,44 @@
+#![feature(inherent_associated_types)]
+#![allow(incomplete_features)]
+
+// @has 'inherent_projections/fn.create.html'
+// @has - '//pre[@class="rust item-decl"]' "create() -> Owner::Metadata"
+// @has - '//pre[@class="rust item-decl"]//a[@class="associatedtype"]/@href' 'struct.Owner.html#associatedtype.Metadata'
+pub fn create() -> Owner::Metadata {}
+
+pub struct Owner;
+
+impl Owner {
+ pub type Metadata = ();
+}
+
+// Make sure we handle bound vars correctly.
+// @has 'inherent_projections/type.User.html' '//pre[@class="rust item-decl"]' "for<'a> fn(_: Carrier<'a>::Focus)"
+pub type User = for<'a> fn(Carrier<'a>::Focus);
+
+pub struct Carrier<'a>(&'a ());
+
+impl<'a> Carrier<'a> {
+ pub type Focus = &'a mut i32;
+}
+
+////////////////////////////////////////
+
+// FIXME(inherent_associated_types): Below we link to `Proj` but we should link to `Proj-1`.
+// The current test checks for the buggy behavior for demonstration purposes.
+
+// @has 'inherent_projections/type.Test.html'
+// @has - '//pre[@class="rust item-decl"]' "Parametrized<i32>"
+// @has - '//pre[@class="rust item-decl"]//a[@class="associatedtype"]/@href' 'struct.Parametrized.html#associatedtype.Proj'
+// @!has - '//pre[@class="rust item-decl"]//a[@class="associatedtype"]/@href' 'struct.Parametrized.html#associatedtype.Proj-1'
+pub type Test = Parametrized<i32>::Proj;
+
+pub struct Parametrized<T>(T);
+
+impl Parametrized<bool> {
+ pub type Proj = ();
+}
+
+impl Parametrized<i32> {
+ pub type Proj = String;
+}
diff --git a/tests/rustdoc/inline_cross/auxiliary/repr.rs b/tests/rustdoc/inline_cross/auxiliary/repr.rs
new file mode 100644
index 000000000..4a6648a64
--- /dev/null
+++ b/tests/rustdoc/inline_cross/auxiliary/repr.rs
@@ -0,0 +1,22 @@
+#![feature(repr_simd)]
+
+#[repr(C, align(8))]
+pub struct ReprC {
+ field: u8,
+}
+#[repr(simd, packed(2))]
+pub struct ReprSimd {
+ field: u8,
+}
+#[repr(transparent)]
+pub struct ReprTransparent {
+ field: u8,
+}
+#[repr(isize)]
+pub enum ReprIsize {
+ Bla,
+}
+#[repr(u8)]
+pub enum ReprU8 {
+ Bla,
+}
diff --git a/tests/rustdoc/inline_cross/repr.rs b/tests/rustdoc/inline_cross/repr.rs
new file mode 100644
index 000000000..9e107cee9
--- /dev/null
+++ b/tests/rustdoc/inline_cross/repr.rs
@@ -0,0 +1,29 @@
+// Regression test for <https://github.com/rust-lang/rust/issues/110698>.
+// This test ensures that the re-exported items still have the `#[repr(...)]` attribute.
+
+// aux-build:repr.rs
+
+#![crate_name = "foo"]
+
+extern crate repr;
+
+// @has 'foo/struct.ReprC.html'
+// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(C, align(8))]'
+#[doc(inline)]
+pub use repr::ReprC;
+// @has 'foo/struct.ReprSimd.html'
+// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(simd, packed(2))]'
+#[doc(inline)]
+pub use repr::ReprSimd;
+// @has 'foo/struct.ReprTransparent.html'
+// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]'
+#[doc(inline)]
+pub use repr::ReprTransparent;
+// @has 'foo/enum.ReprIsize.html'
+// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(isize)]'
+#[doc(inline)]
+pub use repr::ReprIsize;
+// @has 'foo/enum.ReprU8.html'
+// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(u8)]'
+#[doc(inline)]
+pub use repr::ReprU8;
diff --git a/tests/rustdoc/intra-doc/inherent-associated-types.rs b/tests/rustdoc/intra-doc/inherent-associated-types.rs
new file mode 100644
index 000000000..2b28d2ae6
--- /dev/null
+++ b/tests/rustdoc/intra-doc/inherent-associated-types.rs
@@ -0,0 +1,45 @@
+#![feature(inherent_associated_types)]
+
+#![allow(incomplete_features)]
+#![deny(rustdoc::broken_intra_doc_links)]
+
+// @has inherent_associated_types/index.html
+
+// @has - '//a/@href' 'enum.Simple.html#associatedtype.Type'
+//! [`Simple::Type`]
+
+pub enum Simple {}
+
+impl Simple {
+ pub type Type = ();
+}
+
+////////////////////////////////////////
+
+// @has 'inherent_associated_types/type.Test0.html' '//a/@href' \
+// 'struct.Parametrized.html#associatedtype.Proj'
+/// [`Parametrized<bool>::Proj`]
+pub type Test0 = ();
+
+// FIXME(inherent_associated_types): The intra-doc link below should point to `Proj-1` not `Proj`.
+// The current test checks for the buggy behavior for demonstration purposes.
+// The same bug happens for inherent associated functions and constants (see #85960, #93398).
+//
+// Further, at some point we should reject the intra-doc link `Parametrized::Proj`.
+// It currently links to `Parametrized<bool>::Proj`.
+
+// @has 'inherent_associated_types/type.Test1.html'
+// @has - '//a/@href' 'struct.Parametrized.html#associatedtype.Proj'
+// @!has - '//a/@href' 'struct.Parametrized.html#associatedtype.Proj-1'
+/// [`Parametrized<i32>::Proj`]
+pub type Test1 = ();
+
+pub struct Parametrized<T>(T);
+
+impl Parametrized<bool> {
+ pub type Proj = ();
+}
+
+impl Parametrized<i32> {
+ pub type Proj = String;
+}
diff --git a/tests/rustdoc/issue-106142.rs b/tests/rustdoc/issue-106142.rs
new file mode 100644
index 000000000..41505e724
--- /dev/null
+++ b/tests/rustdoc/issue-106142.rs
@@ -0,0 +1,14 @@
+// @has 'issue_106142/a/index.html'
+// @count 'issue_106142/a/index.html' '//ul[@class="item-table"]//li//a' 1
+
+#![allow(rustdoc::broken_intra_doc_links)]
+
+pub mod a {
+ /// [`m`]
+ pub fn f() {}
+
+ #[macro_export]
+ macro_rules! m {
+ () => {};
+ }
+}
diff --git a/tests/rustdoc/issue-110422-inner-private.rs b/tests/rustdoc/issue-110422-inner-private.rs
new file mode 100644
index 000000000..ee8ed5cc6
--- /dev/null
+++ b/tests/rustdoc/issue-110422-inner-private.rs
@@ -0,0 +1,64 @@
+// Regression test for <https://github.com/rust-lang/rust/issues/110422>.
+// This test ensures that inner items (except for implementations and macros)
+// don't appear in documentation.
+
+// compile-flags: --document-private-items
+
+#![crate_name = "foo"]
+
+// @has 'foo/index.html'
+// Checking there is no "trait" entry.
+// @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 4
+// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Structs'
+// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Constants'
+// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Functions'
+// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Macros'
+
+// @has - '//a[@href="fn.foo.html"]' 'foo'
+fn foo() {
+ fn bar() {}
+
+ // @has - '//a[@class="macro"]' 'visible_macro'
+ // @!has - '//a[@class="macro"]' 'non_visible_macro'
+ // @has 'foo/macro.visible_macro.html'
+ // @!has 'foo/macro.non_visible_macro.html'
+ #[macro_export]
+ macro_rules! visible_macro {
+ () => {}
+ }
+
+ macro_rules! non_visible_macro {
+ () => {}
+ }
+}
+
+// @has 'foo/index.html'
+// @has - '//a[@href="struct.Bar.html"]' 'Bar'
+struct Bar;
+
+const BAR: i32 = {
+ // @!has - '//a[@href="fn.yo.html"]' 'yo'
+ // @!has 'foo/fn.yo.html'
+ fn yo() {}
+
+ // @!has 'foo/index.html' '//a[@href="trait.Foo.html"]' 'Foo'
+ // @!has 'foo/trait.Foo.html'
+ trait Foo {
+ fn babar() {}
+ }
+ impl Foo for Bar {}
+
+ // @has 'foo/struct.Bar.html'
+ // @has - '//*[@id="method.foo"]/*[@class="code-header"]' 'pub(crate) fn foo()'
+ // @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 3
+ // We now check that the `Foo` trait is not documented nor visible on `Bar` page.
+ // @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Implementations'
+ // @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Auto Trait Implementations'
+ // @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Blanket Implementations'
+ // @!has - '//*[@href="trait.Foo.html#method.babar"]/*[@class="code-header"]' 'fn babar()'
+ impl Bar {
+ fn foo() {}
+ }
+
+ 1
+};
diff --git a/tests/rustdoc/issue-110629-private-type-cycle.rs b/tests/rustdoc/issue-110629-private-type-cycle.rs
new file mode 100644
index 000000000..a4efbb098
--- /dev/null
+++ b/tests/rustdoc/issue-110629-private-type-cycle.rs
@@ -0,0 +1,19 @@
+// compile-flags: --document-private-items
+
+#![feature(type_alias_impl_trait)]
+
+type Bar<'a, 'b> = impl PartialEq<Bar<'a, 'b>> + std::fmt::Debug;
+
+// @has issue_110629_private_type_cycle/type.Bar.html
+// @has - '//pre[@class="rust item-decl"]' \
+// "pub(crate) type Bar<'a, 'b> = impl PartialEq<Bar<'a, 'b>> + Debug;"
+
+fn bar<'a, 'b>(i: &'a i32) -> Bar<'a, 'b> {
+ i
+}
+
+fn main() {
+ let meh = 42;
+ let muh = 42;
+ assert_eq!(bar(&meh), bar(&muh));
+}
diff --git a/tests/rustdoc/issue-111064-reexport-trait-from-hidden-2.rs b/tests/rustdoc/issue-111064-reexport-trait-from-hidden-2.rs
new file mode 100644
index 000000000..8e1029a1c
--- /dev/null
+++ b/tests/rustdoc/issue-111064-reexport-trait-from-hidden-2.rs
@@ -0,0 +1,31 @@
+#![feature(no_core)]
+#![no_core]
+#![crate_name = "foo"]
+
+// @!has 'foo/hidden/index.html'
+// FIXME: add missing `@` for the two next tests once issue is fixed!
+// To be done in <https://github.com/rust-lang/rust/issues/111249>.
+// !has 'foo/hidden/inner/index.html'
+// !has 'foo/hidden/inner/trait.Foo.html'
+#[doc(hidden)]
+pub mod hidden {
+ pub mod inner {
+ pub trait Foo {
+ /// Hello, world!
+ fn test();
+ }
+ }
+}
+
+// @has 'foo/visible/index.html'
+// @has 'foo/visible/trait.Foo.html'
+#[doc(inline)]
+pub use hidden::inner as visible;
+
+// @has 'foo/struct.Bar.html'
+// @count - '//*[@id="impl-Foo-for-Bar"]' 1
+pub struct Bar;
+
+impl visible::Foo for Bar {
+ fn test() {}
+}
diff --git a/tests/rustdoc/issue-111064-reexport-trait-from-hidden.rs b/tests/rustdoc/issue-111064-reexport-trait-from-hidden.rs
new file mode 100644
index 000000000..a9ce4a345
--- /dev/null
+++ b/tests/rustdoc/issue-111064-reexport-trait-from-hidden.rs
@@ -0,0 +1,21 @@
+// Regression test for <https://github.com/rust-lang/rust/issues/111064>.
+// Methods from a re-exported trait inside a `#[doc(hidden)]` item should
+// be visible.
+
+#![crate_name = "foo"]
+
+// @has 'foo/index.html'
+// @has - '//*[@id="main-content"]//*[@class="item-name"]/a[@href="trait.Foo.html"]' 'Foo'
+
+// @has 'foo/trait.Foo.html'
+// @has - '//*[@id="main-content"]//*[@class="code-header"]' 'fn test()'
+
+#[doc(hidden)]
+mod hidden {
+ pub trait Foo {
+ /// Hello, world!
+ fn test();
+ }
+}
+
+pub use hidden::Foo;
diff --git a/tests/rustdoc/issue-46506-pub-reexport-of-pub-reexport.rs b/tests/rustdoc/issue-46506-pub-reexport-of-pub-reexport.rs
new file mode 100644
index 000000000..d8953eaf5
--- /dev/null
+++ b/tests/rustdoc/issue-46506-pub-reexport-of-pub-reexport.rs
@@ -0,0 +1,24 @@
+// This is a regression test for <https://github.com/rust-lang/rust/issues/46506>.
+// This test ensures that if public re-exported is re-exported, it won't be inlined.
+
+#![crate_name = "foo"]
+
+// @has 'foo/associations/index.html'
+// @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 1
+// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Traits'
+// @has - '//*[@id="main-content"]//a[@href="trait.GroupedBy.html"]' 'GroupedBy'
+// @has 'foo/associations/trait.GroupedBy.html'
+pub mod associations {
+ mod belongs_to {
+ pub trait GroupedBy {}
+ }
+ pub use self::belongs_to::GroupedBy;
+}
+
+// @has 'foo/prelude/index.html'
+// @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 1
+// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Re-exports'
+// @has - '//*[@id="main-content"]//*[@id="reexport.GroupedBy"]' 'pub use associations::GroupedBy;'
+pub mod prelude {
+ pub use associations::GroupedBy;
+}
diff --git a/tests/rustdoc/issue-60522-duplicated-glob-reexport.rs b/tests/rustdoc/issue-60522-duplicated-glob-reexport.rs
new file mode 100644
index 000000000..1429b5e47
--- /dev/null
+++ b/tests/rustdoc/issue-60522-duplicated-glob-reexport.rs
@@ -0,0 +1,39 @@
+// Regression test for <https://github.com/rust-lang/rust/issues/60522>.
+// This test ensures that the `banana` and `peach` modules don't appear twice
+// and that the visible modules are not the re-exported ones.
+
+#![crate_name = "foo"]
+
+// @has 'foo/index.html'
+// @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 1
+// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Modules'
+// @count - '//*[@id="main-content"]/*[@class="item-table"]//*[@class="mod"]' 2
+// @has - '//*[@id="main-content"]//*[@class="mod"]' 'banana'
+// @has - '//*[@id="main-content"]//*[@href="banana/index.html"]' 'banana'
+// @has - '//*[@id="main-content"]//*[@class="mod"]' 'peach'
+// @has - '//*[@id="main-content"]//*[@href="peach/index.html"]' 'peach'
+
+pub use crate::my_crate::*;
+
+mod my_crate {
+ pub mod banana {
+ pub struct Yellow;
+ }
+ pub mod peach {
+ pub struct Pink;
+ }
+}
+
+// @has 'foo/banana/index.html'
+// @count - '//*[@id="main-content"]//*[@class="struct"]' 1
+// @has - '//*[@id="main-content"]//*[@class="struct"]' 'Brown'
+pub mod banana {
+ pub struct Brown;
+}
+
+// @has 'foo/peach/index.html'
+// @count - '//*[@id="main-content"]//*[@class="struct"]' 1
+// @has - '//*[@id="main-content"]//*[@class="struct"]' 'Pungent'
+pub mod peach {
+ pub struct Pungent;
+}
diff --git a/tests/rustdoc/issue-94183-blanket-impl-reexported-trait.rs b/tests/rustdoc/issue-94183-blanket-impl-reexported-trait.rs
new file mode 100644
index 000000000..95ddd4c74
--- /dev/null
+++ b/tests/rustdoc/issue-94183-blanket-impl-reexported-trait.rs
@@ -0,0 +1,31 @@
+// Regression test for <https://github.com/rust-lang/rust/issues/94183>.
+// This test ensures that a publicly re-exported private trait will
+// appear in the blanket impl list.
+
+#![crate_name = "foo"]
+
+// @has 'foo/struct.S.html'
+
+mod actual_sub {
+ pub trait Actual {}
+ pub trait Another {}
+
+ // `Another` is publicly re-exported so it should appear in the blanket impl list.
+ // @has - '//*[@id="blanket-implementations-list"]//*[@class="code-header"]' 'impl<T> Another for T'
+ impl<T> Another for T {}
+
+ trait Foo {}
+
+ // `Foo` is not publicly re-exported nor reachable so it shouldn't appear in the
+ // blanket impl list.
+ // @!has - '//*[@id="blanket-implementations-list"]//*[@class="code-header"]' 'impl<T> Foo for T'
+ impl<T> Foo for T {}
+}
+
+pub use actual_sub::{Actual, Another};
+
+// `Actual` is publicly re-exported so it should appear in the blanket impl list.
+// @has - '//*[@id="blanket-implementations-list"]//*[@class="code-header"]' 'impl<T> Actual for T'
+impl<T> Actual for T {}
+
+pub struct S;
diff --git a/tests/rustdoc/nested-items-issue-111415.rs b/tests/rustdoc/nested-items-issue-111415.rs
new file mode 100644
index 000000000..9b7688c33
--- /dev/null
+++ b/tests/rustdoc/nested-items-issue-111415.rs
@@ -0,0 +1,36 @@
+// Regression test for <https://github.com/rust-lang/rust/issues/111415>.
+// This test ensures that only impl blocks are documented in bodies.
+
+#![crate_name = "foo"]
+
+// @has 'foo/index.html'
+// Checking there are only three sections.
+// @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 3
+// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Structs'
+// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Functions'
+// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Traits'
+// Checking that there are only three items.
+// @count - '//*[@id="main-content"]//*[@class="item-name"]' 3
+// @has - '//*[@id="main-content"]//a[@href="struct.Bar.html"]' 'Bar'
+// @has - '//*[@id="main-content"]//a[@href="fn.foo.html"]' 'foo'
+// @has - '//*[@id="main-content"]//a[@href="trait.Foo.html"]' 'Foo'
+
+// Now checking that the `foo` method is visible in `Bar` page.
+// @has 'foo/struct.Bar.html'
+// @has - '//*[@id="method.foo"]/*[@class="code-header"]' 'pub fn foo()'
+// @has - '//*[@id="method.bar"]/*[@class="code-header"]' 'fn bar()'
+pub struct Bar;
+
+pub trait Foo {
+ fn bar() {}
+}
+
+pub fn foo() {
+ pub mod inaccessible {}
+ pub fn inner() {}
+ pub const BAR: u32 = 0;
+ impl Bar {
+ pub fn foo() {}
+ }
+ impl Foo for Bar {}
+}
diff --git a/tests/rustdoc/playground-arg.rs b/tests/rustdoc/playground-arg.rs
index f3811fe0b..2542ed657 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+crate+r%23foo;%0Afn+main()+%7B%0Ause+foo::dummy;%0Adummy();%0A%7D&edition=2015"]' "Run"
+// @matches foo/index.html '//a[@class="test-arrow"][@href="https://example.com/?code=%23!%5Ballow(unused)%5D%0A%23%5Ballow(unused_extern_crates)%5D%0Aextern+crate+r%23foo;%0Afn+main()+%7B%0Ause+foo::dummy;%0Adummy();%0A%7D&edition=2015"]' "Run"
diff --git a/tests/rustdoc/reexport-doc-hidden.rs b/tests/rustdoc/reexport-doc-hidden.rs
index 3ea5fde72..d9ed95486 100644
--- a/tests/rustdoc/reexport-doc-hidden.rs
+++ b/tests/rustdoc/reexport-doc-hidden.rs
@@ -21,6 +21,5 @@ macro_rules! foo {
() => {};
}
-// This is a bug: https://github.com/rust-lang/rust/issues/59368
-// @!has - '//*[@id="reexport.Macro"]/code' 'pub use crate::foo as Macro;'
+// @has - '//*[@id="reexport.Macro"]/code' 'pub use crate::foo as Macro;'
pub use crate::foo as Macro;
diff --git a/tests/rustdoc/reexport-hidden-macro.rs b/tests/rustdoc/reexport-hidden-macro.rs
index afcfa9796..47a21e394 100644
--- a/tests/rustdoc/reexport-hidden-macro.rs
+++ b/tests/rustdoc/reexport-hidden-macro.rs
@@ -5,6 +5,7 @@
// @has 'foo/index.html'
// @has - '//*[@id="main-content"]//a[@href="macro.Macro2.html"]' 'Macro2'
+// @has - '//*[@id="reexport.Macro"]/code' 'pub use crate::foo as Macro;'
// @has 'foo/macro.Macro2.html'
// @has - '//*[@class="docblock"]' 'Displayed'
@@ -15,7 +16,6 @@ macro_rules! foo {
() => {};
}
-/// not displayed
pub use crate::foo as Macro;
/// Displayed
#[doc(inline)]
diff --git a/tests/rustdoc/reexport-of-doc-hidden.rs b/tests/rustdoc/reexport-of-doc-hidden.rs
new file mode 100644
index 000000000..b733716c2
--- /dev/null
+++ b/tests/rustdoc/reexport-of-doc-hidden.rs
@@ -0,0 +1,42 @@
+// This test ensures that all re-exports of doc hidden elements are displayed.
+
+#![crate_name = "foo"]
+
+#[doc(hidden)]
+pub struct Bar;
+
+#[macro_export]
+#[doc(hidden)]
+macro_rules! foo {
+ () => {};
+}
+
+// @has 'foo/index.html'
+// @has - '//*[@id="reexport.Macro"]/code' 'pub use crate::foo as Macro;'
+pub use crate::foo as Macro;
+// @has - '//*[@id="reexport.Macro2"]/code' 'pub use crate::foo as Macro2;'
+pub use crate::foo as Macro2;
+// @has - '//*[@id="reexport.Boo"]/code' 'pub use crate::Bar as Boo;'
+pub use crate::Bar as Boo;
+// @has - '//*[@id="reexport.Boo2"]/code' 'pub use crate::Bar as Boo2;'
+pub use crate::Bar as Boo2;
+
+pub fn fofo() {}
+
+// @has - '//*[@id="reexport.f1"]/code' 'pub use crate::fofo as f1;'
+pub use crate::fofo as f1;
+// @has - '//*[@id="reexport.f2"]/code' 'pub use crate::fofo as f2;'
+pub use crate::fofo as f2;
+
+pub mod sub {
+ // @has 'foo/sub/index.html'
+ // @has - '//*[@id="reexport.Macro"]/code' 'pub use crate::foo as Macro;'
+ pub use crate::foo as Macro;
+ // @has - '//*[@id="reexport.Macro2"]/code' 'pub use crate::foo as Macro2;'
+ pub use crate::foo as Macro2;
+
+ // @has - '//*[@id="reexport.f1"]/code' 'pub use crate::fofo as f1;'
+ pub use crate::fofo as f1;
+ // @has - '//*[@id="reexport.f2"]/code' 'pub use crate::fofo as f2;'
+ pub use crate::fofo as f2;
+}
diff --git a/tests/rustdoc/rfc-2632-const-trait-impl.rs b/tests/rustdoc/rfc-2632-const-trait-impl.rs
index 1120302ac..5d742dc39 100644
--- a/tests/rustdoc/rfc-2632-const-trait-impl.rs
+++ b/tests/rustdoc/rfc-2632-const-trait-impl.rs
@@ -13,57 +13,57 @@ use std::marker::Destruct;
pub struct S<T>(T);
// @!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/a[@class="trait"]' 'Fn'
// @!has - '//pre[@class="rust item-decl"]/code/span[@class="where"]' '~const'
-// @has - '//pre[@class="rust item-decl"]/code/span[@class="where"]' ': Clone'
+// @has - '//pre[@class="rust item-decl"]/code/span[@class="where"]' ': Fn'
#[const_trait]
pub trait Tr<T> {
// @!has - '//section[@id="method.a"]/h4[@class="code-header"]' '~const'
- // @has - '//section[@id="method.a"]/h4[@class="code-header"]/a[@class="trait"]' 'Clone'
+ // @has - '//section[@id="method.a"]/h4[@class="code-header"]/a[@class="trait"]' 'Fn'
// @!has - '//section[@id="method.a"]/h4[@class="code-header"]/span[@class="where"]' '~const'
- // @has - '//section[@id="method.a"]/h4[@class="code-header"]/span[@class="where fmt-newline"]' ': Clone'
- fn a<A: ~const Clone + ~const Destruct>()
+ // @has - '//section[@id="method.a"]/h4[@class="code-header"]/span[@class="where fmt-newline"]' ': Fn'
+ fn a<A: ~const Fn() + ~const Destruct>()
where
- Option<A>: ~const Clone + ~const Destruct,
+ Option<A>: ~const Fn() + ~const Destruct,
{
}
}
// @has - '//section[@id="impl-Tr%3CT%3E-for-T"]' ''
// @!has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]' '~const'
-// @has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/a[@class="trait"]' 'Clone'
+// @has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/a[@class="trait"]' 'Fn'
// @!has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/span[@class="where"]' '~const'
-// @has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/span[@class="where fmt-newline"]' ': Clone'
-impl<T: ~const Clone + ~const Destruct> const Tr<T> for T
+// @has - '//section[@id="impl-Tr%3CT%3E-for-T"]/h3[@class="code-header"]/span[@class="where fmt-newline"]' ': Fn'
+impl<T: ~const Fn() + ~const Destruct> const Tr<T> for T
where
- Option<T>: ~const Clone + ~const Destruct,
+ Option<T>: ~const Fn() + ~const Destruct,
{
- fn a<A: ~const Clone + ~const Destruct>()
+ fn a<A: ~const Fn() + ~const Destruct>()
where
- Option<A>: ~const Clone + ~const Destruct,
+ Option<A>: ~const Fn() + ~const Destruct,
{
}
}
// @!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/a[@class="trait"]' 'Fn'
// @!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>()
+// @has - '//pre[@class="rust item-decl"]/code/span[@class="where fmt-newline"]' ': Fn'
+pub const fn foo<F: ~const Fn() + ~const Destruct>()
where
- Option<F>: ~const Clone + ~const Destruct,
+ Option<F>: ~const Fn() + ~const Destruct,
{
F::a()
}
impl<T> S<T> {
// @!has foo/struct.S.html '//section[@id="method.foo"]/h4[@class="code-header"]' '~const'
- // @has - '//section[@id="method.foo"]/h4[@class="code-header"]/a[@class="trait"]' 'Clone'
+ // @has - '//section[@id="method.foo"]/h4[@class="code-header"]/a[@class="trait"]' 'Fn'
// @!has - '//section[@id="method.foo"]/h4[@class="code-header"]/span[@class="where"]' '~const'
- // @has - '//section[@id="method.foo"]/h4[@class="code-header"]/span[@class="where fmt-newline"]' ': Clone'
- pub const fn foo<B, C: ~const Clone + ~const Destruct>()
+ // @has - '//section[@id="method.foo"]/h4[@class="code-header"]/span[@class="where fmt-newline"]' ': Fn'
+ pub const fn foo<B, C: ~const Fn() + ~const Destruct>()
where
- B: ~const Clone + ~const Destruct,
+ B: ~const Fn() + ~const Destruct,
{
B::a()
}
diff --git a/tests/rustdoc/test-strikethrough.rs b/tests/rustdoc/test-strikethrough.rs
index c7855729a..58162153b 100644
--- a/tests/rustdoc/test-strikethrough.rs
+++ b/tests/rustdoc/test-strikethrough.rs
@@ -1,6 +1,13 @@
#![crate_name = "foo"]
-// @has foo/fn.f.html
-// @has - //del "Y"
-/// ~~Y~~
+// Test that strikethrough works with single and double tildes and that it shows up on
+// the item's dedicated page as well as the parent module's summary of items.
+
+// @has foo/index.html //del 'strike'
+// @has foo/index.html //del 'through'
+
+// @has foo/fn.f.html //del 'strike'
+// @has foo/fn.f.html //del 'through'
+
+/// ~~strike~~ ~through~
pub fn f() {}