2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2015-05-20 04:06:38 -05:00
|
|
|
// 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
|
2018-01-28 17:59:34 -06:00
|
|
|
// instead of as a place.
|
2015-05-20 04:06:38 -05:00
|
|
|
|
|
|
|
fn test(foo: bool) -> u8 {
|
|
|
|
match foo {
|
|
|
|
true => *Box::new(9),
|
|
|
|
false => 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
assert_eq!(9, test(true));
|
|
|
|
}
|