@@ -1186,7 +1186,7 @@ extern "rust-intrinsic" {
1186
1186
///
1187
1187
/// Transmuting *pointers to integers* in a `const` context is [undefined behavior][ub], unless
1188
1188
/// the pointer was originally created *from* an integer. (That includes this function
1189
- /// specifically, integer-to-pointer casts, and helpers like [`invalid `][crate::ptr::dangling],
1189
+ /// specifically, integer-to-pointer casts, and helpers like [`dangling `][crate::ptr::dangling],
1190
1190
/// but also semantically-equivalent conversions such as punning through `repr(C)` union
1191
1191
/// fields.) Any attempt to use the resulting value for integer operations will abort
1192
1192
/// const-evaluation. (And even outside `const`, such transmutation is touching on many
@@ -1206,7 +1206,11 @@ extern "rust-intrinsic" {
1206
1206
/// In particular, doing a pointer-to-integer-to-pointer roundtrip via `transmute` is *not* a
1207
1207
/// lossless process. If you want to round-trip a pointer through an integer in a way that you
1208
1208
/// can get back the original pointer, you need to use `as` casts, or replace the integer type
1209
- /// by `MaybeUninit<$int>` (and never call `assume_init()`).
1209
+ /// by `MaybeUninit<$int>` (and never call `assume_init()`). If you are looking for a way to
1210
+ /// store data of arbitrary type, also use `MaybeUninit<T>` (that will also handle uninitialized
1211
+ /// memory due to padding). If you specifically need to store something that is "either an
1212
+ /// integer or a pointer", use `*mut ()`: integers can be converted to pointers and back without
1213
+ /// any loss (via `as` casts or via `transmute`).
1210
1214
///
1211
1215
/// # Examples
1212
1216
///
0 commit comments