3 ms·
Rust does keep track of where the object is alive and in scope, even if that happens to be decided dynamically, e.g. an object may only exist in a condition bra
by fl0ki 3y ago
Rust does keep track of where the object is alive and in scope, even if that happens to be decided dynamically, e.g. an object may only exist in a condition branch or as the result of a loop running at least once.
Objects also won't be silently copied unless they are types that explicitly marked as trivial to copy (i.e. bytewise).
It then also guarantees cleanup if the object actually does exist.
Rust already does what many people want for deterministic, safe cleanup, which like C++ includes RAII, but unlike C++ is not limited to RAII.