-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #115439 - fmease:rustdoc-priv-repr-transparent-heuris…
…tic, r=GuillaumeGomez rustdoc: hide `#[repr(transparent)]` if it isn't part of the public ABI Fixes #90435. This hides `#[repr(transparent)]` when the non-1-ZST field the struct is "transparent" over is private. CC `@RalfJung` Tentatively nominating it for the release notes, feel free to remove the nomination. `@rustbot` label needs-fcp relnotes A-rustdoc-ui
- Loading branch information
Showing
10 changed files
with
152 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// aux-crate:attributes=attributes.rs | ||
// edition:2021 | ||
#![crate_name = "user"] | ||
|
||
// @has 'user/struct.NonExhaustive.html' | ||
// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[non_exhaustive]' | ||
pub use attributes::NonExhaustive; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#[non_exhaustive] | ||
pub struct NonExhaustive; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Regression test for <https://github.com/rust-lang/rust/issues/90435>. | ||
// Check that we show `#[repr(transparent)]` iff the non-1-ZST field is public or at least one | ||
// field is public in case all fields are 1-ZST fields. | ||
|
||
// @has 'repr/struct.ReprTransparentPrivField.html' | ||
// @!has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]' | ||
#[repr(transparent)] // private | ||
pub struct ReprTransparentPrivField { | ||
field: u32, // non-1-ZST field | ||
} | ||
|
||
// @has 'repr/struct.ReprTransparentPriv1ZstFields.html' | ||
// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]' | ||
#[repr(transparent)] // public | ||
pub struct ReprTransparentPriv1ZstFields { | ||
marker0: Marker, | ||
pub main: u64, // non-1-ZST field | ||
marker1: Marker, | ||
} | ||
|
||
// @has 'repr/struct.ReprTransparentPub1ZstField.html' | ||
// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]' | ||
#[repr(transparent)] // public | ||
pub struct ReprTransparentPub1ZstField { | ||
marker0: Marker, | ||
pub marker1: Marker, | ||
} | ||
|
||
struct Marker; // 1-ZST |