Skip to content

Commit 1488266

Browse files
committed
Mention that FFI can lead to UB if values are uninit
1 parent 4c88177 commit 1488266

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
@@ -19,7 +19,7 @@ Making types like these `#[repr(transparent)]` would be useful in certain cases.
1919

2020
- Clearly expresses the intent of the developer.
2121
- Protects against accidental violations of that intent (e.g., adding a new variant or non-ZST field will result in a compiler error).
22-
- Makes a clear API guarantee that a `Wrapper<T>` can be transmuted to a `T` or substituted for a `T` in an FFI function's signature.
22+
- Makes a clear API guarantee that a `Wrapper<T>` can be transmuted to a `T` or substituted for a `T` in an FFI function's signature (though users must be careful to not pass uninitialized values through FFI to code where uninitialized values are undefined behavior (like C and C++)).
2323

2424
Transparent `union`s and univariant `enum`s are a nice complement to transparent `struct`s, and this RFC rounds out the `#[repr(transparent)]` feature.
2525

0 commit comments

Comments
 (0)