mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 11:44:28 +00:00
23 lines
487 B
Rust
23 lines
487 B
Rust
// ignore-wasm32 compiled with panic=abort by default
|
|
// unit-test: ConstProp
|
|
// 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.ConstProp.diff
|
|
// EMIT_MIR control_flow_simplification.hello.PreCodegen.before.mir
|
|
fn hello<T>(){
|
|
if <bool>::NEEDS {
|
|
panic!()
|
|
}
|
|
}
|
|
|
|
pub fn main() {
|
|
hello::<()>();
|
|
hello::<Vec<()>>();
|
|
}
|