mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
16 lines
381 B
Rust
16 lines
381 B
Rust
//@ run-pass
|
|
// This used to generate invalid IR in that even if we took the
|
|
// `false` branch we'd still try to free the Box from the other
|
|
// arm. This was due to treating `*Box::new(9)` as an rvalue datum
|
|
// instead of as a place.
|
|
|
|
fn test(foo: bool) -> u8 {
|
|
match foo {
|
|
true => *Box::new(9),
|
|
false => 0
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
assert_eq!(9, test(true));
|
|
}
|