add safety doc (section header) to two unsafe methods in NonZero#155559
Open
hxuhack wants to merge 1 commit intorust-lang:mainfrom
Open
add safety doc (section header) to two unsafe methods in NonZero#155559hxuhack wants to merge 1 commit intorust-lang:mainfrom
NonZero#155559hxuhack wants to merge 1 commit intorust-lang:mainfrom
Conversation
Collaborator
|
r? @jhpratt rustbot has assigned @jhpratt. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Member
|
I have no idea what "as soon as" was even supposed to mean. @bors r+ rollup |
Contributor
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Apr 21, 2026
add safety doc (section header) to two unsafe methods in `NonZero` This PR adds a Safety section to two unsafe methods in `NonZero`: - [unchecked_add](https://doc.rust-lang.org/nightly/core/num/struct.NonZero.html#method.unchecked_add) - [unchecked_mul](https://doc.rust-lang.org/nightly/core/num/struct.NonZero.html#method.unchecked_mul) The safety documentation is now consistent with that of [`u8::unchecked_add`](https://doc.rust-lang.org/nightly/core/primitive.u8.html#method.unchecked_add) and [`u8::unchecked_mul`](https://doc.rust-lang.org/nightly/core/primitive.u8.html#method.unchecked_mul).
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Apr 21, 2026
add safety doc (section header) to two unsafe methods in `NonZero` This PR adds a Safety section to two unsafe methods in `NonZero`: - [unchecked_add](https://doc.rust-lang.org/nightly/core/num/struct.NonZero.html#method.unchecked_add) - [unchecked_mul](https://doc.rust-lang.org/nightly/core/num/struct.NonZero.html#method.unchecked_mul) The safety documentation is now consistent with that of [`u8::unchecked_add`](https://doc.rust-lang.org/nightly/core/primitive.u8.html#method.unchecked_add) and [`u8::unchecked_mul`](https://doc.rust-lang.org/nightly/core/primitive.u8.html#method.unchecked_mul).
rust-bors bot
pushed a commit
that referenced
this pull request
Apr 21, 2026
Rollup of 5 pull requests Successful merges: - #155532 (Fix redundant boolean comparison in `Mutex::try_lock`) - #155558 (Clarify that isqrt returns the principal (non-negative) square root) - #155559 (add safety doc (section header) to two unsafe methods in `NonZero`) - #155564 (Implement const Default for &CStr) - #155565 (constify `Vec` comparisons)
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a Safety section to two unsafe methods in
NonZero:The safety documentation is now consistent with that of
u8::unchecked_addandu8::unchecked_mul.