diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2023-08-15 10:10:35 +0200 |
|---|---|---|
| committer | León Orell Valerian Liehr <me@fmease.dev> | 2023-09-18 19:30:10 +0200 |
| commit | 64fa12a4fb1447e3368ae2cd08cf75ea576997ea (patch) | |
| tree | 3466dd26ba23f85690b56604d89b7b54af3f77e4 /tests/rustdoc/repr.rs | |
| parent | cbcf9a5368c0d8b6d0b5784201471475cb3496a3 (diff) | |
| download | rust-64fa12a4fb1447e3368ae2cd08cf75ea576997ea.tar.gz rust-64fa12a4fb1447e3368ae2cd08cf75ea576997ea.zip | |
rustdoc: hide repr(transparent) if it isn't part of the public ABI
Diffstat (limited to 'tests/rustdoc/repr.rs')
| -rw-r--r-- | tests/rustdoc/repr.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/rustdoc/repr.rs b/tests/rustdoc/repr.rs new file mode 100644 index 00000000000..fbb46e126ba --- /dev/null +++ b/tests/rustdoc/repr.rs @@ -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 |
