2 // Issue #2005: Check that boxed fixed-size arrays are properly
3 // accounted for (namely, only deallocated if they were actually
4 // created) when they appear as temporaries in unused arms of a match
7 pub fn foo(box_1: fn () -> Box<[i8; 1]>,
8 box_2: fn () -> Box<[i8; 20]>,
9 box_3: fn () -> Box<[i8; 300]>,
10 box_4: fn () -> Box<[i8; 4000]>,
12 println!("Hello World 1");
13 let _: Box<[i8]> = match 3 {
19 println!("Hello World 2");
23 fn box_1() -> Box<[i8; 1]> { Box::new( [1] ) }
24 fn box_2() -> Box<[i8; 20]> { Box::new( [1; 20] ) }
25 fn box_3() -> Box<[i8; 300]> { Box::new( [1; 300] ) }
26 fn box_4() -> Box<[i8; 4000]> { Box::new( [1; 4000] ) }
28 foo(box_1, box_2, box_3, box_4);