Skip to content

Conversation

fmease
Copy link
Member

@fmease fmease commented Sep 13, 2025

Split out from PR #116882. See individual commits and self review comments for details.

r? GuillaumeGomez

These functions used to be shared with the JSON backend but nowadays they
aren't.
@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. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Sep 13, 2025
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was added recently in PR #144050 even tho we already had one for IXCRE'd attrs: inline_cross/attributes.rs added by me.

Moreover it redundantly tested #[repr] here: We already have inline_cross/repr.rs for that (separate bc it's a lot more complex esp. due to the priv/pub heuristic).

Escape "special characters" (e.g., double quotes `"` and line breaks `\n`).
Escape HTML.

Lastly, add regression tests and clean up existing tests.
@fmease fmease force-pushed the rustdoc-mv-html-attr-rend branch from 360b580 to d7d7725 Compare September 25, 2025 09:32
@GuillaumeGomez
Copy link
Member

Looks good to me, thanks!

Do you mind if we wait for #138907 to be merged first so I don't have to fix merge conflict again? 😅

@fmease fmease added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 25, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 25, 2025
…pr-heuristic, r=rustdoc

rustdoc: hide `#[repr]` if it isn't part of the public ABI

> [!IMPORTANT]
> Temporarily stacked on top of PR rust-lang#146527; only the last commit is relevant!

Follow-up to rust-lang#115439.
Unblocks rust-lang#116743, CC `@dtolnay.`

Fixes rust-lang#66401.
Fixes rust-lang#128364.
Fixes rust-lang#137440.

Only display the representation `#[repr(REPR)]` (where `REPR` is not `Rust` or `transparent`) of a given type if none of its variants (incl. the synthetic variants of structs) are `#[doc(hidden)]` and all of its fields are public and not `#[doc(hidden)]` since it's likely not meant to be considered part of the public ABI otherwise.

`--document-{private,hidden}-items` works as expected in this context, too.

Moreover, we now also factor in the presence of `#[doc(hidden)]` when checking whether to show `repr(transparent)` or not.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 25, 2025
…pr-heuristic, r=rustdoc

rustdoc: hide `#[repr]` if it isn't part of the public ABI

> [!IMPORTANT]
> Temporarily stacked on top of PR rust-lang#146527; only the last commit is relevant!

Follow-up to rust-lang#115439.
Unblocks rust-lang#116743, CC ``@dtolnay.``

Fixes rust-lang#66401.
Fixes rust-lang#128364.
Fixes rust-lang#137440.

Only display the representation `#[repr(REPR)]` (where `REPR` is not `Rust` or `transparent`) of a given type if none of its variants (incl. the synthetic variants of structs) are `#[doc(hidden)]` and all of its fields are public and not `#[doc(hidden)]` since it's likely not meant to be considered part of the public ABI otherwise.

`--document-{private,hidden}-items` works as expected in this context, too.

Moreover, we now also factor in the presence of `#[doc(hidden)]` when checking whether to show `repr(transparent)` or not.
@bors bors merged commit d7d7725 into rust-lang:master Sep 25, 2025
10 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Sep 25, 2025
rust-timer added a commit that referenced this pull request Sep 25, 2025
Rollup merge of #116882 - fmease:rustdoc-generalized-priv-repr-heuristic, r=rustdoc

rustdoc: hide `#[repr]` if it isn't part of the public ABI

> [!IMPORTANT]
> Temporarily stacked on top of PR #146527; only the last commit is relevant!

Follow-up to #115439.
Unblocks #116743, CC ``@dtolnay.``

Fixes #66401.
Fixes #128364.
Fixes #137440.

Only display the representation `#[repr(REPR)]` (where `REPR` is not `Rust` or `transparent`) of a given type if none of its variants (incl. the synthetic variants of structs) are `#[doc(hidden)]` and all of its fields are public and not `#[doc(hidden)]` since it's likely not meant to be considered part of the public ABI otherwise.

`--document-{private,hidden}-items` works as expected in this context, too.

Moreover, we now also factor in the presence of `#[doc(hidden)]` when checking whether to show `repr(transparent)` or not.
@fmease fmease deleted the rustdoc-mv-html-attr-rend branch September 26, 2025 02:18
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Sep 26, 2025
…tic, r=rustdoc

rustdoc: hide `#[repr]` if it isn't part of the public ABI

> [!IMPORTANT]
> Temporarily stacked on top of PR rust-lang/rust#146527; only the last commit is relevant!

Follow-up to rust-lang/rust#115439.
Unblocks rust-lang/rust#116743, CC ``@dtolnay.``

Fixes rust-lang/rust#66401.
Fixes rust-lang/rust#128364.
Fixes rust-lang/rust#137440.

Only display the representation `#[repr(REPR)]` (where `REPR` is not `Rust` or `transparent`) of a given type if none of its variants (incl. the synthetic variants of structs) are `#[doc(hidden)]` and all of its fields are public and not `#[doc(hidden)]` since it's likely not meant to be considered part of the public ABI otherwise.

`--document-{private,hidden}-items` works as expected in this context, too.

Moreover, we now also factor in the presence of `#[doc(hidden)]` when checking whether to show `repr(transparent)` or not.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-blocked Status: Blocked on something else such as an RFC or other implementation work. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants