Conversation
Deploying nulang-docs with
|
| Latest commit: |
af6239e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1537f262.nulang-docs.pages.dev |
| Branch Preview URL: | https://fix-consume-runtime-move.nulang-docs.pages.dev |
This was referenced Sep 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes
consume xmatch its language-level ownership semantics at runtime.Previously
consume xwas enforced only by the capability analyzer. HIR lowering treated it exactly like a normal read, leaving the source register live.Now variable consumption lowers to:
nilwithout dropping itBecause register copies do not retain, this transfers the source's ownership slot rather than creating a second counted reference.
Non-binding expressions continue to evaluate normally because there is no reusable source slot to invalidate.
Why this precedes sink inference
Nim-style inferred sink/last-use transfer needs a sound explicit move primitive to target. Inferring transfer while
consumeitself is runtime-copy-only would make the ownership model internally inconsistent.Tests
Adds a HIR regression test asserting that the move-result copy is emitted before the source is cleared to nil.
Follow-up
The current Drop planner remains deliberately conservative around raw copies, so a moved heap value can live longer than necessary. A follow-up ownership-flow pass can recognize transfer edges and recover eager reclamation without weakening the existing safety proof.