News for hackers. Stuff that matters.
Re:What's a reference in Rust? by jmite on Wednesday November 29, 2017 @02:53AM (#15805327)
No, I think the article is right. When a value goes out of scope, its drop method is called, which for Box values deallocates it.

The trick is that if it is (possibly) returned from a function, it is moved instead of dropped.

It's also important to distinguish Box from Rc. Both are heap values but have very different behavior.

Re:What's a reference in Rust? by crispweed on Wednesday November 29, 2017 @03:04AM (#15805378)
The text I quoted seemed to suggest that the reference going out of scope could trigger deallocation.
Re:What's a reference in Rust? by Manishearth on Wednesday November 29, 2017 @05:31PM (#15811522)
Which is true.

The word "reference" is overloaded, it can be used to mean "anything pointery that's guaranteed to exist" too. Box<T> in this context is a reference.

The post does kind of dance between definitions of "reference" a bit, but I think that's intentional.