Remix.run Logo
wavemode 4 days ago

An &own reference seems like it would just be equivalent to a Box.

steveklabnik 4 days ago | parent [-]

Box heap allocates, references do not.

wavemode 4 days ago | parent [-]

> `&own` references that take ownership of the object and free it when the reference goes out of scope

How can you free something if it's not allocated

steveklabnik 4 days ago | parent [-]

Sorry, yeah that phrasing was bad: I kinda think an "owning reference" is a contradiction in terms but I didn't come up with the idea.

What I meant was, creating a box creates a new allocation, whereas my understanding of &own would take over an existing allocation.