diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-04-11 20:20:49 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-11 20:20:49 +0200 |
| commit | bcdc281e5c0429450dc6122930bbde3753491f3f (patch) | |
| tree | 1b4fb9abf2f4e760ee98532295a6c7533676a507 /tests/rustdoc | |
| parent | df7daa815f4047a1cfe24ecfbc12cfd4f40fa928 (diff) | |
| parent | 5a0be6ff3dcc89a14e22c8613c86acbb0cd55b4a (diff) | |
| download | rust-bcdc281e5c0429450dc6122930bbde3753491f3f.tar.gz rust-bcdc281e5c0429450dc6122930bbde3753491f3f.zip | |
Rollup merge of #123459 - GuillaumeGomez:fix-123435, r=notriddle
Correctly handle inlining of doc hidden foreign items Fixes #123435. In case a foreign item has doc(hidden) attribute, we simply merged its attributes with the re-export's, making it being removed once in the `strip_hidden` pass. The solution was to use the same as for local reexported items: merge attributes, but not some of them (like `doc(hidden)`). I originally checked if we could simply update `Item::is_doc_hidden` method to use `self.inline_stmt_id.is_some_and(|def_id| tcx.is_doc_hidden(def_id))` but unfortunately, it added (local) items that shouldn't be inlined. At least it unifies local and foreign items inlining, which I think is the best course of action here. r? `@notriddle`
Diffstat (limited to 'tests/rustdoc')
| -rw-r--r-- | tests/rustdoc/inline_cross/inline_hidden.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/rustdoc/inline_cross/inline_hidden.rs b/tests/rustdoc/inline_cross/inline_hidden.rs index ec06f2f0c5d..2a3dd72749c 100644 --- a/tests/rustdoc/inline_cross/inline_hidden.rs +++ b/tests/rustdoc/inline_cross/inline_hidden.rs @@ -4,9 +4,23 @@ extern crate rustdoc_hidden; +// @has inline_hidden/index.html +// Ensures this item is not inlined. +// @has - '//*[@id="reexport.Foo"]/code' 'pub use rustdoc_hidden::Foo;' #[doc(no_inline)] pub use rustdoc_hidden::Foo; +// Even if the foreign item has `doc(hidden)`, we should be able to inline it. +// @has - '//*[@class="item-name"]/a[@class="struct"]' 'Inlined' +#[doc(inline)] +pub use rustdoc_hidden::Foo as Inlined; + +// Even with this import, we should not see `Foo`. +// @count - '//*[@class="item-name"]' 4 +// @has - '//*[@class="item-name"]/a[@class="struct"]' 'Bar' +// @has - '//*[@class="item-name"]/a[@class="fn"]' 'foo' +pub use rustdoc_hidden::*; + // @has inline_hidden/fn.foo.html // @!has - '//a/@title' 'Foo' pub fn foo(_: Foo) {} |
