fix(types): derive structural clone and equality from members - #2907
Open
slepp wants to merge 5 commits into
Open
fix(types): derive structural clone and equality from members#2907slepp wants to merge 5 commits into
slepp wants to merge 5 commits into
Conversation
I inspect non-cloneable generic handle payloads before classifying the outer handle as opaque, so collection clones reject nested resources at the checker boundary.
slepp
force-pushed
the
feat/structural-clone-and-equality
branch
from
August 12, 2026 05:40
29cc3d1 to
5841b81
Compare
Contributor
Author
|
The actual first failure is infrastructure, not the structural clone/equality tests: |
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.
Two operations a user reaches for immediately did not work.
Option<i64>had noclone. Two(i64, string)tuples could not be compared — the attempt failed withIntCmp aggregate operands must be named structural-equality typesand emitted under-release warnings alongside it.Both now follow one rule: an aggregate has a capability when every member has it, and is refused with a diagnostic naming the offending member otherwise. Refusals identify the member by path, such as
item.Some.1. Tuples,Option,Resultand records compose, including through nesting.The two share that rule but not their lowering — equality goes through comparison thunks, clone through snapshot plans that carry drop obligations.
Ownership
An affine or resource-bearing value never gains
Clone. Manufacturing one would produce two owners of a single resource, which is the double free the release exists to prevent. Cloned aggregates own their contents independently.The under-release warnings on the comparison path were not noise.
IntCmpaggregate reads were being treated as ownership escapes, which removed the normal drop plans for the compared values. A comparison borrows its operands, and is now modelled that way.Verification
Accepted and refused shapes are pinned as fixtures. Leak oracles pass in both directions, so a cloned aggregate is released exactly once per owner and a refused clone never partially copies. The compiled Hew suite, core matrix, vertical slice and compiler tests all pass.