mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-12 18:07:40 +00:00

We already did `Transmute`-then-`PtrToPtr`; this adds the nearly-identical `PtrToPtr`-then-`Transmute`. It also adds `transmute(Foo(x))` → `transmute(x)`, when `Foo` is a single-field transparent type. That's useful for things like `NonNull { pointer: p }.as_ptr()`. Found these as I was looking at MCP807-related changes.
31 lines
829 B
Diff
31 lines
829 B
Diff
- // MIR for `keep_transparent_transmute` before InstSimplify-after-simplifycfg
|
|
+ // MIR for `keep_transparent_transmute` after InstSimplify-after-simplifycfg
|
|
|
|
fn keep_transparent_transmute() -> () {
|
|
let mut _0: ();
|
|
let _1: i16;
|
|
let mut _3: std::num::Wrapping<i16>;
|
|
scope 1 {
|
|
debug _a => _1;
|
|
let _2: i16;
|
|
scope 2 {
|
|
debug _a => _2;
|
|
}
|
|
}
|
|
|
|
bb0: {
|
|
StorageLive(_1);
|
|
_1 = const keep_transparent_transmute::{constant#0} as i16 (Transmute);
|
|
StorageLive(_2);
|
|
StorageLive(_3);
|
|
_3 = Wrapping::<i16>(const 0_i16);
|
|
_2 = move _3 as i16 (Transmute);
|
|
StorageDead(_3);
|
|
_0 = const ();
|
|
StorageDead(_2);
|
|
StorageDead(_1);
|
|
return;
|
|
}
|
|
}
|
|
|