Skip to content

Commit 7b6cefe

Browse files
authored
Merge pull request #2271 from rkruppe/transparent-vs-align
Amend RFC 1758 (repr(transparent)) w.r.t. repr(align)
2 parents 743efe4 + f07f949 commit 7b6cefe

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

text/1758-repr-transparent.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,14 @@ have the same representation as their underlying types.
117117

118118
[RFC 1649]: https://github.com/rust-lang/rfcs/pull/1649
119119

120-
This new representation cannot be used with any other representation attribute
121-
but alignment, to be able to specify a transparent wrapper with additional
122-
alignment constraints:
120+
This new representation cannot be used with any other representation attribute:
123121

124122
```rust
125123
#[repr(transparent, align = "128")]
126-
struct OverAligned(f64); // Behaves as a bare f64 with 128 bits alignment.
124+
struct BogusAlign(f64); // Error, must be aligned like the underlying type.
127125

128126
#[repr(C, transparent)]
129-
struct BogusRepr(f64); // Nonsensical, repr cannot be C and transparent.
127+
struct BogusRepr(f64); // Error, repr cannot be C and transparent.
130128
```
131129

132130
As a matter of optimisation, eligible `#[repr(Rust)]` structs behave as if

0 commit comments

Comments
 (0)