Skip to content

Fix re-export of doc hidden macro not showing up - #111997

Merged
bors merged 3 commits into
rust-lang:masterfrom
GuillaumeGomez:re-export-doc-hidden-macros
May 27, 2023
Merged

Fix re-export of doc hidden macro not showing up#111997
bors merged 3 commits into
rust-lang:masterfrom
GuillaumeGomez:re-export-doc-hidden-macros

Conversation

@GuillaumeGomez

Copy link
Copy Markdown
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

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

This comment has been minimized.

@GuillaumeGomez

Copy link
Copy Markdown
MemberAuthor

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
Copy Markdown
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
Copy Markdown
MemberAuthor

They are not. If you have:

#[doc(hidden)]pubstructFoo;pubusecrate::FooasBar;

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
GuillaumeGomezforce-pushed the re-export-doc-hidden-macros branch from e313bf2 to 898dfc6CompareMay 26, 2023 22:25
@GuillaumeGomez

GuillaumeGomez commented May 26, 2023

Copy link
Copy Markdown
MemberAuthor

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
Copy Markdown
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

bors commented May 27, 2023

Copy link
Copy Markdown
Collaborator

📌 Commit 898dfc6 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 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
Copy Markdown
MemberAuthor

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:masterMay 27, 2023
@rustbotrustbot 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
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.

5 participants

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