Skip to content

rustdoc: Document #[repr(transparent)] for rustc_pub_transparent - #150931

Closed
clubby789 wants to merge 1 commit into
rust-lang:mainfrom
clubby789:doc-rustc-pub-transparent
Closed

rustdoc: Document #[repr(transparent)] for rustc_pub_transparent#150931
clubby789 wants to merge 1 commit into
rust-lang:mainfrom
clubby789:doc-rustc-pub-transparent

Conversation

@clubby789

@clubby789 clubby789 commented Jan 10, 2026

Copy link
Copy Markdown
Contributor

Fixes #150919

@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 Jan 10, 2026
@rustbot

rustbot commented Jan 10, 2026

Copy link
Copy Markdown
Collaborator

r? @GuillaumeGomez

rustbot has assigned @GuillaumeGomez.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@JonathanBrouwer JonathanBrouwer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Was also taking a look at the issue already and had half of the same code written :)
Looks good to me

View changes since this review

// – in case all fields are 1-ZST fields — at least one field is public and visible.
let is_public = 'is_public: {
// `#[rustc_pub_transparent]`
if find_attr!(tcx.get_all_attrs(def_id), AttributeKind::PubTransparent(_)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That goes against what the comment just above is describing.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I didn't mean to change the comment, I meant that it was the expected behaviour. If you want to change it, gonna need to talk with the rustdoc team first. ^^'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh right. This behaviour seems reaonable to me, since it reflects the description of used internally to mark types with a "transparent" representation when it is guaranteed by the documentation

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That guarantee is in the prose of each type's docs, however - not from publicising the repr attribute.

@clubby789
clubby789 force-pushed the doc-rustc-pub-transparent branch from 8bff0dc to 1256a9a Compare January 10, 2026 17:52
@rust-bors

rust-bors Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #160047) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

@clubby789 clubby789 closed this Jul 28, 2026
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

#[rustc_pub_transparent] does not shows up as #[repr(transparent)] in docs

6 participants