literator icon indicating copy to clipboard operation
literator copied to clipboard

Soundness with panicking drop

Open bluss opened this issue 8 years ago • 0 comments

Just for reference, I believe literator runs into the same issue that ArrayVec has seen during its development:

Panic in element's drop leads to double dropping, issue https://github.com/bluss/arrayvec/issues/3

The summary is that the drop inhibition (writing None) is not reached, and then the whole array drops during unwinding. This is a edge case scenario and I guess it might change depending on MIR (just throwing in a disclaimer)?.

ArrayVec solved this by splitting the element drop and the drop inhibition into two different types (ArrayVec vs NoDrop), so that the latter always runs even if the first panics.

bluss avatar Jul 08 '16 15:07 bluss