accessing private fields is not safe, and io isn't scary#26603
Conversation
|
r? @huonw (rust_highfive has picked a reviewer for you, use r? to override) |
|
@bors: r+ rollup |
|
📌 Commit 9001da6 has been approved by |
There was a problem hiding this comment.
How does this interact with what it says 18 lines previously?
[Behavior considered undefined] Invalid values in primitive types, even in private fields/locals
Is it now ok in private fields, since private fields are not permitted to be read?
There was a problem hiding this comment.
I think it's fine to make a private mem::uninitialized as long as a public consumer can't observe it. Making a bool = 3 is still invalid, though.
There was a problem hiding this comment.
What's the difference between a private field bool = 3, and the same field being mem::uninitialized? Presumably it's essentially illegal to read such a thing in both cases, but they should be fine to be "write only".
There was a problem hiding this comment.
I think I answered my own question why it's not a good idea to allow (see forum).
Quick poll of basically the entire core team says this is ok.
Quick poll of basically the entire core team says this is ok.