|
|
|
|
|
by steveklabnik
4086 days ago
|
|
I mean in Rust. > That is, I had thought the memory was on the heap An example: let x = Box::new(5);
let y = x;
While the 5 is allocated on the heap, when we move x to y, _the pointer itself_ is memcpy'd. That's why Box<T> isn't Copy; as you say, a simple memcpy won't actually duplicate the structure. Make sense?(and in this case, I'd assume llvm's optimizations would realize the copy is superflous and just elide it, but semantically, that's what's up) |
|