-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Add a message for if an overflow occurs in core::intrinsics::is_nonoverlapping
.
#110388
Conversation
and `unwrap` in `core::intrinsics`.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @scottmcm (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 (
|
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
saturating_mul
instead of a checked_mul
saturating_mul
instead of a checked_mul
and unwrap
in core::intrinsics
.
Since this does something different, can you elaborate on why this is better? Is there a test that should be added? |
I just kind of wanted to get rid of the |
maybe something like this? let size = mem::size_of::<T>()
.checked_mul(count)
.expect("is_nonoverlapping: size_of::<T>() * count overflows a usize"); |
|
`core::intrinsics::is_nonoverlapping`.
saturating_mul
instead of a checked_mul
and unwrap
in core::intrinsics
.core::intrinsics::is_nonoverlapping
.
I have changed it to be an explicit error message on overflow. |
@bors r+ rollup |
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#110038 (Erase regions when confirming transmutability candidate) - rust-lang#110341 (rustdoc: stop passing a title to `replaceState` second argument) - rust-lang#110388 (Add a message for if an overflow occurs in `core::intrinsics::is_nonoverlapping`.) - rust-lang#110404 (fix clippy::toplevel_ref_arg and ::manual_map) - rust-lang#110421 (Spelling librustdoc) - rust-lang#110423 (Spelling srcdoc) - rust-lang#110433 (Windows: map a few more error codes to ErrorKind) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
No description provided.