Skip to content

Commit 9832e13

Browse files
committed
Auto merge of rust-lang#108442 - scottmcm:mir-transmute, r=oli-obk
Add `CastKind::Transmute` to MIR ~~Nothing actually produces it in this commit, so I don't know how to test it, but it also means it shouldn't be possible for it to break anything.~~ Includes lowering `transmute` calls to it, so it's used. Zulip Conversation: <https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/Good.20first.20isssue/near/321849610>
2 parents 6b6c91c + f982d75 commit 9832e13

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
@@ -343,6 +343,14 @@ define!(
343343
/// See [`Field`] for documentation.
344344
fn Variant<T>(place: T, index: u32) -> ()
345345
);
346+
define!(
347+
"mir_cast_transmute",
348+
/// Emits a `CastKind::Transmute` cast.
349+
///
350+
/// Needed to test the UB when `sizeof(T) != sizeof(U)`, which can't be
351+
/// generated via the normal `mem::transmute`.
352+
fn CastTransmute<T, U>(operand: T) -> U
353+
);
346354
define!(
347355
"mir_make_place",
348356
#[doc(hidden)]

0 commit comments

Comments
 (0)