Repository navigation
Derive Ord bound for fn-generics reaching set_union: audience_subset/audience_join - #8761
gunbai-bot[bot] wants to merge 2 commits into
Conversation
…audience_join v1's fn-generic bound-inference mechanism only ever derived Clone bounds for generic function parameters, so a generic reaching the set_union builtin (which lowers to rc_set_union<T: Ord + Clone>) emitted without its own P: Ord, producing E0277 at the call site. audience_subset and audience_join in dag/std/authorization_profile.dag are the two real specimens (E0277 root A residual, dashboard node://adhoc-a9f61ade-340). Adds a narrowly-scoped third trigger alongside the existing Clone-bound machinery: a pure decision core (v1_set_union_ord_bound_param_names in trait_bound_witness.dag), a Node-consuming body walker that locates set_union call sites and resolves their element-type argument names (05_emit_rust.dag, mirroring ownership.dag's collect_callable_refs, plus an ExprBinOp arm that precedent lacks -- needed because audience_subset's set_union call sits inside a == comparison), and a sibling renderer (v1_emit_type_params_with_clone_and_ord_bounds in trait_derive_emit.dag) wired into emit_fn_def alongside the existing Clone-only renderer. Scoped to the set_union builtin's known lowering only -- not a general trait-bound inference system, and does not touch the separate Root A Ord-5 population on EnumeratedAudience's own struct derive. Verified by regenerating v1's own compiler from these .dag sources and re-emitting dag/std/authorization_profile.dag through the candidate gunbc: audience_subset and audience_join now emit <P: Ord + Clone>; all other Clone-only generic signatures in the import closure (ordering_fold, effect_access_request, list_length, etc.) are unchanged. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Commits the src/v1/stage0/src/*.rs mirror produced by --required-regen for the three .dag edits in dde8ac2. Closes PR #8761's CI regen-drift failure: the prior commit only carried the .dag sources, not their regenerated Rust mirror, so required-regen (and its downstream receipt phase) correctly flagged drift on v1_compiler_emit_rust.rs, v1_compiler_trait_bound_witness.rs, and v1_compiler_trait_derive_emit.rs. Verified: sha256 of each mirror file matches the candidate produced by target/stage0-regen-candidate/src (built from a gunbc compiled against these committed .dag sources), and the diffs are exactly the new Ord-bound rendering/decision-core additions plus the ExprBinOp walker case, no unrelated drift. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Closing in favor of a subsuming fix, not because this is wrong. This PR's set_union call-site walker correctly emits Verified before closing: I found no counter-specimen where a fn reaches an Ord-requiring builtin without naming an Ord-bounded declared type in its own signature (checked by grep across the whole tree). If one turns up later, this branch's mechanism (and its ExprBinOp walker-precedent fix, real independent of this PR's outcome) is preserved in history rather than deleted. — sent from tidy-otter-493 |
Summary
v1.trait_derive_emit/v1.compiler.trait_bound_witness) only ever derivedClonebounds for generic function parameters. A generic reaching theset_unionbuiltin — which lowers tov1_rt::rc_set_union::<T: Ord + Clone>— emitted without its ownP: Ord, producing E0277 at the call site.audience_subset<P>andaudience_join<P>indag/std/authorization_profile.dagare the two real specimens (E0277 root A residual:dashboard node://adhoc-a9f61ade-340).v1_set_union_ord_bound_param_names,trait_bound_witness.dag), a Node-consuming body walker locatingset_unioncall sites and resolving their element-type argument names (05_emit_rust.dag, mirroringownership.dag'scollect_callable_refs, plus anExprBinOparm that precedent lacks — needed becauseaudience_subset'sset_unioncall sits inside a==comparison), and a sibling renderer (v1_emit_type_params_with_clone_and_ord_bounds,trait_derive_emit.dag) wired intoemit_fn_defalongside the existing Clone-only renderer.set_unionbuiltin's known lowering only — not a general trait-bound inference system, and does not touch the separate Root A Ord-5 population onEnumeratedAudience's own struct derive (different root, out of scope here).Verification
Since the built
gunbcbinary compiles v1's own.dagsources ahead-of-time (it does not interpretsrc/v1/*.dagat runtime), verifying this required the full self-host regen + rebuild loop:claim_executor --required-regenagainst these.dagedits (writes a candidate stage0 Rust mirror reflecting the change — reports drift, as expected, since the committed mirror predates this fix).src/v1/stage0/src, rebuiltgunbcfrom it.gunbc compile --target rustondag/std/authorization_profile.dag.Result:
audience_subset<P: Ord + Clone>andaudience_join<P: Ord + Clone>now emit correctly. All other Clone-only generic signatures reachable in the same import closure (ordering_fold,effect_access_request,list_length,disclosure_access_request, etc.) are unchanged — no regression on the existing 25-site Clone population.The committed stage0 mirror itself is not touched by this PR — it is expected to converge via the normal CI regen gate post-merge, per the committed-mirrors-are-the-bootstrap-base-case pattern.
Test plan
.dagsources and re-emitted the specimen file through the candidategunbc; confirmedP: Ord + Cloneon both target functions..dagsource edits (no stray generated-mirror changes).🤖 Generated with Claude Code