If I Box::new
a value, take a pointer to it (the borrow checker won't allow to take a reference, since I'm about to move the box), and then move the Box
, can a move of the value (e.g. a reallocation) happen?
I thought that Box
just stores the values address, so that moving the Box
would only move the address. Is there therefore a reason why borrow checker prohibits moving it when its contents are immutably borrowed?