Skip to content

Commit d0603fd

Browse files
Use a saturating_mul instead of a checked_mul
and `unwrap` in `core::intrinsics`.
1 parent 2a71115 commit d0603fd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/core/src/intrinsics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2519,7 +2519,7 @@ pub(crate) fn is_valid_allocation_size<T>(len: usize) -> bool {
25192519
pub(crate) fn is_nonoverlapping<T>(src: *const T, dst: *const T, count: usize) -> bool {
25202520
let src_usize = src.addr();
25212521
let dst_usize = dst.addr();
2522-
let size = mem::size_of::<T>().checked_mul(count).unwrap();
2522+
let size = mem::size_of::<T>().saturating_mul(count);
25232523
let diff = if src_usize > dst_usize { src_usize - dst_usize } else { dst_usize - src_usize };
25242524
// If the absolute distance between the ptrs is at least as big as the size of the buffer,
25252525
// they do not overlap.

0 commit comments

Comments
 (0)