-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Clarify preconditions of raw size/align methods #103372
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Clarify preconditions of raw size/align methods #103372
Conversation
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
r? @m-ou-se (rust-highfive has picked a reviewer for you, use r? to override) |
I think it'd perhaps be better worded as something around the shape of
This makes is clearer that "valid for reborrow" is always a sufficient precondition. |
The exception/note about reborrowing as &T now appears at both the top and bottom of the list of conditions, which is a bit confusing. Right now it's basically: "This function is safe to call if {A}. Otherwise: {list of conditions}. Otherwise, {A}." Isn't just the note at the start (as suggested by CAD97) enough? |
@Jules-Bertholet |
Closing this as inactive. Feel free to open a new PR if you wish to continue these changes |
The documentation of the preconditions of
mem::size_of_val_raw
,mem::align_of_val_raw
, andLayout::for_value_raw
was overly conservative. This PR resolves that problem.Discussion: #69835 (comment)