From 04d2bd0b3e6a5b0ceb04fa855701a0f1bdbc1932 Mon Sep 17 00:00:00 2001 From: Joshua Liebow-Feeser Date: Tue, 22 Oct 2024 17:27:39 -0700 Subject: [PATCH] Define raw pointer transmute behavior --- src/expressions/operator-expr.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/expressions/operator-expr.md b/src/expressions/operator-expr.md index a9e91f0a6..5988ab697 100644 --- a/src/expressions/operator-expr.md +++ b/src/expressions/operator-expr.md @@ -489,6 +489,10 @@ assert_eq!(values[1], 3); such as `struct Foo(i32, [u8])` or `(u64, Foo)`. - 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. +For any `*const T` / `*mut T` to `*const U` / `*mut U` cast which is well-defined as described +in this section, `core::mem::transmute<*const T, *const U>` / `core::mem::transmute<*mut T, *mut U>` +has the same behavior as the corresponding cast. + ## Assignment expressions > **Syntax**\