Skip to content

Insert StorageDeads for all locals#1316

Open
Nadrieril wants to merge 2 commits into
AeneasVerif:mainfrom
Nadrieril:storagedead
Open

Insert StorageDeads for all locals#1316
Nadrieril wants to merge 2 commits into
AeneasVerif:mainfrom
Nadrieril:storagedead

Conversation

@Nadrieril

@Nadrieril Nadrieril commented Jul 2, 2026

Copy link
Copy Markdown
Member

May as well be entirely consistent: every non-return local deserves a storage_dead, and every non-argument local deserves a storage_live.

@N1ark

N1ark commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

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
the const eval has FnArg::InPlace but it seems to be an optimisation and unrelated (?)

@Nadrieril

Copy link
Copy Markdown
Member Author

Doesn't a function drop all its arguments anyway? That doesn't include StorageDead?

@Nadrieril

Copy link
Copy Markdown
Member Author

Interesting tho, I could be convinced. And similarly, in-place initialization requires that we don't StorageLive the return place ourselves

@N1ark

N1ark commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Doesn't a function drop all its arguments anyway? That doesn't include StorageDead?

i think so :P that's why im not sure, supposedly you wouldnt drop arguments you receive in-place...
for now i think this is nice for consistency and i dont think i have any strong objections

@Nadrieril

Nadrieril commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

Too late, you've convinced me that input/output place allocation is handled by the caller :3

@Nadrieril

Copy link
Copy Markdown
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants