[WIP] Break TransmuteFrom into Shrink vs Overwrite#2567
Closed
joshlf wants to merge 2 commits intoI6c793a9620ad75bdc0d26ab7c7cd1a0c7bef1b8bfrom
Closed
[WIP] Break TransmuteFrom into Shrink vs Overwrite#2567joshlf wants to merge 2 commits intoI6c793a9620ad75bdc0d26ab7c7cd1a0c7bef1b8bfrom
joshlf wants to merge 2 commits intoI6c793a9620ad75bdc0d26ab7c7cd1a0c7bef1b8bfrom
Conversation
This was referenced Jun 5, 2025
Generalize `SizeEq`, renaming it to `SizeCompat`, and supporting casts which do not preserve referent size. This requires fairly deep surgery in our transmute taxonomy. We can no longer rely on `SizeCompat::cast_from_raw` preserving referent size, which means that all pointer transmutes must now reason about two types of transmutes: - Size-shrinking transmutes (in which the source value is larger than the destination value) - Tearing transmutes (in which the source value is larger than the destination value *and* the destination permits mutation). In a tearing transmute, the resulting value is a concatenation of a valid `T` and the *suffix* of a valid `U`. (Note that size-preserving transmutes can be viewed as a special case of size-shrinking transmutes.) Makes progress on #1817 Co-authored-by: Jack Wrenn <jswrenn@amazon.com> gherrit-pr-id: I6c793a9620ad75bdc0d26ab7c7cd1a0c7bef1b8b
feb1f37 to
a2f2308
Compare
20f0bc3 to
9728eab
Compare
Also, only implement TryTransmuteFromPtr once in terms of MutationCompatible. gherrit-pr-id: I1e15473bf871e5b53a6c093e6a79f48e6498aa04
a2f2308 to
11d3b7e
Compare
5a377c4 to
7a0c2de
Compare
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.
Also, only implement TryTransmuteFromPtr once in terms of
MutationCompatible.
This PR is on branch transmute-ref-dst.