Skip to content

Commit da3e11f

Browse files
committed
wordsmithing
1 parent c4aca2b commit da3e11f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

library/core/src/intrinsics.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1212,8 +1212,8 @@ extern "rust-intrinsic" {
12121212
/// `transmute` is semantically equivalent to a bitwise move of one type
12131213
/// into another. It copies the bits from the source value into the
12141214
/// destination value, then forgets the original. Note that source and destination
1215-
/// are passed by-value, which means if `T` or `U` contains padding, that padding
1216-
/// might *not* be preserved by `transmute`.
1215+
/// are passed by-value, which means if `T` or `U` contain padding, that padding
1216+
/// is *not* guaranteed to be preserved by `transmute`.
12171217
///
12181218
/// Both the argument and the result must be [valid](../../nomicon/what-unsafe-does.html) at
12191219
/// their given type. Violating this condition leads to [undefined behavior][ub]. The compiler
@@ -1225,6 +1225,8 @@ extern "rust-intrinsic" {
12251225
///
12261226
/// Transmuting pointers to integers in a `const` context is [undefined behavior][ub].
12271227
/// Any attempt to use the resulting value for integer operations will abort const-evaluation.
1228+
/// (And even outside `const`, such transmutation is touching on many unspecified aspects of the
1229+
/// Rust memory model and should be avoided. See below for alternatives.)
12281230
///
12291231
/// Because `transmute` is a by-value operation, alignment of the *transmuted values
12301232
/// themselves* is not a concern. As with any other function, the compiler already ensures

0 commit comments

Comments
 (0)