summaryrefslogtreecommitdiffstats
path: root/src/test/rustdoc/inline_local
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/rustdoc/inline_local
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/rustdoc/inline_local')
-rw-r--r--src/test/rustdoc/inline_local/glob-extern-document-private-items.rs25
-rw-r--r--src/test/rustdoc/inline_local/glob-extern.rs21
-rw-r--r--src/test/rustdoc/inline_local/glob-private-document-private-items.rs48
-rw-r--r--src/test/rustdoc/inline_local/glob-private.rs42
-rw-r--r--src/test/rustdoc/inline_local/hidden-use.rs10
-rw-r--r--src/test/rustdoc/inline_local/issue-28537.rs17
-rw-r--r--src/test/rustdoc/inline_local/issue-32343.rs23
-rw-r--r--src/test/rustdoc/inline_local/macro_by_example.rs17
-rw-r--r--src/test/rustdoc/inline_local/please_inline.rs19
-rw-r--r--src/test/rustdoc/inline_local/trait-vis.rs18
10 files changed, 240 insertions, 0 deletions
diff --git a/src/test/rustdoc/inline_local/glob-extern-document-private-items.rs b/src/test/rustdoc/inline_local/glob-extern-document-private-items.rs
new file mode 100644
index 000000000..a2f0d65ef
--- /dev/null
+++ b/src/test/rustdoc/inline_local/glob-extern-document-private-items.rs
@@ -0,0 +1,25 @@
+// compile-flags: --document-private-items
+
+#![crate_name = "foo"]
+
+mod mod1 {
+ extern "C" {
+ pub fn public_fn();
+ fn private_fn();
+ }
+}
+
+pub use mod1::*;
+
+// @has foo/index.html
+// @has - "mod1"
+// @has - "public_fn"
+// @!has - "private_fn"
+// @has foo/fn.public_fn.html
+// @!has foo/fn.private_fn.html
+
+// @has foo/mod1/index.html
+// @has - "public_fn"
+// @has - "private_fn"
+// @has foo/mod1/fn.public_fn.html
+// @has foo/mod1/fn.private_fn.html
diff --git a/src/test/rustdoc/inline_local/glob-extern.rs b/src/test/rustdoc/inline_local/glob-extern.rs
new file mode 100644
index 000000000..686e55de3
--- /dev/null
+++ b/src/test/rustdoc/inline_local/glob-extern.rs
@@ -0,0 +1,21 @@
+#![crate_name = "foo"]
+
+mod mod1 {
+ extern "C" {
+ pub fn public_fn();
+ fn private_fn();
+ }
+}
+
+pub use mod1::*;
+
+// @has foo/index.html
+// @!has - "mod1"
+// @has - "public_fn"
+// @!has - "private_fn"
+// @has foo/fn.public_fn.html
+// @!has foo/fn.private_fn.html
+
+// @!has foo/mod1/index.html
+// @has foo/mod1/fn.public_fn.html
+// @!has foo/mod1/fn.private_fn.html
diff --git a/src/test/rustdoc/inline_local/glob-private-document-private-items.rs b/src/test/rustdoc/inline_local/glob-private-document-private-items.rs
new file mode 100644
index 000000000..f16d21ecd
--- /dev/null
+++ b/src/test/rustdoc/inline_local/glob-private-document-private-items.rs
@@ -0,0 +1,48 @@
+// compile-flags: --document-private-items
+
+#![crate_name = "foo"]
+
+mod mod1 {
+ mod mod2 {
+ pub struct Mod2Public;
+ struct Mod2Private;
+ }
+ pub use self::mod2::*;
+
+ pub struct Mod1Public;
+ struct Mod1Private;
+}
+pub use mod1::*;
+
+// @has foo/index.html
+// @has - "mod1"
+// @has - "Mod1Public"
+// @!has - "Mod1Private"
+// @!has - "mod2"
+// @has - "Mod2Public"
+// @!has - "Mod2Private"
+// @has foo/struct.Mod1Public.html
+// @!has foo/struct.Mod1Private.html
+// @has foo/struct.Mod2Public.html
+// @!has foo/struct.Mod2Private.html
+
+// @has foo/mod1/index.html
+// @has - "mod2"
+// @has - "Mod1Public"
+// @has - "Mod1Private"
+// @!has - "Mod2Public"
+// @!has - "Mod2Private"
+// @has foo/mod1/struct.Mod1Public.html
+// @has foo/mod1/struct.Mod1Private.html
+// @!has foo/mod1/struct.Mod2Public.html
+// @!has foo/mod1/struct.Mod2Private.html
+
+// @has foo/mod1/mod2/index.html
+// @has - "Mod2Public"
+// @has - "Mod2Private"
+// @has foo/mod1/mod2/struct.Mod2Public.html
+// @has foo/mod1/mod2/struct.Mod2Private.html
+
+// @!has foo/mod2/index.html
+// @!has foo/mod2/struct.Mod2Public.html
+// @!has foo/mod2/struct.Mod2Private.html
diff --git a/src/test/rustdoc/inline_local/glob-private.rs b/src/test/rustdoc/inline_local/glob-private.rs
new file mode 100644
index 000000000..d294d590e
--- /dev/null
+++ b/src/test/rustdoc/inline_local/glob-private.rs
@@ -0,0 +1,42 @@
+#![crate_name = "foo"]
+
+mod mod1 {
+ mod mod2 {
+ pub struct Mod2Public;
+ struct Mod2Private;
+ }
+ pub use self::mod2::*;
+
+ pub struct Mod1Public;
+ struct Mod1Private;
+}
+pub use mod1::*;
+
+// @has foo/index.html
+// @!has - "mod1"
+// @has - "Mod1Public"
+// @!has - "Mod1Private"
+// @!has - "mod2"
+// @has - "Mod2Public"
+// @!has - "Mod2Private"
+// @has foo/struct.Mod1Public.html
+// @!has foo/struct.Mod1Private.html
+// @has foo/struct.Mod2Public.html
+// @!has foo/struct.Mod2Private.html
+
+// @has-dir foo/mod1
+// @!has foo/mod1/index.html
+// @has foo/mod1/struct.Mod1Public.html
+// @!has foo/mod1/struct.Mod1Private.html
+// @!has foo/mod1/struct.Mod2Public.html
+// @!has foo/mod1/struct.Mod2Private.html
+
+// @has-dir foo/mod1/mod2
+// @!has foo/mod1/mod2/index.html
+// @has foo/mod1/mod2/struct.Mod2Public.html
+// @!has foo/mod1/mod2/struct.Mod2Private.html
+
+// @!has-dir foo/mod2
+// @!has foo/mod2/index.html
+// @!has foo/mod2/struct.Mod2Public.html
+// @!has foo/mod2/struct.Mod2Private.html
diff --git a/src/test/rustdoc/inline_local/hidden-use.rs b/src/test/rustdoc/inline_local/hidden-use.rs
new file mode 100644
index 000000000..a972d376a
--- /dev/null
+++ b/src/test/rustdoc/inline_local/hidden-use.rs
@@ -0,0 +1,10 @@
+mod private {
+ pub struct Foo {}
+}
+
+// @has hidden_use/index.html
+// @!has - 'private'
+// @!has - 'Foo'
+// @!has hidden_use/struct.Foo.html
+#[doc(hidden)]
+pub use private::Foo;
diff --git a/src/test/rustdoc/inline_local/issue-28537.rs b/src/test/rustdoc/inline_local/issue-28537.rs
new file mode 100644
index 000000000..da9cc4c94
--- /dev/null
+++ b/src/test/rustdoc/inline_local/issue-28537.rs
@@ -0,0 +1,17 @@
+#[doc(hidden)]
+pub mod foo {
+ pub struct Foo;
+}
+
+mod bar {
+ pub use self::bar::Bar;
+ mod bar {
+ pub struct Bar;
+ }
+}
+
+// @has issue_28537/struct.Foo.html
+pub use foo::Foo;
+
+// @has issue_28537/struct.Bar.html
+pub use self::bar::Bar;
diff --git a/src/test/rustdoc/inline_local/issue-32343.rs b/src/test/rustdoc/inline_local/issue-32343.rs
new file mode 100644
index 000000000..5620ae0dc
--- /dev/null
+++ b/src/test/rustdoc/inline_local/issue-32343.rs
@@ -0,0 +1,23 @@
+// @!has issue_32343/struct.Foo.html
+// @has issue_32343/index.html
+// @has - '//code' 'pub use foo::Foo'
+// @!has - '//code/a' 'Foo'
+#[doc(no_inline)]
+pub use foo::Foo;
+
+// @!has issue_32343/struct.Bar.html
+// @has issue_32343/index.html
+// @has - '//code' 'pub use foo::Bar'
+// @has - '//code/a' 'Bar'
+#[doc(no_inline)]
+pub use foo::Bar;
+
+mod foo {
+ pub struct Foo;
+ pub struct Bar;
+}
+
+pub mod bar {
+ // @has issue_32343/bar/struct.Bar.html
+ pub use ::foo::Bar;
+}
diff --git a/src/test/rustdoc/inline_local/macro_by_example.rs b/src/test/rustdoc/inline_local/macro_by_example.rs
new file mode 100644
index 000000000..dacc7cfb3
--- /dev/null
+++ b/src/test/rustdoc/inline_local/macro_by_example.rs
@@ -0,0 +1,17 @@
+/// docs for foo
+#[deprecated(since = "1.2.3", note = "text")]
+#[macro_export]
+macro_rules! foo {
+ ($($tt:tt)*) => {}
+}
+
+// @has macro_by_example/macros/index.html
+pub mod macros {
+ // @!has - 'pub use foo as bar;'
+ // @has macro_by_example/macros/macro.bar.html
+ // @has - '//*[@class="docblock"]' 'docs for foo'
+ // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.2.3: text'
+ // @has - '//a/@href' 'macro_by_example.rs.html#4-6'
+ #[doc(inline)]
+ pub use foo as bar;
+}
diff --git a/src/test/rustdoc/inline_local/please_inline.rs b/src/test/rustdoc/inline_local/please_inline.rs
new file mode 100644
index 000000000..48539361f
--- /dev/null
+++ b/src/test/rustdoc/inline_local/please_inline.rs
@@ -0,0 +1,19 @@
+pub mod foo {
+ pub struct Foo;
+}
+
+// @has please_inline/a/index.html
+pub mod a {
+ // @!has - 'pub use foo::'
+ // @has please_inline/a/struct.Foo.html
+ #[doc(inline)]
+ pub use foo::Foo;
+}
+
+// @has please_inline/b/index.html
+pub mod b {
+ // @has - 'pub use foo::'
+ // @!has please_inline/b/struct.Foo.html
+ #[feature(inline)]
+ pub use foo::Foo;
+}
diff --git a/src/test/rustdoc/inline_local/trait-vis.rs b/src/test/rustdoc/inline_local/trait-vis.rs
new file mode 100644
index 000000000..e7b08088f
--- /dev/null
+++ b/src/test/rustdoc/inline_local/trait-vis.rs
@@ -0,0 +1,18 @@
+pub trait ThisTrait {}
+
+mod asdf {
+ use ThisTrait;
+
+ pub struct SomeStruct;
+
+ impl ThisTrait for SomeStruct {}
+
+ trait PrivateTrait {}
+
+ impl PrivateTrait for SomeStruct {}
+}
+
+// @has trait_vis/struct.SomeStruct.html
+// @has - '//h3[@class="code-header in-band"]' 'impl ThisTrait for SomeStruct'
+// @!has - '//h3[@class="code-header in-band"]' 'impl PrivateTrait for SomeStruct'
+pub use asdf::SomeStruct;