4 ms·
No. Drop has straightforward rules. Find the scope you can refer to the variable in, i.e. the curly brackets it is contained in. That variable is dropped right
by iudqnolq 3y ago
No. Drop has straightforward rules.
Find the scope you can refer to the variable in, i.e. the curly brackets it is contained in. That variable is dropped right before the closing curly bracket. Things are dropped in reverse order of creation.
(Similar rules apply to dropping temporaries)
https://doc.rust-lang.org/reference/destructors.html https://doc.rust-lang.org/reference/destructors.html