4 ms·
It used to, they got subtler. See https://stackoverflow.com/questions/50251487/what-are-non-lexical-lifetimes https://stackoverflow.com/questions/50251487/what-
by Filligree 7y ago
It used to, they got subtler. See https://stackoverflow.com/questions/50251487/what-are-non-lexical-lifetimes https://stackoverflow.com/questions/50251487/what-are-non-le...
- Rusky 7y agoNLL does not change those semantics; drop still runs at the end of the scope. It counts as a "use" for the purposes of NLL and thus keeps values with destructors alive.
- steveklabnik 7y agoFor some history, it was talked about changing this, but we couldn’t, due to back compatibility and it wasn’t clear it was actually a good idea. This was called “wary drop”.
- likeliv 7y agoWould be nice if types could annotate their Drop trait with #[early_drop] if the drop has no visible side effect, do rust could free the memory earlier.
- steveklabnik 7y ago“Early drop”, thanks autocorrect.