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 re-export of doc hidden macro not showing up #111997

Merged
merged 3 commits into from
May 27, 2023

Conversation

GuillaumeGomez
Copy link
Member

It's part of the follow-up of #109697.

Re-exports of doc hidden macros should be visible. It was the only kind of re-export of doc hidden item that didn't show up.

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 May 26, 2023
@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez
Copy link
Member Author

Interestingly enough, bang macros need to be handled a bit differently otherwise you can't re-export the same one with two different names in the same module. How strange.

@rust-log-analyzer

This comment has been minimized.

@notriddle
Copy link
Contributor

If a #[doc(hidden)] item is re-exported, then should it be displayed?

That was under consideration in #109697, but the FCP never finished, and the issue was closed. Having re-exported #[doc(hidden)] items become visible was a problem for several use cases, such as glob re-exports and items with the same name but two different namespaces.

@GuillaumeGomez
Copy link
Member Author

They are not. If you have:

#[doc(hidden)]
pub struct Foo;

pub use crate::Foo as Bar;

Then you'll have in the documentation:

pub use crate::Foo as Bar;

But Bar isn't clickable (crate::Foo isn't either) and Foo is not generated in the documentation. No inlining. I think it's what we agreed upon? It's the current behaviour so no changes.

And I forgot to run fmt again... Fixing the CI quickly.

@GuillaumeGomez
Copy link
Member Author

GuillaumeGomez commented May 26, 2023

I need to precise one thing: if you add #[doc(inline)] on the re-export, then even if the item has #[doc(hidden)], it'll be inlined.

EDIT: But again, it's the current behaviour, didn't change anything in that regard. This PR is really just fixing a bug on re-export of bang macros.

@notriddle
Copy link
Contributor

But Bar isn't clickable (crate::Foo isn't either) and Foo is not generated in the documentation. No inlining. I think it's what we agreed upon? It's the current behaviour so no changes.

Ah, yes. That's what we agreed upon. Thanks for clarifying (I can see what you mean now from the test cases; it's just a good idea to be clear about it when writing here, too).

@bors r+ rollup

@bors
Copy link
Contributor

bors commented May 27, 2023

📌 Commit 898dfc6 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 May 27, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request May 27, 2023
…llaumeGomez

Rollup of 6 pull requests

Successful merges:

 - rust-lang#111936 (Include test suite metadata in the build metrics)
 - rust-lang#111952 (Remove DesugaringKind::Replace.)
 - rust-lang#111966 (Add #[inline] to array TryFrom impls)
 - rust-lang#111983 (Perform MIR type ops locally in new solver)
 - rust-lang#111997 (Fix re-export of doc hidden macro not showing up)
 - rust-lang#112014 (rustdoc: get unnormalized link destination for suggestions)

r? `@ghost`
`@rustbot` modify labels: rollup
@GuillaumeGomez
Copy link
Member Author

Ah, yes. That's what we agreed upon. Thanks for clarifying (I can see what you mean now from the test cases; it's just a good idea to be clear about it when writing here, too).

Absolutely! You did well to ask to clarify things. :)

@bors bors merged commit 480ac69 into rust-lang:master May 27, 2023
@rustbot rustbot added this to the 1.71.0 milestone May 27, 2023
@GuillaumeGomez GuillaumeGomez deleted the re-export-doc-hidden-macros branch May 27, 2023 16:41
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.

5 participants