Skip to content

Inaccuracy in 15-1 #606

@djzin

Description

@djzin

Because a Box<T> is a pointer, we always know how much space it needs: a
pointer takes up a usize amount of space.

since a box always has the size of a usize, no matter what it's pointing to

These are false statements. For example,

assert_eq!(std::mem::size_of::<Box<str>>(), std::mem::size_of::<usize>() * 2);
assert_eq!(std::mem::size_of::<Box<ToString>>(), std::mem::size_of::<usize>() * 2);

It would be nice to clarify this (maybe in a footnote) whilst keeping it simple for purposes of the example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions