Validity of ManuallyDrop, or: ManuallyDrop<Box<_>> is strange #245
Labels
A-validity
Topic: Related to validity invariants
C-open-question
Category: An open question that we should revisit
The
ManuallyDrop
docs sayIn particular, this means that a
ManuallyDrop<Box<T>>
must not dangle. But that means that after callingdrop
on aManuallDrop<Box<T>>
, that value violates the validity invariant and must not be used or passed around any more! I don't think that is the behavior we want.We want
ManuallyDrop
to preserve niches, so we cannot really relax what it says about validity. But what we could relax is validity ofBox
-- we could say that validity is purely about the pointer value itself (it must be non-NULL and properly aligned). We could specify that the "dereferencability" only comes in through the aliasing model, and we could make that model stop looking intoManuallyDrop
.The text was updated successfully, but these errors were encountered: