Strange, if I run the following code on the Rust Playground,
use std::mem;
fn main() {
println!("size of pointer is {:?}", mem::size_of::<*const u8>());
println!("size of box is {:?}", mem::size_of::<Box<[u8; 10_000]>>());
}
I get
size of pointer is 8
size of box is 8
I'm printing the size of the pointer to show it's a 64bit platform. What's the difference between your example and mine?
A [u8; 10_000] array has a statically known size in the type, so we don't need to store the length anywhere. A [u8] has a dynamic length, so that's stored with the box pointer.