Skip to content

add safety doc (section header) to two unsafe methods in NonZero#155559

Open
hxuhack wants to merge 1 commit intorust-lang:mainfrom
safer-rust:fix-doc2
Open

add safety doc (section header) to two unsafe methods in NonZero#155559
hxuhack wants to merge 1 commit intorust-lang:mainfrom
safer-rust:fix-doc2

Conversation

@hxuhack
Copy link
Copy Markdown
Contributor

@hxuhack hxuhack commented Apr 20, 2026

This PR adds a Safety section to two unsafe methods in NonZero:

The safety documentation is now consistent with that of u8::unchecked_add and u8::unchecked_mul.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 20, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 20, 2026

r? @jhpratt

rustbot has assigned @jhpratt.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @scottmcm, libs
  • @scottmcm, libs expanded to 7 candidates
  • Random selection from Mark-Simulacrum, jhpratt, scottmcm

@jhpratt
Copy link
Copy Markdown
Member

jhpratt commented Apr 21, 2026

I have no idea what "as soon as" was even supposed to mean.

@bors r+ rollup

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 21, 2026

📌 Commit 0bfdb18 has been approved by jhpratt

It is now in the queue for this repository.

@rust-bors rust-bors bot 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 Apr 21, 2026
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants