3 ms·
If you do this with C++ destructors, they will sure enough fire at the end of the scope. Even if your String is long gone, the destructor fires anyway, destroyi
by tialaramex 5y ago
If you do this with C++ destructors, they will sure enough fire at the end of the scope. Even if your String is long gone, the destructor fires anyway, destroying... a hollowed out String left behind to satisfy the destructor.
But go ahead and try it in Rust, your print doesn't happen because nothing was actually dropped. The String was moved, and so there isn't anything to drop.
https://gist.github.com/rust-play/4bbcc2a4efb641e578e84a1962b14903 https://gist.github.com/rust-play/4bbcc2a4efb641e578e84a1962...