-
Notifications
You must be signed in to change notification settings - Fork 533
clarify when reading uninititalized memory is allowed #852
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,11 @@ code. | |
> **Note**: `rustc` achieves this with the unstable | ||
> `rustc_layout_scalar_valid_range_*` attributes. | ||
|
||
Note that uninitialized memory is also implicitly invalid for any type that has | ||
a restricted set of valid values. In other words, the only cases in which | ||
RalfJung marked this conversation as resolved.
Show resolved
Hide resolved
|
||
reading uninitialized memory is permitted is inside `union`s, and between the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can probably just minimize the second part to just "padding". We also don't define "compound type" anywhere, so it's probably best not to use it. We do define "user defined type" for struct/enum/union though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's all "types with fields" though that I mean by "compound type" -- so, including tuples and arrays.
RalfJung marked this conversation as resolved.
Show resolved
Hide resolved
|
||
fields of a compound type (in the "padding"). | ||
|
||
A reference/pointer is "dangling" if it is null or not all of the bytes it | ||
points to are part of the same allocation (so in particular they all have to be | ||
part of *some* allocation). The span of bytes it points to is determined by the | ||
|
Uh oh!
There was an error while loading. Please reload this page.