Repository navigation
Emitter: a cloned Rc match scrutinee owes Clone on its generics wherever the match sits (native broker product_data_class E0599) - #13255
gunbai-bot[bot] wants to merge 5 commits into
Conversation
…wherever the match sits Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… 3-way merge, regenerated next)
briansrls
left a comment
There was a problem hiding this comment.
LAND on code/modeling. This is the declared scope trigger firing, not a new Clone heuristic. v1_rc_match_scrutinee_clone_bound_param_names remains the one exact predicate for whether a cloned/dereferenced Rc match scrutinee owes bounds; the new function only removes the unjustified top-level-body visibility limit by walking the finite expression tree, then unions the same answers. Keeping the walk in emit_rust also preserves the existing dependency direction rather than moving Node traversal into trait_bound_witness and creating a cycle.
The production specimen is structurally discriminating: C is not bounded by the other existing rules, the nested fold-step match needs DataEffectAdmission<C,T>: Clone, and the base emits <C, T: Clone> while the repaired head emits both bounds. The control reproduces that asymmetry with A phantom-carried and B independently bounded, and its behavioral cases prevent a compile-only fixture from standing as the whole proof. Deleting BoundedToDirectTopLevelMatchBody is correct because its named recursive-walker trigger has now fired.
Floor and generated are green. The exact-head emit-build job is still running, so treat this approval as the substantive LAND verdict and wait for the aggregate witnesses workflow before queueing.
…y 3-way merge, regenerated next)
Union both native_emission_controls case rows; stage0 emit_rust mirror left as ours for regeneration. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
briansrls
left a comment
There was a problem hiding this comment.
LAND at exact head 65e6e17.
Re-review after the approval at 6c3b5e2. The movement is main integration plus regeneration, with no new branch-owned compiler logic. Merge commit 44c317b has the approved head and current main as its parents. Its native-emission-controls resolution preserves main's generic-empty-map population and adds this PR's three rc-match-clone identities and executable cases; neither side survives only in the roster. Exact head 65e6e17 changes only the generated v1_compiler_emit_rust.rs mirror. Exact-head rust-unit-tests, generated, emit-build, floor, and aggregate witnesses all pass, including all-target lint and the stage0 fixed-point check. No blocker found.
Native broker wave 2D (program: gentle-dove-36), class H:
E0599 the method clone exists for enum DataEffectAdmission<C, T>, but its trait bounds were not satisfiedatgunbc.product.data_classadmit_data_effect. Checked first, as asked: gunbc#13078's head still carries this error (probed on the broker), and #13160 is the std_key_relation case, so neither covers it.Re-derivation (DESIGN §6b)
Base emission:
pub fn admit_data_effect<C, T: Clone>(classified: Rc<Classified<C, T>>, sink: Rc<Sink<C>>, …), whose fold step is|acc: Rc<DataEffectAdmission<C, T>>, c| match (*acc.clone()).clone() { … }. Cloning the scrutinee needsDataEffectAdmission<C, T>: Clone, so derive(Clone) needsC: Cloneas well as T. T earned its bound from another rule (the seed stores a bare T). C occurs only in a phantom-like position (Sink<C>), so nothing bounded it.The authority that owns this fact already exists:
v1.compiler.trait_bound_witnessv1_rc_match_scrutinee_clone_bound_param_names. A match whose Rc scrutinee is dereferenced and cloned owes Clone on the scrutinee type's arguments that are the fn's own generics. Its caller inv1_fn_body_derived_clone_param_namesread it only when the fn body was itself a top-level match. That was a declared boundary,TraitBoundWitnessScopeBoundedToDirectTopLevelMatchBody, and its stated next-rung trigger was a recursive body walker once a real specimen needed it.admit_data_effectis that specimen: the match is a fold step's body. The earliest unjustified boundary is the scope of the reading, not the rule.Change
v1.compiler.emit_rustv1_fn_body_rc_match_clone_bound_param_names: walks every match in the body, with the same shape as the existing equality walker. Generous traversal, exact predicate:analyze_rc_matchstill decides whether the match derefs, and the pure core is unchanged.v1_fn_body_derived_clone_param_namescalls it in place of the top-level-only read, so the call-forwarding rule, which re-derives a callee's bounds through this same function, inherits it.v1.compiler.trait_bound_witness:TraitBoundWitnessScope/BoundedToDirectTopLevelMatchBodyis deleted, asBoundedToDirectSingleCallLambdaBodywas when the clone-forwarding half was widened. The notes now record the trigger firing.v1_compiler_emit_rust.rs,v1_compiler_trait_bound_witness.rs) viaclaim_executor --required-regen. Pass 2 is a fixed point, so with the rebuilt emitter no other v1 seed mirror's emitted Clone bounds changed.Control:
//gunbc/instruments:native-emission-controls, emitted, built, runcontrol_first_refusal<A, B>matchesadmit_data_effect's shape. B earns Clone elsewhere because the seed stores it by value; A is carried only in a phantomControlTag<A>, asSink<C>is. The step matches on the cloned accumulator. Cases: no refusal keeps the seed (=7); red: the first refusal wins; red: a refused result is not admitted.control_first_refusal<A, B: Clone>; label exit 2,E0599: the method clone exists for enum ControlAdmission<A, B>, but its trait bounds were not satisfied.<A: Clone, B: Clone>; label exit 0, every caseheld.Two earlier fixture drafts were not discriminating: a bare
value: Tparameter, then a two-generic compound parameter. Both compiled on base because other rules already bounded every generic. They were replaced, not kept. A control that greens on both arms proves nothing.Broker probe
On this head the broker crate checks with 143 errors and no
product_data_classerror; the E0599 atproduct_data_class.rs:478is present on main. This head sits on a newer main than my earlier probes, so I am not quoting a two-arm count delta. The identity-level fact is that site's removal.🤖 Generated with Claude Code