Skip to content

Fix bug where private item with intermediate doc hidden re-export was not inlined - #112178

Merged
bors merged 3 commits into
rust-lang:masterfrom
GuillaumeGomez:fix-inline-private-intermediate
Jun 4, 2023
Merged

Fix bug where private item with intermediate doc hidden re-export was not inlined#112178
bors merged 3 commits into
rust-lang:masterfrom
GuillaumeGomez:fix-inline-private-intermediate

Conversation

@GuillaumeGomez

Copy link
Copy Markdown
Member

This fixes this bug:

mod private {/// Original.pubstructBar3;}/// Hidden.#[doc(hidden)]pubusecrate::private::Bar3;/// Visible.pubuseself::Bar3asReexport;

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

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jun 1, 2023
@GuillaumeGomezGuillaumeGomez changed the title Fix inline private intermediateFix bug where private item with intermediate doc hidden re-export was not inlinedJun 1, 2023
@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez

GuillaumeGomez commented Jun 1, 2023

Copy link
Copy Markdown
MemberAuthor

Fixed CI.

Comment threadtests/rustdoc/reexport-attr-merge.rs Outdated
@GuillaumeGomez
GuillaumeGomezforce-pushed the fix-inline-private-intermediate branch from ca8a476 to d029800CompareJune 3, 2023 17:57
@GuillaumeGomez

Copy link
Copy Markdown
MemberAuthor

Applied suggestion.

@notriddle

Copy link
Copy Markdown
Contributor

@bors r+ rollup

@bors

bors commented Jun 3, 2023

Copy link
Copy Markdown
Collaborator

📌 Commit d029800 has been approved by notriddle

It is now in the queue for this repository.

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 3, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 4, 2023
…intermediate, 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`
@matthiaskrgr

Copy link
Copy Markdown
Member

@bors r- might cause stack overflow here? #112264 (comment)

@borsbors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 4, 2023
@matthiaskrgr

Copy link
Copy Markdown
Member

Ah nevermind, I guess this was actually #112234 :D
@bors r=notriddle

@bors

bors commented Jun 4, 2023

Copy link
Copy Markdown
Collaborator

📌 Commit d029800 has been approved by notriddle

It is now in the queue for this repository.

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 4, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 4, 2023
…iaskrgr
Rollup of 6 pull requests
Successful merges:
- rust-lang#109093 (add `#[doc(alias="flatmap")]` to `Option::and_then`)
- rust-lang#110701 (Fix `x test core` when download-rustc is enabled)
- rust-lang#111982 (Revert "Enable incremental independent of stage")
- rust-lang#112158 (Add portable-simd mention)
- rust-lang#112172 (doc: improve explanation)
- rust-lang#112178 (Fix bug where private item with intermediate doc hidden re-export was not inlined)
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 0d6749c into rust-lang:masterJun 4, 2023
@rustbotrustbot added this to the 1.72.0 milestone Jun 4, 2023
@GuillaumeGomez
GuillaumeGomez deleted the fix-inline-private-intermediate branch June 4, 2023 17:27
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 15, 2023
…ddle
Add chapter in rustdoc book for re-exports and add a regression test for `#[doc(hidden)]` behaviour
Fixesrust-lang#109449.
Fixesrust-lang#53417.
After the discussion in rust-lang#109697, I made a few PRs to fix a few corner cases:
* rust-lang#112178
* rust-lang#112108
* rust-lang#111997
With this I think I covered all cases. Only thing missing at this point was a chapter covering re-exports in the rustdoc book.
r? `@notriddle`
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@GuillaumeGomez@rust-log-analyzer@notriddle@bors@matthiaskrgr@rustbot