mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 18:23:49 +00:00
17 lines
381 B
Rust
17 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));
|
|
}
|