1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // Issue #2005: Check that boxed fixed-size arrays are properly
12 // accounted for (namely, only deallocated if they were actually
13 // created) when they appear as temporaries in unused arms of a match
16 pub fn foo(box_1
: fn () -> Box
<[i8; 1]>,
17 box_2
: fn () -> Box
<[i8; 20]>,
18 box_3
: fn () -> Box
<[i8; 300]>,
19 box_4
: fn () -> Box
<[i8; 4000]>,
21 println
!("Hello World 1");
22 let _
: Box
<[i8]> = match 3 {
28 println
!("Hello World 2");
32 fn box_1() -> Box
<[i8; 1]> { Box::new( [1] ) }
33 fn box_2() -> Box
<[i8; 20]> { Box::new( [1; 20] ) }
34 fn box_3() -> Box
<[i8; 300]> { Box::new( [1; 300] ) }
35 fn box_4() -> Box
<[i8; 4000]> { Box::new( [1; 4000] ) }
37 foo(box_1
, box_2
, box_3
, box_4
);