I'm (also) working on an interpreter for rust using the MIR. Currently I'm looking into the drop
behaviour of objects and how they have to be treated differently depending on type information.
My current assumptions:
-
Types which implement
Copy
don't have to be cleaned up. -
Types with move semantics without
Drop
also need no cleanup (?). -
Types which implement
Drop
have to be cleaned up, but only if the object is still alive (has not been moved).
For #3 MIR generates explicit drops. But I'm not sure about #2. Is there a case where there is an object with move semantics without drop glue attached, which still needs some cleanup?