diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2023-02-24 18:32:52 -0800 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2023-03-22 15:15:41 -0700 |
| commit | 64cce5fc7d2c1070adeaa719932b4bbccf27dd46 (patch) | |
| tree | 918975145ee82f7777d722aedea9cc75f218dcce /library/core/src | |
| parent | a266f11990d9544ee408e213e1eec8cc9eb032b7 (diff) | |
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.
Diffstat (limited to 'library/core/src')
| -rw-r--r-- | library/core/src/intrinsics/mir.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/library/core/src/intrinsics/mir.rs b/library/core/src/intrinsics/mir.rs index 64fc1c0c277..9fb0c3e2611 100644 --- a/library/core/src/intrinsics/mir.rs +++ b/library/core/src/intrinsics/mir.rs @@ -330,6 +330,14 @@ define!( fn Variant<T>(place: T, index: u32) -> () ); define!( + "mir_cast_transmute", + /// Emits a `CastKind::Transmute` cast. + /// + /// Needed to test the UB when `sizeof(T) != sizeof(U)`, which can't be + /// generated via the normal `mem::transmute`. + fn CastTransmute<T, U>(operand: T) -> U +); +define!( "mir_make_place", #[doc(hidden)] fn __internal_make_place<T>(place: T) -> *mut T |
