Why some struct does not need a path or use

Can some one explain me why some struct, like Box or AsRef can be use without a path or a use directive ? Bref why can I write this and does not get a compiler error

fn main() ->
    let x = Box::new(1);

But this does not work

fn main() -> {
    let p = Path::new("/something");

This really bug me for days and I can't find any response anywhere.

Some common types and traits are included in what is called the prelude. It's also mentionned briefly at the start of the book here.

1 Like

Thanks I look into it.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.