Repository navigation
Optional de-fork PR-1: bind the seed's kernel Optional mint to the v2.std.optional declaration - #13178
Merged
Conversation
….optional Optional One row (gunbc.structural_realization_bindings kernel_mint_declaration_rows) names the declaration the seed's synthetic kernel Optional stands for. Present/Absent arms reached through T? now carry that declaration's identity instead of an unrecovered owner. The three identical copies of the mint in v1.compiler.infer become one function, and typechecking the declaring module refuses if its arms stop matching the mint. No corpus source changes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…smatch, identity-keyed pattern lowering (mirrors not yet regenerated) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…rom main; regeneration follows) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ugh declaration_substitution_basis Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…on BuildBuddy) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ithout identity; Diagnostics identity row; test call sites; regenerated mirrors - host_option_arm_reading refuses only when INFERENCE named the kernel optional as the parent with no identity; an unidentified arm whose parent the emitter resolves keeps the spelling rule. - gunbc.rust_source_type_bindings rust_host_option_carrier_declarations: v2.std.diagnostic Diagnostics, so an identified owner is judged by identity and not by spelling. - The four generated seed unit tests pass the new identity argument. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…al binding (review 75454) host_option_arm_reading reads kernel_mint_declaration_for directly; two rows binding the kernel optional refuse the arm instead of answering not-the-optional. kernel_mint_is_bound_to, which folded Ambiguous into false, is deleted. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…olled ambiguity red std.literal_elaboration kernel_mint_ownership answers owns / does not own / ambiguous; the emitter refuses on ambiguous. Three claims at that interface, including the doubled-row red. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…entity row (review 75565) is_host_diagnostics_carrier_alias reads declaration names off gunbc.rust_source_type_bindings rust_host_option_carrier_declarations instead of holding its own spelling, so the host-option carrier fact has one authority. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Oct 4, 2026
…aken from main; regeneration follows) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…fixed point) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Oct 4, 2026
…rors taken from main; regeneration follows) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…fixed point) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…rom main; regeneration follows) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ging main (fixed point) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Optional de-fork, PR-1 of 4 (node adhoc-ce2b73a7-f4e; plan and rework route approved by calm-boar-904). It binds the seed's kernel
Optionalto the corpus declaration, gives that binding a consumer in the emitter, and changes no corpus source.The fork
Optionalhas three carriers: the seed's kernelT?, the declared coproductv2.std.optionalOptional, and thenoneliteral. The seed's kernelOptionalis not a declaration.v1.compiler.infermints a synthetic coproduct namedOptionalinto its kernel scope, in three identical copies. An arm reached throughT?reported its owner as unrecovered, while the same arm reached through an import reported the declaration: one concept, two identities. The emitter then decidedSome/Noneby the arm's and parent's spelling.What changes
std.literal_elaborationKernelMintDeclaration, its three-way lookupkernel_mint_declaration_for(found, absent, ambiguous), andkernel_mint_ownership(owns, does not own, ambiguous), the question the emitter asks of an arm's declaration.gunbc.structural_realization_bindingskernel_mint_declaration_rowsbinds the kernelOptionaltov2.std.optionalOptionalbyDeclarationRef.v1.compiler.inferkernel_optional_type_node.kernel_mint_parent_identityreads the row;variant_parent_identity_ofand the optional-wrapper arm ofannotate_pattern_parent_enumsanswerVariantParentDeclarationfor Present/Absent.v1.compiler.emit_rusthost_option_arm_readingdecides whether a pattern arm lowers toSome/None, atemit_resolved_variant_patternand its twinemit_resolved_variant_pattern_rc_aware:gunbc.rust_source_type_bindingsrust_host_option_carrier_declarations=v2.std.diagnosticDiagnostics(None | Some { diagnostics }), which the emitter previously recognised by a name table of its own. That table is gone as an authority:is_host_diagnostics_carrier_aliasnow projects the declaration names off the row, and the other two spellings of"Diagnostics"call it, so a name-keyed site cannot disagree with an identity-keyed one (review 75565);compile_error!instead of being answered as not-the-optional (review 75454);compile_error!, because inference names that parent and stamps the identity in one branch.v1.compiler.compiler_tests_rustpasses the new identity argument at its four direct calls of the pattern lowering.kernel_optional_shape_refusaljudges the bound declaration itself: exactly one type parameter, exactly two arms, one arm with no payload, one arm with a single field named as the mint names it whose type is that parameter. The parameter is read throughv1.compiler.infer_envdeclaration_substitution_basis, the existing authority for "is this leaf one of this declaration's parameters". It is keyed on the row'sDeclarationRef, so the re-home changes the row and not the check.KernelMintShapeMismatchinv1.std.coreCompilerDiagnostic, with its three hand-Rust arms incli_run::compile_clean.Controls
test.claim.kernel_optional_mint_shape_witness_test, through the isolated multi-module fixture compile, asserting by class and subject:Present { value: Int }refusedInt?emitsSome(v)/NoneBoth mutants were last rebuilt and run before the final two changes to this branch: the commit that makes the emitter's name-keyed
Diagnosticspredicate read its row, and a merge of main. They were not re-run after the merge. A second mutant, the kernel optional bound twice (the row duplicated, regenerated, rebuilt), gives the same column as the bypass mutant: the consumer claim alone fails. I did not capture which refusal message the emitted text carried there; with the row doubled inference also stops stamping the identity, so it is most likely the missing-identity refusal and not the emitter's ambiguity message. The ambiguity decision itself is enrolled at its own interface:kernel_mint_ownershipover the real rows says the bound declaration owns the mint andv2.std.diagnosticDiagnosticsdoes not, and over a doubled row answers ambiguous, never does-not-own.The bypass mutant replaces the identity at the optional-wrapper arm with
VariantParentUnrecovered, regenerates and rebuilds.v2.test.claim.self_host.kernel_optional_mint_binding_test(seven claims at the row and ownership interfaces, plus an executed round trip betweenT?andOptional<Int>) passes on the new compiler.Two honest limits. The consumer claim passes on a compiler without this change, where lowering was by spelling; what it discriminates is the identity being lost afterwards. And two wrong versions of the shape check were caught by the wall itself refusing the real declaration on the way here, which is the positive control doing its job.
Receipts
BuildBuddy, self-bound 20 GiB memory cgroup, on this branch merged with main at
9db1a8bbaa:claim_executor --required-regen,planned=162 executed=162: the only mirrors that change are those of sources this PR edits (gunbc_structural_realization_bindings.rs,gunbc_rust_source_type_bindings.rs,std_literal_elaboration.rs,v1_compiler_emit_rust.rs,v1_compiler_infer.rs,v1_std_core.rs,v1_compiler_compiler_tests_rust.rs, andcompiler_tests.rs, which is rendered from the last). No other seed module's emission moved under the identity-keyed lowering. On the pushed head, after installing them, a clean run reportsfirst_generation_equal=true.gunbc test //gunbc/instruments:self-hoston the pushed tree: 241 files emitted, built withexit_status=0 warning_count=0, emitted compiler binary sha2569e41a65bf52fbb33b9fca2e68c9fd2c2c2670db3a8d087ad9d79e77e8ea7079e, identical to the binary the same instrument builds at the merge base9db1a8bbaa(and identical to base at the previous merge basebc7838f7b4too,1f2a010f…on both sides). The seed binaries differ (62b14cc6dc4e…here,4ad00dece5a8…at base), which is the control that the two sides are different compilers. This is identity of the built self-host compiler, not a hash of the emitted source tree.cargo clippy --all-targets -- -D warningsandcargo fmt --all --check: clean on the pushed tree.Two earlier heads of this rework were wrong and this receipt is what caught them: the self-host build failed first on arms the emitter resolves itself, then on the
Diagnosticscarrier. Both are handled above, and both populations are named.Not run locally: the whole floor and
cargo test. CI is the instrument for the floor; the seed unit tests run on no CI path (gunbc.rung_droprust_unit_tests_off_the_merge_path).Interim, and its dissolution
A mint bound to a declaration and checked against it is still two representations reconciled by a check. It is accepted here only as an interim. Dissolution: the mint is deleted in the re-home PR or in PR-2, at which point
T?resolves to the declaration itself. That requires the declaring module to be in the closure of every module that writesT?; how that lands is not designed yet and is owed by whichever PR deletes the mint.Declared split: what still decides Optional by spelling
One emitter decision is now identity-keyed. These still read the spelling
Optional,Present/AbsentorSome/None, and are PR-2's population, by symbol:v1.compiler.infer:annotate_pattern_parent_enums,coproduct_name_is_unnamed_or_optional_carrier,coproduct_payload_where_parent_required,direct_call_arg_type_mismatch,equality_operand_admission,infer_record_lit_structural,kernel_value_declared_type_mismatch_bounded,nominal_coproduct_application_head_name,nominal_product_head_name,optional_cast_diags,optional_produced_at_required_declared,overlay_skips_kernel_name,validate_cast.v1.compiler.infer_patterns:lookup_variant_in_type.v1.compiler.infer_types:extract_optional_inner_node.v1.compiler.emit_rust:resolved_variant_pattern_shape_for(a third copy of the rule converted here), and the name-keyed readersis_host_diagnostics_carrier_aliasandis_host_diagnostics_carrier_type, which now read the identity row but still key on a name because their call sites hold no identity,analyze_rc_match,analyze_rc_pattern,box_bound_fields_for_pattern,collect_pattern_rc_variant_guards,collect_pattern_string_guards,collect_rc_pattern_prelude_parent_enums,contextual_variant_parent_absent,effective_variant_parent_from_resolved,emit_rust_expr_record_lit,emit_type_def_from_connective,emit_typed_expr_base,emit_typed_record_lit,emit_var_ref,is_already_optional,is_grounded_coproduct_native_alias,is_host_optional_carrier_alias,is_host_optional_carrier_type,is_optional_like_parent_name,is_optional_parent,rc_pattern_preludes,render_rust_applied_type,render_rust_decl_type,render_rust_fn_sig_type,render_rust_type,render_rust_type_without_applied_binding,rust_call_arg_fail_closed_unwrap,variant_pattern_parent_unresolved; and the unidentified-arm branch ofhost_option_arm_readingitself.v1_interpreter.rs: fiveparent_enum_is(.., "Optional")reads.What follows
std.optionalunder the dag root,v2.std.optionalis deleted with no re-export, and its importers are repointed by a modeled, re-runnable rewrite. Nineteen modules evaluated withoutsrc/v2cannot import it today (valiant-stag-606, CI runs 37162821539 and 37164442913).nonebecomesAbsentinside the N7 closure, with a compiler wall and a shrink-only roster keeping newnonesites out elsewhere.LitNulland the universal-null join are deleted together.v1 maintenance purpose (
gunbc.v1_maintenance_standingv1_seed_standing): this serves the v2 self-host. It gives the seed'sT?arms the identity v2 already uses, so the later cut can remove the seed-only null without a second binding beside it.🤖 Generated with Claude Code