-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #112178 - GuillaumeGomez:fix-inline-private-intermedi…
…ate, r=notriddle Fix bug where private item with intermediate doc hidden re-export was not inlined This fixes this bug: ```rust mod private { /// Original. pub struct Bar3; } /// Hidden. #[doc(hidden)] pub use crate::private::Bar3; /// Visible. pub use self::Bar3 as Reexport; ``` In this case, `private::Bar3` should be inlined and renamed `Reexport` but instead we have: ``` pub use self::Bar3 as Reexport; ``` and no links. There were actually two issues: the first one is that we forgot to check if the next intermediate re-export was doc hidden. The second was that we made the `#[doc(hidden)]` attribute inheritable, which shouldn't be possible. r? `@notriddle`
- Loading branch information
Showing
4 changed files
with
29 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
tests/rustdoc/inline-private-with-intermediate-doc-hidden.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// This test ensures that if a private item is re-exported with an intermediate | ||
// `#[doc(hidden)]` re-export, it'll still be inlined (and not include any attribute | ||
// from the doc hidden re-export. | ||
|
||
#![crate_name = "foo"] | ||
|
||
// @has 'foo/index.html' | ||
// There should only be one struct displayed. | ||
// @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 1 | ||
// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Structs' | ||
// @has - '//*[@id="main-content"]//a[@href="struct.Reexport.html"]' 'Reexport' | ||
// @has - '//*[@id="main-content"]//*[@class="desc docblock-short"]' 'Visible. Original.' | ||
|
||
mod private { | ||
/// Original. | ||
pub struct Bar3; | ||
} | ||
|
||
/// Hidden. | ||
#[doc(hidden)] | ||
pub use crate::private::Bar3; | ||
/// Visible. | ||
pub use self::Bar3 as Reexport; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters