rust/tests/mir-opt/otherwise_drops.rs
2025-07-08 18:15:05 -05:00

14 lines
342 B
Rust

//@ compile-flags: -C panic=abort
//@ test-mir-pass: ElaborateDrops
// Ensures there are no drops for the wildcard match arm.
// EMIT_MIR otherwise_drops.result_ok.ElaborateDrops.diff
fn result_ok(result: Result<String, ()>) -> Option<String> {
// CHECK-NOT: drop
match result {
Ok(s) => Some(s),
_ => None,
}
}