Repository navigation
Conversation
Tie validity implications to one exact referent correspondence and represent forward and reverse logical implications independently of the executable cast direction. Thread the correspondence through pointer mutation-compatibility proofs. Agent-authored-by: AI agent acting on Josh Liebow-Feeser's behalf
Make impl_for_transmute_from select an exact representation correspondence and require only the Safe implication needed by each byte trait. Compose transparent-wrapper and transitive TransmuteFrom proofs over the same casts. Agent-authored-by: AI agent acting on Josh Liebow-Feeser's behalf
Express ReadOnly, atomic, and local representation-validity proofs using the exact-cast-relative TransmuteFrom relation. Add direct atomic SizeEq witnesses needed by the byte-trait helper. Agent-authored-by: AI agent acting on Josh Liebow-Feeser's behalf
Pass the exact cast through MutationCompatible consumers so shared validity preservation refers to the same concrete correspondence used by the pointer operation. Agent-authored-by: AI agent acting on Josh Liebow-Feeser's behalf
Clarify that Validity and TransmuteFrom reason about complete referent byte states, including initialization, while preserving the existing rule that a Validity state depends only on the referent type's bit validity. Agent-authored-by: AI agent acting on Josh Liebow-Feeser's behalf
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Discharge Ref's cast compatibility through explicit Read premises so the private size-dependent CastForSized witness can remain lexically local while MutationCompatible carries the actual cast elsewhere. Agent-authored-by: AI agent acting on Josh Liebow-Feeser's behalf
Attach a Safety section directly to TransmuteFrom and apply rustfmt's layout to the new relation definitions. Agent-authored-by: AI agent acting on Josh Liebow-Feeser's behalf
Remove the now-unused Ref compatibility import and apply rustfmt's remaining layout to the Forward correspondence impl. Agent-authored-by: AI agent acting on Josh Liebow-Feeser's behalf
Keep the direction markers minimally documented and attach the full cast-relative admissible-state contract directly to the unsafe relation it governs. Agent-authored-by: AI agent acting on Josh Liebow-Feeser's behalf
Make every sized Ref cast select its Read proof explicitly: BecauseImmutable for shared access and BecauseExclusive for exclusive access. Apply rustfmt to the pointer imports. Agent-authored-by: AI agent acting on Josh Liebow-Feeser's behalf
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3705 +/- ##
==========================================
+ Coverage 91.90% 91.91% +0.01%
==========================================
Files 20 20
Lines 6175 6183 +8
==========================================
+ Hits 5675 5683 +8
Misses 500 500 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Replace the exact Forward/Reverse TransmuteFrom model with a cast-relative projection theorem plus a distinct SpliceFrom write-back theorem. This permits compile-time reasoning about shrinking mutable casts while keeping exact type-level representation equivalence separate. Agent-authored-by: AI agent acting on Josh Liebow-Feeser's behalf
Restore the exact ByteReprEq byte-trait delegation and teach the transparent-wrapper/transitive proof generators to emit forward TransmuteFrom and reverse SpliceFrom relations. Agent-authored-by: AI agent acting on Josh Liebow-Feeser's behalf
Express ReadOnly and atomic representation relationships as forward projection plus splice preservation, while retaining ByteReprEq for type-level byte-trait delegation. Agent-authored-by: AI agent acting on Josh Liebow-Feeser's behalf
State the shrinking-cast proof directly: TransmuteFrom preserves projected destination validity, while SpliceFrom proves that arbitrary valid destination writes preserve the enclosing source. Agent-authored-by: AI agent acting on Josh Liebow-Feeser's behalf
Allow transmute_with to consume any address-preserving Cast whose compile-time TransmuteFrom/SpliceFrom proofs satisfy the pointer invariants, and add a mutable shrinking-cast test. Agent-authored-by: AI agent acting on Josh Liebow-Feeser's behalf
Import the ReadOnly and SizeEq proof types required by the restored exact representation witness and atomic implementations. Agent-authored-by: AI agent acting on Josh Liebow-Feeser's behalf
Apply rustfmt's layout to the new transmute/splice relation impls and atomic cfg block. Agent-authored-by: AI agent acting on Josh Liebow-Feeser's behalf
This branch has not been deployed
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.
Alternative to #3699.
Fix #3691 with the same exact metadata-aware byte-representation witness as #3699, while also extending the pointer transmute trait hierarchy to model shrinking mutable casts directly at compile time.
The core distinction is:
TransmuteFrom<Src, SV, DV, C>proves projection validity: everySV-admissibleSrcstate projects through the address-preserving castCto aDV-admissible destination state.Cmay shrink.Src: SpliceFrom<Dst, SV, DV, C>proves write-back validity: starting from anySV-admissibleSrcstate, replacing exactlyC's destination bytes with anyDV-admissibleDststate leaves the enclosingSrcSV-admissible.The latter is the compile-time theorem needed for an
&mut Src -> &mut Dstshrinking transmute. No inverse cast or runtime repair is involved; the untouched source bytes remain part of the proof context.This PR:
TransmuteFromcast-relative and permits address-preserving shrinking casts rather than quantifying over arbitrary equally-sized referents;SpliceFromas the source-validity preservation relation for writes through a projected/mutated destination;TryTransmuteFromPtr/TransmuteFromPtr/MutationCompatibleto compose those two static relations with the existing access/aliasing proofs;SharedCompatibleobligation;Validitydefined over complete referent byte states, including initialization state;ByteReprEqwitness from [pointer] Use metadata-aware representation proof in transmute helper #3699 for the byte-trait delegation macro. That stronger witness is intentionally separate:SpliceFromassumes an already-valid source place and therefore is not sufficient to prove type-level traits such asFromBytesfor an otherwise possibly-uninhabited type;impl_for_transmute_from!using the exact metadata-awareByteReprEqmapping, including delegatingTryFromBytes::is_safethrough that exact correspondence.For an exact cast,
SpliceFromreduces to the familiar reverse-validity preservation obligation. For a shrinking cast it is strictly more general: it quantifies over valid writes to the destination subrange while preserving the untouched source bytes.This is a concrete refinement of #3703 focused on compile-time transmutability modeling. #3699 remains unchanged as the narrower macro-only alternative.
Fixes #3691.
Authored by an AI agent acting on Josh Liebow-Feeser's behalf.