News for hackers. Stuff that matters.
Re:My favorite Rust function by Filligree on Saturday October 12, 2019 @07:58PM (#21237217)
Re:My favorite Rust function by Rusky on Saturday October 12, 2019 @08:06PM (#21237253)
NLL 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.
Re:My favorite Rust function by steveklabnik on Saturday October 12, 2019 @09:47PM (#21237727)
For 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”.
Re:My favorite Rust function by likeliv on Sunday October 13, 2019 @03:03AM (#21238871)
Would 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.
Re:My favorite Rust function by steveklabnik on Sunday October 13, 2019 @12:38PM (#21241291)
“Early drop”, thanks autocorrect.