about summary refs log tree commit diff
path: root/tests/rustdoc
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-03-20 07:10:30 +0100
committerGitHub <noreply@github.com>2023-03-20 07:10:30 +0100
commitc07679989a6bf83cd4fa7bdd0b8ea3bee754f3c0 (patch)
tree791032c573674a4e9b378cc484eeb26bc7f518b5 /tests/rustdoc
parentede3c39fe606fd8c3b181858001d8cc62f723c11 (diff)
parente9f29c40161ef06b014abd795b179861d5f55920 (diff)
downloadrust-c07679989a6bf83cd4fa7bdd0b8ea3bee754f3c0.tar.gz
rust-c07679989a6bf83cd4fa7bdd0b8ea3bee754f3c0.zip
Rollup merge of #109259 - GuillaumeGomez:fix-missing-private-inlining, r=notriddle
rustdoc: Fix missing private inlining

Fixes https://github.com/rust-lang/rust/issues/109258.

If the item isn't inlined, it shouldn't have been added into `view_item_stack`. The problem here was that it was not removed, preventing sub items to be inlined if they have a re-export in "upper levels".

cc `@epage`
r? `@notriddle`
Diffstat (limited to 'tests/rustdoc')
-rw-r--r--tests/rustdoc/issue-109258-missing-private-inlining.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/rustdoc/issue-109258-missing-private-inlining.rs b/tests/rustdoc/issue-109258-missing-private-inlining.rs
new file mode 100644
index 00000000000..96f606368b2
--- /dev/null
+++ b/tests/rustdoc/issue-109258-missing-private-inlining.rs
@@ -0,0 +1,27 @@
+// Regression test for <https://github.com/rust-lang/rust/issues/109258>.
+
+#![crate_name = "foo"]
+
+// @has 'foo/index.html'
+// We should only have a "Re-exports" and a "Modules" headers.
+// @count - '//*[@id="main-content"]/h2[@class="small-section-header"]' 2
+// @has - '//*[@id="main-content"]/h2[@class="small-section-header"]' 'Re-exports'
+// @has - '//*[@id="main-content"]/h2[@class="small-section-header"]' 'Modules'
+
+// @has - '//*[@id="reexport.Foo"]' 'pub use crate::issue_109258::Foo;'
+// @has - '//*[@id="reexport.Foo"]//a[@href="issue_109258/struct.Foo.html"]' 'Foo'
+// @!has 'foo/struct.Foo.html'
+pub use crate::issue_109258::Foo;
+
+// @has 'foo/issue_109258/index.html'
+// We should only have a "Structs" header.
+// @count - '//*[@id="main-content"]/h2[@class="small-section-header"]' 1
+// @has - '//*[@id="main-content"]/h2[@class="small-section-header"]' 'Structs'
+// @has - '//*[@id="main-content"]//a[@href="struct.Foo.html"]' 'Foo'
+// @has 'foo/issue_109258/struct.Foo.html'
+pub mod issue_109258 {
+    mod priv_mod {
+        pub struct Foo;
+    }
+    pub use self::priv_mod::Foo;
+}