Skip to content
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

Guarantee that uninitialized bytes have no bit validity #1411

Open
joshlf opened this issue Sep 30, 2023 · 0 comments
Open

Guarantee that uninitialized bytes have no bit validity #1411

joshlf opened this issue Sep 30, 2023 · 0 comments

Comments

@joshlf
Copy link
Contributor

joshlf commented Sep 30, 2023

While this has been discussed before, it's not explicitly documented in the reference.

A few open questions:

  • Does it make sense to speak about uninitialized bytes in general, or only about padding bytes? Does Rust currently have other forms of uninitialized bytes?
  • Does it make sense to also define that uninitialized bytes cannot be "observed"? Currently, the closest that we have to this is statements on bit validity for various primitive types, which refer to uninitialized bytes, but do not define what they are (e.g., bools, numeric types, etc).
    • I could see an argument that we don't need to talk about "observing" in the general sense; it is sufficient to define that it is UB to transmute an uninitialized byte to another type. In fact, it should technically be sufficient not to define that it is sound to transmute an uninitialized byte to a type; since there are no types for which this is sound, there exists no soundness proof for code which would attempt to do this regardless of "intermediate" type.
  • Where would be best to document this?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant