You are right that the compiler needs to ensure no pointers escape the struct itself, so it is OK to move it (and all the pointers it includes). Intuitively this would require another level of static type checking (whether there are existing outside-the-struct borrowed pointers at any point), probably not easy to do.
On Wed, Nov 13, 2013 at 6:08 PM, Niko Matsakis <n...@alum.mit.edu> wrote: > > I don't know how to make that sound, unfortunately, other than using > > an arena and allocating all the nodes into it (losing the ability to > > deallocate individual nodes). > > Arenas don't require that you lose the ability to deallocate > individual nodes. See my thoughts in #10444. Briefly, the idea is that > the arena allocation returns an affine type like `ArenaAlloc<'self>`. > You can then have a free method that consumes this instance and adds > it to a free list to be reused for future allocation. > > > > > Niko > _______________________________________________ > Rust-dev mailing list > Rust-dev@mozilla.org > https://mail.mozilla.org/listinfo/rust-dev >
_______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev