Skip to content

Commit ce8b569

Browse files
Centrilmjbshaw
andauthored
Fix typo: union -> enum
Co-Authored-By: mjbshaw <github@mjb.io>
1 parent 4c88177 commit ce8b569

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

text/0000-transparent-unions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Like transarent `struct`s, a transparent `union` of type `U` and transparent `en
135135

136136
Like transparent `struct`s, transparent `union`s and `enum`s are FFI-safe if and only if their underlying representation type is also FFI-safe.
137137

138-
A `union` may not be eligible for the same nonnull-style optimizations that a `struct` or `union` (with the same fields) are eligible for. Adding `#[repr(transparent)]` to `union` does not change this. To give a more concrete example, it is unspecified whether `size_of::<T>()` is equal to `size_of::<Option<T>>()`, where `T` is a `union` (regardless of whether it is transparent). The Rust compiler is free to perform this optimization if possible, but is not required to, and different compiler versions may differ in their application of these optimizations.
138+
A `union` may not be eligible for the same nonnull-style optimizations that a `struct` or `enum` (with the same fields) are eligible for. Adding `#[repr(transparent)]` to `union` does not change this. To give a more concrete example, it is unspecified whether `size_of::<T>()` is equal to `size_of::<Option<T>>()`, where `T` is a `union` (regardless of whether it is transparent). The Rust compiler is free to perform this optimization if possible, but is not required to, and different compiler versions may differ in their application of these optimizations.
139139

140140
# Drawbacks
141141
[drawbacks]: #drawbacks

0 commit comments

Comments
 (0)