File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -1212,8 +1212,8 @@ extern "rust-intrinsic" {
1212
1212
/// `transmute` is semantically equivalent to a bitwise move of one type
1213
1213
/// into another. It copies the bits from the source value into the
1214
1214
/// 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`.
1217
1217
///
1218
1218
/// Both the argument and the result must be [valid](../../nomicon/what-unsafe-does.html) at
1219
1219
/// their given type. Violating this condition leads to [undefined behavior][ub]. The compiler
@@ -1225,6 +1225,8 @@ extern "rust-intrinsic" {
1225
1225
///
1226
1226
/// Transmuting pointers to integers in a `const` context is [undefined behavior][ub].
1227
1227
/// 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.)
1228
1230
///
1229
1231
/// Because `transmute` is a by-value operation, alignment of the *transmuted values
1230
1232
/// themselves* is not a concern. As with any other function, the compiler already ensures
You can’t perform that action at this time.
0 commit comments