Skip to content

Commit f982d75

Browse files
committed
Add CastKind::Transmute to MIR
Updates `interpret`, `codegen_ssa`, and `codegen_cranelift` to consume the new cast instead of the intrinsic. Includes `CastTransmute` for custom MIR building, to be able to test the extra UB.
1 parent 4fd4e68 commit f982d75

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

core/src/intrinsics/mir.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,14 @@ define!(
329329
/// See [`Field`] for documentation.
330330
fn Variant<T>(place: T, index: u32) -> ()
331331
);
332+
define!(
333+
"mir_cast_transmute",
334+
/// Emits a `CastKind::Transmute` cast.
335+
///
336+
/// Needed to test the UB when `sizeof(T) != sizeof(U)`, which can't be
337+
/// generated via the normal `mem::transmute`.
338+
fn CastTransmute<T, U>(operand: T) -> U
339+
);
332340
define!(
333341
"mir_make_place",
334342
#[doc(hidden)]

0 commit comments

Comments
 (0)