about summary refs log tree commit diff
path: root/tests/mir-opt/otherwise_drops.rs
blob: c4bc05b593c8bd93ba6e26a618904066a3cc4b57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
//@ 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,
    }
}