Skip to content

Allocation::bytes should be private #62931

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

Closed
RalfJung opened this issue Jul 24, 2019 · 2 comments · Fixed by #63561
Closed

Allocation::bytes should be private #62931

RalfJung opened this issue Jul 24, 2019 · 2 comments · Fixed by #63561
Labels
T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@RalfJung
Copy link
Member

RalfJung commented Jul 24, 2019

The bytes field of an Allocation is a very subtle one -- the values in there often do not mean what one might intuitively think. First of all the doc comment should probably be improved, but secondly I think we need to make this field private. See #62655 (comment) for a very subtle bug that happened because it was not private.

Cc @oli-obk @eddyb

@jonas-schievink jonas-schievink added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jul 24, 2019
@eddyb
Copy link
Member

eddyb commented Jul 24, 2019

Might also help to rename it to something like unrelocated_bytes.

@RalfJung
Copy link
Member Author

unrelocated_raw_maybe_initialized_bytes_dont_touch

HeroicKatora added a commit to HeroicKatora/rust that referenced this issue Aug 17, 2019
Direct access to the bytes was previously a problem (rust-lang#62931) where
components would read their contents without properly checking
relocations and/or definedness.

Making bytes private instead of purely renaming them also helps in
allowing amendments to their allocation scheme (such as eliding
allocation for undef of constant regions).
@bors bors closed this as completed in b505208 Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants