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

Eliminate the pub field in Atom #36

Open
kmcallister opened this issue Oct 22, 2014 · 1 comment
Open

Eliminate the pub field in Atom #36

kmcallister opened this issue Oct 22, 2014 · 1 comment
Labels

Comments

@kmcallister
Copy link
Contributor

Right now the data field is public for use by the atom!() macro. You can violate memory safety by putting garbage in this field. We should make it private somehow, or get support into rustc for unsafe fields.

@SimonSapin
Copy link
Member

I’ve started https://internals.rust-lang.org/t/matching-on-struct-patterns-with-private-read-only-fields/3499 to discuss what can be done at the language level to help with this. The lead that sounds most likely to me is nrc’s comment:

I certainly plan to make privacy hygiene a thing for macros, not sure when that will happen though

In the meantime, #160 renames the field to unsafe_data and hides it in rustdoc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants