4 ms·
> The standard says you must leave the object in a valid state for the destructor to be called Note that Rust also uses a bit of a hack - a remnant of the type
by 0815test 7y ago
> The standard says you must leave the object in a valid state for the destructor to be called
Note that Rust also uses a bit of a hack - a remnant of the typestate machinery, actually - to deal with cases where a drop implementation (equivalent to a non-default destructor) must be called on something that may or may not have been moved from, in a way that cannot be determined at compile-time. They limit it to that case though, it's a purely-internal detail and does not affect the reference-level ("standard") description of the language.