Insert StorageDeads for all locals#1316
Conversation
|
i wonder if this breaks "in place" argument passing (see MiniRust's ArgumentExpr)... the thing is I actually don't know what it is/how it happens/if it even exists in MIR (I don't believe it does?) so its probably ok |
|
Doesn't a function drop all its arguments anyway? That doesn't include StorageDead? |
|
Interesting tho, I could be convinced. And similarly, in-place initialization requires that we don't StorageLive the return place ourselves |
i think so :P that's why im not sure, supposedly you wouldnt drop arguments you receive in-place... |
|
Too late, you've convinced me that input/output place allocation is handled by the caller :3 |
|
I keep changing my mind x) For at least the purpose of borrow-checking, arguments are considered deallocated by the end of the function. I preserving caller argument places is at least a valid optimization, but for the MiniRust stuff we would need to make it the actual behavior... Maybe I should write the MiniRust translator, that would let me know what feels more natural. |
May as well be entirely consistent: every non-return local deserves a storage_dead, and every non-argument local deserves a storage_live.