]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-18845.rs
Merge commit '6ed6f1e6a1a8f414ba7e6d9b8222e7e5a1686e42' into clippyup
[rust.git] / src / test / ui / issues / issue-18845.rs
1 // run-pass
2 // This used to generate invalid IR in that even if we took the
3 // `false` branch we'd still try to free the Box from the other
4 // arm. This was due to treating `*Box::new(9)` as an rvalue datum
5 // instead of as a place.
6
7 fn test(foo: bool) -> u8 {
8     match foo {
9         true => *Box::new(9),
10         false => 0
11     }
12 }
13
14 fn main() {
15     assert_eq!(9, test(true));
16 }