2 ms·
> But I don't need destructors, or at least ones that can see these references, so it's frustrating. If you bound it so that it only accepts Copy types, then y
by steveklabnik 9y ago
> But I don't need destructors, or at least ones that can see these references, so it's frustrating.
If you bound it so that it only accepts Copy types, then you can know there are no destructors.
- jeffdavis 9y agoInteresting. Then rust should not care about the destruction order, right?
- steveklabnik 9y agoFor this purpose, no, I don't think. That said I might be missing something and maybe th compiler doesn't understand this, so I'm not saying it's a panacea in your case, just might be worth looking at.
- dbaupp 9y agoThe tree itself will need destructors to clean up allocations, and that's what's problematic here: if the tree is destroyed top down, the destructor of the children may access the parent which has already been invalidated, and similarly destroying bottom up risks the destructor of the parent accessing the children.