FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Shrink unsafe blocks by peamaeq · Pull Request #220 · bluss/arrayvec · GitHub

/ arrayvec Public

Shrink unsafe blocks - #220

Closed
peamaeq wants to merge 1 commit into
bluss:masterfrom
peamaeq:master
Closed

Shrink unsafe blocks#220
peamaeq wants to merge 1 commit into
bluss:masterfrom
peamaeq:master

Conversation

peamaeq commented Jun 23, 2022

Copy link
Copy Markdown

In these function you use the unsafe keyword for some safe expressions.

We need to mark unsafe operations more precisely using unsafe keyword. Keeping unsafe blocks small can bring many benefits. For example, when mistakes happen, we can locate any errors related to memory safety within an unsafe block. This is the balance between Safe and Unsafe Rust. The separation is designed to make using Safe Rust as ergonomic as possible, but requires extra effort and care when writing Unsafe Rust.

Hope this PR can help you.
Best regards.
References
https://doc.rust-lang.org/nomicon/safe-unsafe-meaning.html
https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html

tbu- commented Jun 23, 2022

Copy link
Copy Markdown
Collaborator

I don't see that this brings much benefit. The parts you moved outside of the unsafe blocks are part of the code that upholds the safety.

bluss commented Nov 12, 2022

Copy link
Copy Markdown
Owner

Thanks and my thoughts echo what @tbu- said. While the PR's changes are correct and harmless, this is not a logic for updating unsafe code blocks that I believe in.

bluss closed this Nov 12, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL