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

doc: add note about panicking examples for strict_overflow_ops #121155

Merged
merged 2 commits into from
Feb 16, 2024

Conversation

tspiteri
Copy link
Contributor

The first commit adds a note before the panicking examples for strict_overflow_ops to make it clearer that the following examples should panic and why, without needing the reader to hover the mouse over the information icon.

The second commit adds panicking examples for division by zero operations for strict division operations on unsigned numbers. The signed numbers already have two panicking examples each: one for division by zero and one for overflowing division (MIN/-1); this commit includes the division by zero examples for the unsigned numbers.

@rustbot
Copy link
Collaborator

rustbot commented Feb 15, 2024

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
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

@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 Feb 15, 2024
@tspiteri
Copy link
Contributor Author

Some before and after screenshots.

Commit 1; i32::strict_div before:
image
Commit 1; i32::strict_div after:
image

Commit 2; u32::strict_div before:
image
Commit 2; u32::strict_div after:
image

Copy link
Member

@Noratrieb Noratrieb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for providing the screenshots as well, they make the improvement a lot clearer!

@Noratrieb
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Feb 15, 2024

📌 Commit 675d092 has been approved by Nilstrieb

It is now in the queue for this repository.

@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 Feb 15, 2024
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Feb 15, 2024
…lstrieb

doc: add note about panicking examples for strict_overflow_ops

The first commit adds a note before the panicking examples for strict_overflow_ops to make it clearer that the following examples should panic and why, without needing the reader to hover the mouse over the information icon.

The second commit adds panicking examples for division by zero operations for strict division operations on unsigned numbers. The signed numbers already have two panicking examples each: one for division by zero and one for overflowing division (`MIN/-1`); this commit includes the division by zero examples for the unsigned numbers.
oli-obk added a commit to oli-obk/rust that referenced this pull request Feb 15, 2024
…lstrieb

doc: add note about panicking examples for strict_overflow_ops

The first commit adds a note before the panicking examples for strict_overflow_ops to make it clearer that the following examples should panic and why, without needing the reader to hover the mouse over the information icon.

The second commit adds panicking examples for division by zero operations for strict division operations on unsigned numbers. The signed numbers already have two panicking examples each: one for division by zero and one for overflowing division (`MIN/-1`); this commit includes the division by zero examples for the unsigned numbers.
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 15, 2024
…llaumeGomez

Rollup of 13 pull requests

Successful merges:

 - rust-lang#118264 (Optimize `VecDeque::drain` for (half-)open ranges)
 - rust-lang#120741 (Make `io::BorrowedCursor::advance` safe)
 - rust-lang#120777 (Bump Unicode to version 15.1.0, regenerate tables)
 - rust-lang#120971 (Fix comment in core/src/str/validations.rs)
 - rust-lang#121034 (Improve wording of `static_mut_ref`)
 - rust-lang#121095 (Add extra indent spaces for rust-playground link)
 - rust-lang#121109 (Add an ErrorGuaranteed to ast::TyKind::Err (attempt 2))
 - rust-lang#121119 (Make `async Fn` trait kind errors better)
 - rust-lang#121141 (Fix closure kind docs)
 - rust-lang#121145 (Update aarch64 target feature docs to match LLVM)
 - rust-lang#121146 (Only point out non-diverging arms for match suggestions)
 - rust-lang#121147 (Avoid debug logging entire MIR body)
 - rust-lang#121155 (doc: add note about panicking examples for strict_overflow_ops)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 16, 2024
…llaumeGomez

Rollup of 10 pull requests

Successful merges:

 - rust-lang#120777 (Bump Unicode to version 15.1.0, regenerate tables)
 - rust-lang#120971 (Fix comment in core/src/str/validations.rs)
 - rust-lang#121095 (Add extra indent spaces for rust-playground link)
 - rust-lang#121109 (Add an ErrorGuaranteed to ast::TyKind::Err (attempt 2))
 - rust-lang#121119 (Make `async Fn` trait kind errors better)
 - rust-lang#121141 (Fix closure kind docs)
 - rust-lang#121145 (Update aarch64 target feature docs to match LLVM)
 - rust-lang#121146 (Only point out non-diverging arms for match suggestions)
 - rust-lang#121147 (Avoid debug logging entire MIR body)
 - rust-lang#121155 (doc: add note about panicking examples for strict_overflow_ops)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 2a216bb into rust-lang:master Feb 16, 2024
11 checks passed
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 16, 2024
Rollup merge of rust-lang#121155 - tspiteri:strict-doc-overflow, r=Nilstrieb

doc: add note about panicking examples for strict_overflow_ops

The first commit adds a note before the panicking examples for strict_overflow_ops to make it clearer that the following examples should panic and why, without needing the reader to hover the mouse over the information icon.

The second commit adds panicking examples for division by zero operations for strict division operations on unsigned numbers. The signed numbers already have two panicking examples each: one for division by zero and one for overflowing division (`MIN/-1`); this commit includes the division by zero examples for the unsigned numbers.
@rustbot rustbot added this to the 1.78.0 milestone Feb 16, 2024
@tspiteri tspiteri deleted the strict-doc-overflow branch February 16, 2024 15:15
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.

None yet

5 participants