-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Deny unsafe operations in unsafe functions in libstd/alloc.rs #74333
Deny unsafe operations in unsafe functions in libstd/alloc.rs #74333
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
ab28219
to
c38230e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I left one comment, but that's rather a question. This PR is certainly an improvement.
// SAFETY: see the guarantees expected by `Layout::from_size_align` and | ||
// `GlobalAlloc::alloc`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But is it documented somewhere that the caller of __rdl_alloc
needs to make sure the parameters are valid according to Layout::from_size_align
? Same for the functions below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not to my knowledge, or at least I do not remember finding anything when searching for it. I read the code several times to check and saw nothing that invalidated that but I may have missed something.
@bors r+ |
📌 Commit c38230e has been approved by |
…arth Rollup of 4 pull requests Successful merges: - rust-lang#74333 (Deny unsafe operations in unsafe functions in libstd/alloc.rs) - rust-lang#74356 (Remove combine function) - rust-lang#74419 (Add a thumbv4t-none-eabi target) - rust-lang#74485 (More intra-doc links, add explicit exception list to linkchecker) Failed merges: - rust-lang#74486 (Improve Read::read_exact documentation) r? @ghost
Partial fix of #73904.
This encloses
unsafe
operations inunsafe fn
inlibstd/alloc.rs
.@rustbot modify labels: F-unsafe-block-in-unsafe-fn