Closed
Description
Consider this code:
fn main() {
use std::boxed;
let boxed::Box(..) = boxed::Box::new("Hello");
}
on the playpen, it yields the error:
rustc 1.16.0-nightly (4ecc85beb 2016-12-28)
error[E0308]: mismatched types
--> <anon>:3:9
|
3 | let boxed::Box(..) = boxed::Box::new("Hello");
| ^^^^^^^^^^^^^^ expected box, found struct `std::boxed::Box`
|
= note: expected type `Box<&str>`
= note: found type `std::boxed::Box<_>`
error: aborting due to previous error
This is probably an artifact of how we partially treat Boxes as a built-in language feature within the compiler. Nonetheless, we could do better with the message here.