Closed
Description
This explicit cast does not work:
fn main() {
let x = Box::new([1, 2, 3]);
let y = x as Box<[i32]>;
println!("y: {:?}", y);
}
However, this implicit coercion does work:
fn main() {
let x = Box::new([1, 2, 3]);
let y: Box<[i32]> = x;
println!("y: {:?}", y);
}
It is unfortunate, because I would like the overloaded-box inference to work for expr as Box<[T]>
in the same manner that it does for expr as Box<Trait>
.