Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

GuillaumeGomez
Copy link
Member

This fixes this bug:

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

@rustbot rustbot 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
@GuillaumeGomez GuillaumeGomez changed the title Fix inline private intermediate Fix bug where private item with intermediate doc hidden re-export was not inlined Jun 1, 2023
@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez
Copy link
Member Author

GuillaumeGomez commented Jun 1, 2023

Fixed CI.

@GuillaumeGomez GuillaumeGomez force-pushed the fix-inline-private-intermediate branch from ca8a476 to d029800 Compare June 3, 2023 17:57
@GuillaumeGomez
Copy link
Member Author

Applied suggestion.

@notriddle
Copy link
Contributor

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jun 3, 2023

📌 Commit d029800 has been approved by notriddle

It is now in the queue for this repository.

@bors bors 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
Member

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

@bors bors 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
Member

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

@bors
Copy link
Contributor

bors commented Jun 4, 2023

📌 Commit d029800 has been approved by notriddle

It is now in the queue for this repository.

@bors bors 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:master Jun 4, 2023
@rustbot rustbot 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

Fixes rust-lang#109449.
Fixes rust-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 free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant 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