Skip to content
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

Merged

Conversation

poliorcetics
Copy link
Contributor

Partial fix of #73904.

This encloses unsafe operations in unsafe fn in libstd/alloc.rs.

@rustbot modify labels: F-unsafe-block-in-unsafe-fn

@rust-highfive
Copy link
Collaborator

r? @LukasKalbertodt

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 14, 2020
Copy link
Member

@LukasKalbertodt LukasKalbertodt left a 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.

Comment on lines +340 to +341
// SAFETY: see the guarantees expected by `Layout::from_size_align` and
// `GlobalAlloc::alloc`.
Copy link
Member

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.

Copy link
Contributor Author

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.

@LukasKalbertodt
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jul 19, 2020

📌 Commit c38230e has been approved by LukasKalbertodt

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 19, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 19, 2020
…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
@bors bors merged commit 2f3d64f into rust-lang:master Jul 19, 2020
@poliorcetics poliorcetics deleted the std-alloc-unsafe-op-in-unsafe-fn branch July 19, 2020 19:00
@cuviper cuviper added this to the 1.47.0 milestone May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-unsafe-block-in-unsafe-fn RFC #2585 S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants