fix: keep anonymous field receivers alive - #15
Conversation
|
Independent reviewer note: semantic review is GO on head |
|
CI follow-up on head Both snapshot jobs stopped before compiling snapshots. The compiler edit shifted one reviewed raw-authority call site from line 17301 to 17332, while the generated inventory still named the old line. The exact CI snapshot command reproduced the stale-inventory assertion locally. Commit The haxe_rust-dnt5 compiler agent retains ownership of review fixes and rebasing. The repository maintainer retains final approval and merge ownership. |
|
Snapshot follow-up on head The refreshed hosted shard passed the stale raw-authority gate and then found one expected-output difference in This was a legitimate adjacent golden-output update. The callback value remains cloned before invocation, and the read guard ends before user code runs. Commit Focused validation passed:
The PR remains draft. The haxe_rust-dnt5 compiler agent retains review-fix and rebase ownership. The repository maintainer retains final approval and merge ownership. |
|
Independent reviewer update on exact head |
Optional anonymous-field reads used to borrow directly from a temporary record handle. Rust dropped that handle before the generated read guard, so valid typed Haxe failed with E0716. The compiler now binds temporary receivers and the owned field result when a read needs a scoped guard. Stable receivers and direct required-field reads keep their existing output. A framework-neutral snapshot covers a class-owned record with missing and present optional values. Focused interpreter and generated Rust checks pass, along with the repository hook guards. Full harness and independent consumer validation remain for hosted review.
The shared receiver-lifetime rule also changes generated Haxe Unserializer callback reads. Each temporary resolver handle now stays alive until the callback value is cloned and its read guard ends. This updates only the affected expected Rust. Focused haxe_crypto_smoke, optional-field, and raw-authority checks pass.
The merged compiler baseline moved the raw Rust call site and added one snapshot case. Regenerate the tracked inventories from that exact baseline so the branch remains reviewable after rebasing. Verified with the focused optional-field and haxe crypto snapshots, the raw-authority guard, and the repository hook checks. No compiler behavior changes are included in this commit.
74c461d to
e8cc4b3
Compare
|
Rebase update (compiler task haxe_rust-dnt5):\n\n- Rebasing owner: the compiler-task agent.\n- Review and merge owner: the repository maintainer.\n- New base: |
|
Combined consumer admission on exact rebased head |
Outcome
Valid typed Haxe can now read an optional anonymous-record field through a temporary record handle. Generated Rust keeps that handle alive until the read guard ends, so rustc no longer reports E0716.
Cause and fix
A class field read can produce a temporary cloned record handle. Optional-field lowering then stored a read guard from
temporary.borrow()in a generated local. Rust dropped the temporary before the guard reached its final use.The compiler now uses one structural receiver check for instance and anonymous fields. When an optional or function-valued field read has a temporary receiver, lowering binds the receiver and the owned result. Stable receivers and direct required-field reads retain their existing output.
This is compiler-only lowering. It adds no runtime helper and no application-specific rule.
Contract-first evidence
The framework-neutral
anon_optional_field_from_classsnapshot covers:Before the fix, Cargo failed with
error[E0716]: temporary value dropped while borrowedin the generated class method.Validation
Passed locally on this exact head:
anon_optional_field_from_classbash test/run-snapshots.sh --case anon_optional_field_from_class --updatebash test/run-snapshots.sh --case anon_optional_field_from_classbash test/run-snapshots.sh --case anon_optional_fieldsbash test/run-snapshots.sh --case anon_required_field_typesintended/src/holder.rsnpm run hooks:checkgit diff --checkHosted CI remains the broad snapshot, Clippy, standard-library, package, template, and example proof. The independent codex-hxrust consumer replay remains deferred until review selects a merge candidate.
Documentation
The compiler guidance and v1 behavior reference now describe the receiver lifetime rule. README and FAQ need no separate change because this patch adds no syntax, API, or user workflow.
Agent provenance
Prepared by the haxe_rust-dnt5 compiler agent after the consumer project isolated a generic E0716 compiler failure. This agent owns review fixes and rebasing for this draft branch. The repository maintainer owns final approval and merge. Other agents must review or comment without changing this branch unless the maintainer records a handoff.
No independent reviewer has approved this head yet. Hosted CI and maintainer review remain required before merge.