Skip to content

Commit 04d2bd0

Browse files
authored
Define raw pointer transmute behavior
1 parent 23ce619 commit 04d2bd0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/expressions/operator-expr.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,10 @@ assert_eq!(values[1], 3);
489489
such as `struct Foo(i32, [u8])` or `(u64, Foo)`.
490490
- If `T` is unsized and `U` is sized, the cast discards all metadata that completes the wide pointer `T` and produces a thin pointer `U` consisting of the data part of the unsized pointer.
491491

492+
For any `*const T` / `*mut T` to `*const U` / `*mut U` cast which is well-defined as described
493+
in this section, `core::mem::transmute<*const T, *const U>` / `core::mem::transmute<*mut T, *mut U>`
494+
has the same behavior as the corresponding cast.
495+
492496
## Assignment expressions
493497

494498
> **<sup>Syntax</sup>**\

0 commit comments

Comments
 (0)