Closed
Description
spawned off of: #769 (comment) :
@glaebhoerl notes:
The impl Drop for T can also be invoked through an &mut T, e.g. assignment through it invokes the destructor on the previous value. This possibility doesn't appear to be covered by "the type of v owns data of type T".
@pnkfelix replies:
any destructor that actually writes to a contained
&'a mut T
or&'a RefCell<T>
within a valuev
will need to either:
- be attached to a type that is parametric in
'a
(which will force'a
to strictly outlivev
, and thus I think will forceT
also to strictly outlivev
), or- be hidden behind a generic type with some method that does the write to
&'a mut T
or&'a RefCell<T>
-- but again, I think we will again here see the'a
leak up and end up being forced to strictly outlivev
?