mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 22:18:23 +03:00
58f8739d55
MIR dumped before/after the dummy `PreCodegen` pass should be identical to MIR dumped after the phase transition to `runtime-optimized`.
26 lines
546 B
Rust
26 lines
546 B
Rust
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
|
//@ test-mir-pass: GVN
|
|
//@ compile-flags: -Zmir-opt-level=1
|
|
|
|
trait NeedsDrop: Sized {
|
|
const NEEDS: bool = std::mem::needs_drop::<Self>();
|
|
}
|
|
|
|
impl<This> NeedsDrop for This {}
|
|
|
|
// EMIT_MIR control_flow_simplification.hello.GVN.diff
|
|
// EMIT_MIR control_flow_simplification.hello.runtime-optimized.after.mir
|
|
fn hello<T>() {
|
|
// CHECK-LABEL: fn hello(
|
|
// CHECK: bb0:
|
|
// CHECK-NEXT: return;
|
|
if <bool>::NEEDS {
|
|
panic!()
|
|
}
|
|
}
|
|
|
|
pub fn main() {
|
|
hello::<()>();
|
|
hello::<Vec<()>>();
|
|
}
|