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

Tweak Library Integer Division Docs #119726

Merged
merged 3 commits into from
Jan 22, 2024
Merged

Conversation

NCGThompson
Copy link
Contributor

@NCGThompson NCGThompson commented Jan 8, 2024

Improved the documentation and diagnostics related to panicking in the division-like methods in std:

  • For signed methods that can overflow, clarified "results in overflow" to "self is -1 and rhs is Self::MIN." This is more concise than saying "results in overflow" and then explaining how it could overflow.
  • For floor/ceil_div, corrected the documentation and made it more like the documentation in other methods.
  • For signed methods that can overflow, explicitly mention that they are not affected by compiler flags.
  • Removed all unused rustc_inherit_overflow_checks attributes. The non-division-like operations will never overflow.
  • Added track_caller attributes to all methods that can panic. The panic messages will always be correct. For example, division methods all have / before %.
  • Edited the saturating_div documentation to be consistent with similar methods.

@rustbot
Copy link
Collaborator

rustbot commented Jan 8, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @thomcc (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@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 Jan 8, 2024
@NCGThompson
Copy link
Contributor Author

Addresses #119682

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.

Thank you for the PR! Can you split the different changes into different commits? It's a bit hard to review them all at once. Use @rustbot ready when you've done that.

@Noratrieb Noratrieb added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 18, 2024
@NCGThompson
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 19, 2024
@Noratrieb
Copy link
Member

Thanks!
@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jan 21, 2024

📌 Commit 76659ae 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 Jan 21, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 22, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#118714 ( Explanation that fields are being used when deriving `(Partial)Ord` on enums)
 - rust-lang#119710 (Improve `let_underscore_lock`)
 - rust-lang#119726 (Tweak Library Integer Division Docs)
 - rust-lang#119746 (rustdoc: hide modals when resizing the sidebar)
 - rust-lang#119986 (Fix error counting)
 - rust-lang#120194 (Shorten `#[must_use]` Diagnostic Message for `Option::is_none`)
 - rust-lang#120200 (Correct the anchor of an URL in an error message)
 - rust-lang#120203 (Replace `#!/bin/bash` with `#!/usr/bin/env bash` in rust-installer tests)
 - rust-lang#120212 (Give nnethercote more reviews)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7d7c225 into rust-lang:master Jan 22, 2024
11 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Jan 22, 2024
@NCGThompson NCGThompson deleted the div-overflow-doc branch January 22, 2024 13:07
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 22, 2024
Rollup merge of rust-lang#119726 - NCGThompson:div-overflow-doc, r=Nilstrieb

Tweak Library Integer Division Docs

Improved the documentation and diagnostics related to panicking in the division-like methods in std:

* For signed methods that can overflow, clarified "results in overflow" to "self is -1 and rhs is Self::MIN." This is more concise than saying "results in overflow" and then explaining how it could overflow.
* For floor/ceil_div, corrected the documentation and made it more like the documentation in other methods.
* For signed methods that can overflow, explicitly mention that they are not affected by compiler flags.
* Removed all unused rustc_inherit_overflow_checks attributes. The non-division-like operations will never overflow.
* Added track_caller attributes to all methods that can panic. The panic messages will always be correct. For example, division methods all have / before %.
* Edited the saturating_div documentation to be consistent with similar methods.
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.

5 participants