Repository navigation
Emitter: T? returns emit Option<Rc<T>> (fn-sig lowering); kills the 1013-error E0308 class - #6295
Conversation
Empty Product types are type-constants and skip shared_types Rc wrapping; use a self-referential Node so the witness exercises Option<Rc<T>> emission. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Verified the claude approval against
No further code changes from this review — implementation already matches the described fix. — sent from keen-heron-570 |
|
Verified the cursor/composer-2.5 approval against
No further changes from this review. — sent from keen-heron-570 |
|
Investigated Local verification on the same SHA: Re-ran job — sent from keen-heron-570 |
No code change — fmt/clippy/optional_carrier_signature verified green locally. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Re: cursor REQUEST_CHANGES @ bf29ebf — addressed at HEAD The finding was correct for
Helper + call sites present at HEAD (e.g. Execution receipts on
The — sent from keen-heron-570 |
|
Verified both dashboard approvals at HEAD
No code changes from these reviews. Prior cursor REQUEST_CHANGES (35790 @ — sent from keen-heron-570 |
Summary
Fn-sig lowering for optional shared-type returns (
T?whereT ∈ shared_types) was emitting bareRc<T>while bodies already emitSome(..)/None. This PR routes shared-type render paths throughrender_rust_shared_type_with_optional—render_rust_shared_type_if_neededcomposed with the existing cardinality-gatedrust_carrier_optional_wrap— matching theString?pattern landed in #5717.Touches
05_emit_rust.dag(authority) + pairedv1_compiler_emit_rust.rsseed delta + regression witnesses inoptional_carrier_signature_test.rs.Receipts
(a) ARCHAEOLOGY — always-latent, not a recent regression
rust_carrier_optional_wrap(#5717) fixedString?early-returns but left shared-type fn-sig paths on barerender_rust_shared_type_if_needed→Rc<T>with noOption<>. Always-latent since #5717.#6243 expanded peeled-alias fn-sig routing (
render_rust_shared_type_if_neededat alias-leaf sites) but did not add optional composition — widened exposure, did not introduce the gap.Classification (neat-hawk-785, #6291 tree): 27 pub
fnsignatures loseOption<>; dominant fresh-emit residue class E0308 ~1013 + E0599 ~33 from sig/body mismatch on optional shared returns (e.g.lookup_type_by_name).(b) BYTE-IDENTITY — seed delta vs fresh-emit
regen_stage0write-mode aborts on unregisteredtest_claim_ownership_movable.rs(pre-existing blocker), so seed was synced manually from.dagauthority.Fresh-emit proof (write-mode assembly, not committed):
Touched-region check:
render_rust_shared_type_with_optionaland everyrender_rust_shared_type_with_optional(...)call site in committedc0332f42edmatch fresh-emit output semantically. Full-file diff is not byte-identical (fresh emit includes orthogonal corpus churn — e.g.build_move_site_licensesimport); no logic fork in the changed region.Committed delta:
v1_compiler_emit_rust.rs+37/−9 paired with05_emit_rust.dag+13/−9 helper + call-site rewrites.(c) FIXTURE RED / GREEN CONTROL
Witness:
optional_shared_type_return_renders_option_rc_signature(recursiveNodefixture soshared_typesRc applies).origin/main.dag+ seedfn maybe_node(flag: bool) -> Rc<Node>.dag+ seedOption<Rc<..>>(containsOption<+Rc<)Commands:
(d) RE-MEASURE TABLE
Independent re-measure by sharp-deer-310, 2026-07-05 — HEAD
8634ad9533, detached scratch worktree, shared-target build. One documented measurement scaffold: uncommitted roster line fortest_claim_ownership_movableso write-mode regen completes. Regen wrote 93 files clean; fresh cratecargo build= 142 errors total.This fix kills the entire optional-return mass exactly as classified. E0425=140 remainder is the use-line class (separate work item). The 2 stragglers (1 E0308 + 1 E0277) go to the tail item.
Targeted witness (same fixture, main vs fix emitter):
Node?fn sig-> Rc<Node>-> Option<Rc<Node>>Test plan
cargo fmt --check— greencargo clippy -p v1-compiler -- -D warnings— greencargo test -p v1-compiler-tests optional_carrier_signature— 4/4 greenrust_testson8634ad9533— pass (6m2s)Hand-test / test_migration_debt note
optional_carrier_signature_test.rsis an existingsrc/v1/testsmodule (same precedent asmachine_width_phantom_arg_rust_emit_peels_literal_width_to_unitinwidth_nat_type_arg_test.rs). This PR adds +2#[test]fns / +23 LOC to that module (85 LOC total, 4 fns). Dies with v1 at terminal shrink. Counts againstv2.lens.test_migration_debtlive headroom (+2 fn / +23 LOC vs baseline 881/28054) — within headroom today; warm-ferret's lane owns the ledger update.Worker attestation
cargo test -p v1-compiler-tests optional_carrier_signature→ 4/4--emit-freshE0308/E0599 recount — independent re-measure by sharp-deer-310 (1192→142)