We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent df20355 commit 2d74528Copy full SHA for 2d74528
library/core/src/intrinsics.rs
@@ -991,6 +991,12 @@ extern "rust-intrinsic" {
991
/// let ptr_num_cast = ptr as *const i32 as usize;
992
/// ```
993
///
994
+ /// Note that using `transmute` to turn a pointer to a `usize` is (as noted above) [undefined
995
+ /// behavior][ub] in `const` contexts. Also outside of consts, this operation might not behave
996
+ /// as expected -- this is touching on many unspecified aspects of the Rust memory model. To
997
+ /// make sure your code is well-defined, the conversion of pointers to integers and back should
998
+ /// always be done explicitly via casts.
999
+ ///
1000
/// Turning a `*mut T` into an `&mut T`:
1001
1002
0 commit comments