Closed
Description
Spawned off of #20055 (and PR #21692 )
I thought I fixed this and wrote a test for it in PR #21692, but I was wrong -- the test for Box<Trait>
was erroneous/incomplete at best.
Test case:
trait Boo { }
impl Boo for [i8; 1] { }
impl Boo for [i8; 2] { }
impl Boo for [i8; 3] { }
impl Boo for [i8; 4] { }
pub fn foo(box_1: fn () -> Box<[i8; 1]>,
box_2: fn () -> Box<[i8; 2]>,
box_3: fn () -> Box<[i8; 3]>,
box_4: fn () -> Box<[i8; 4]>,
) {
let _b: Box<Boo> = match 3 {
1 => box_1(),
2 => box_2(),
3 => box_3(),
_ => box_4(),
};
}
pub fn main() {
fn box_1() -> Box<[i8; 1]> { Box::new( [1i8; 1] ) }
fn box_2() -> Box<[i8; 2]> { Box::new( [1i8; 2] ) }
fn box_3() -> Box<[i8; 3]> { Box::new( [1i8; 3] ) }
fn box_4() -> Box<[i8; 4]> { Box::new( [1i8; 4] ) }
println!("Hello World 1");
foo(box_1, box_2, box_3, box_4);
println!("Hello World 2");
}
In the playpen, this currently prints:
Hello World 1
playpen: application terminated abnormally with signal 4 (Illegal instruction)