-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ptr
invariant conversions could be smarter
#1122
Comments
joshlf
added a commit
that referenced
this issue
Oct 13, 2024
This commit adds a framework which supports encoding in the type system any `I -> I` mapping where `I` is any `Invariant` type. This permits us to make `cast_unsized`'s return value smarter, and as a result, allows us to remove a lot of `unsafe` code. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 13, 2024
This commit adds a framework which supports encoding in the type system any `I -> I` mapping where `I` is any `Invariant` type. This permits us to make `cast_unsized`'s return value smarter, and as a result, allows us to remove a lot of `unsafe` code. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 13, 2024
This commit adds a framework which supports encoding in the type system any `I -> I` mapping where `I` is any `Invariant` type. This permits us to make `cast_unsized`'s return value smarter, and as a result, allows us to remove a lot of `unsafe` code. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 13, 2024
This prepares us to rename `TransparentWrapper` to `TransmuteFrom`, which we'll do in a follow-up commit to preserve nice git diffs. Makes progress on #1122
This was referenced Oct 13, 2024
joshlf
added a commit
that referenced
this issue
Oct 13, 2024
This commit adds a framework which supports encoding in the type system any `I -> I` mapping where `I` is any `Invariant` type. This permits us to make `cast_unsized`'s return value smarter, and as a result, allows us to remove a lot of `unsafe` code. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 13, 2024
This prepares us to rename `TransparentWrapper` to `TransmuteFrom`, which we'll do in a follow-up commit to preserve nice git diffs. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 14, 2024
This commit adds a framework which supports encoding in the type system any `I -> I` mapping where `I` is any `Invariant` type. This permits us to make `cast_unsized`'s return value smarter, and as a result, allows us to remove a lot of `unsafe` code. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 14, 2024
This prepares us to rename `TransparentWrapper` to `TransmuteFrom`, which we'll do in a follow-up commit to preserve nice git diffs. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 14, 2024
This commit adds a framework which supports encoding in the type system any `I -> I` mapping where `I` is any `Invariant` type. This permits us to make `cast_unsized`'s return value smarter, and as a result, allows us to remove a lot of `unsafe` code. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 14, 2024
This prepares us to rename `TransparentWrapper` to `TransmuteFrom`, which we'll do in a follow-up commit to preserve nice git diffs. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 14, 2024
This commit adds a framework which supports encoding in the type system any `I -> I` mapping where `I` is any `Invariant` type. This permits us to make `cast_unsized`'s return value smarter, and as a result, allows us to remove a lot of `unsafe` code. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 14, 2024
This prepares us to rename `TransparentWrapper` to `TransmuteFrom`, which we'll do in a follow-up commit to preserve nice git diffs. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 14, 2024
This commit adds a framework which supports encoding in the type system any `I -> I` mapping where `I` is any `Invariant` type. This permits us to make `cast_unsized`'s return value smarter, and as a result, allows us to remove a lot of `unsafe` code. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 14, 2024
This prepares us to rename `TransparentWrapper` to `TransmuteFrom`, which we'll do in a follow-up commit to preserve nice git diffs. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 14, 2024
This commit adds a framework which supports encoding in the type system any `I -> I` mapping where `I` is any `Invariant` type. This permits us to make `cast_unsized`'s return value smarter, and as a result, allows us to remove a lot of `unsafe` code. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 14, 2024
This prepares us to rename `TransparentWrapper` to `TransmuteFrom`, which we'll do in a follow-up commit to preserve nice git diffs. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 14, 2024
This commit adds a framework which supports encoding in the type system any `I -> I` mapping where `I` is any `Invariant` type. This permits us to make `cast_unsized`'s return value smarter, and as a result, allows us to remove a lot of `unsafe` code. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 14, 2024
This commit adds a framework which supports encoding in the type system any `I -> I` mapping where `I` is any `Invariant` type. This permits us to make `cast_unsized`'s return value smarter, and as a result, allows us to remove a lot of `unsafe` code. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 14, 2024
This prepares us to rename `TransparentWrapper` to `TransmuteFrom`, which we'll do in a follow-up commit to preserve nice git diffs. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 14, 2024
This commit adds a framework which supports encoding in the type system any `I -> I` mapping where `I` is any `Invariant` type. This permits us to make `cast_unsized`'s return value smarter, and as a result, allows us to remove a lot of `unsafe` code. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 14, 2024
This prepares us to rename `TransparentWrapper` to `TransmuteFrom`, which we'll do in a follow-up commit to preserve nice git diffs. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 14, 2024
This commit adds a framework which supports encoding in the type system any `I -> I` mapping where `I` is any `Invariant` type. This permits us to make `cast_unsized`'s return value smarter, and as a result, allows us to remove a lot of `unsafe` code. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 14, 2024
This prepares us to rename `TransparentWrapper` to `TransmuteFrom`, which we'll do in a follow-up commit to preserve nice git diffs. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 14, 2024
This commit adds a framework which supports encoding in the type system any `I -> I` mapping where `I` is any `Invariant` type. This permits us to make `cast_unsized`'s return value smarter, and as a result, allows us to remove a lot of `unsafe` code. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 14, 2024
This prepares us to rename `TransparentWrapper` to `TransmuteFrom`, which we'll do in a follow-up commit to preserve nice git diffs. Makes progress on #1122
github-merge-queue bot
pushed a commit
that referenced
this issue
Oct 14, 2024
This commit adds a framework which supports encoding in the type system any `I -> I` mapping where `I` is any `Invariant` type. This permits us to make `cast_unsized`'s return value smarter, and as a result, allows us to remove a lot of `unsafe` code. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 14, 2024
This prepares us to rename `TransparentWrapper` to `TransmuteFrom`, which we'll do in a follow-up commit to preserve nice git diffs. Makes progress on #1122
joshlf
added a commit
that referenced
this issue
Oct 15, 2024
Makes progress on #1122 gherrit-pr-id: I7af68cdaa5ea47ab245a942d1cbd8bc5e6407223
This was referenced Oct 15, 2024
Closed by #1896 |
This was referenced Oct 22, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See also: #1359
Consider
Ptr::transparent_wrapper_into_inner
:zerocopy/src/pointer/ptr.rs
Lines 609 to 627 in be56a3a
Currently, if the validity invariant is
Initialized
and the validity variance isInvariant
, the returned pointer will have the validity invariantAny
. However, this throws away information: regardless of the specific validity requirements of a type, if all of the outer type's bytes are initialized, then the same is true of the inner type's bytes. In other words, theInitialized
validity invariant should be preserved regardless of the validity variance.In the general case, what we really need is the ability to express a generic mapping
(Invariant, Variance) -> Invariant
, which would allow us to express this behavior.In other conversion functions, each invariant can be mapped as either:
These conversion functions could similarly benefit from a generic mapping
Invariant -> Invariant
.The text was updated successfully, but these errors were encountered: