-
Notifications
You must be signed in to change notification settings - Fork 105
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
Implement FromZeroes
for Option
types?
#293
Labels
compatibility-nonbreaking
Changes that are (likely to be) non-breaking
experience-hard
This issue is hard, and requires a lot of experience
help wanted
Extra attention is needed
Comments
joshlf
added
help wanted
Extra attention is needed
experience-hard
This issue is hard, and requires a lot of experience
compatibility-nonbreaking
Changes that are (likely to be) non-breaking
labels
Aug 29, 2023
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Nov 3, 2023
Guarantee representation of None in NPO This allows users to soundly transmute zeroes into `Option` types subject to the null pointer optimization (NPO). It unblocks google/zerocopy#293.
joshlf
added a commit
that referenced
this issue
Nov 4, 2023
For thin pointer types, `P` (`Box<T>`, `&T`, `&mut T`, and `NonNull<T>` where `T: Sized`), implement `FromZeroes` for `Option<P>`. Release 0.7.25. Closes #293
This was referenced Nov 4, 2023
github-merge-queue bot
pushed a commit
that referenced
this issue
Nov 4, 2023
For thin pointer types, `P` (`Box<T>`, `&T`, `&mut T`, and `NonNull<T>` where `T: Sized`), implement `FromZeroes` for `Option<P>`. Release 0.7.25. Closes #293
github-actions bot
pushed a commit
to rust-lang/miri
that referenced
this issue
Nov 4, 2023
Guarantee representation of None in NPO This allows users to soundly transmute zeroes into `Option` types subject to the null pointer optimization (NPO). It unblocks google/zerocopy#293.
lnicola
pushed a commit
to lnicola/rust-analyzer
that referenced
this issue
Apr 7, 2024
Guarantee representation of None in NPO This allows users to soundly transmute zeroes into `Option` types subject to the null pointer optimization (NPO). It unblocks google/zerocopy#293.
RalfJung
pushed a commit
to RalfJung/rust-analyzer
that referenced
this issue
Apr 27, 2024
Guarantee representation of None in NPO This allows users to soundly transmute zeroes into `Option` types subject to the null pointer optimization (NPO). It unblocks google/zerocopy#293.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
compatibility-nonbreaking
Changes that are (likely to be) non-breaking
experience-hard
This issue is hard, and requires a lot of experience
help wanted
Extra attention is needed
Some
Option
types have known layouts/bit validity (e.g.,Option<&T>
whereT: Sized
). Are these actually guaranteed, or just "in practice everyone knows that's how the compiler does it"? If it's the former, and we know thatNone
is represented as a sequence of zeroes, then it should be sound to implementFromZeroes
for these types.Task:
T
, for which we can implementFromZeroes for Option<T>
(EDIT: Here's a breadcrumb)I've submitted rust-lang/rust#115333 to clarify the representation of
Option
s and hopefully unblock more of this issue.The text was updated successfully, but these errors were encountered: