We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents ee9b804 + 3dba587 commit 6e9a52cCopy full SHA for 6e9a52c
library/core/src/intrinsics.rs
@@ -2519,7 +2519,9 @@ pub(crate) fn is_valid_allocation_size<T>(len: usize) -> bool {
2519
pub(crate) fn is_nonoverlapping<T>(src: *const T, dst: *const T, count: usize) -> bool {
2520
let src_usize = src.addr();
2521
let dst_usize = dst.addr();
2522
- let size = mem::size_of::<T>().checked_mul(count).unwrap();
+ let size = mem::size_of::<T>()
2523
+ .checked_mul(count)
2524
+ .expect("is_nonoverlapping: `size_of::<T>() * count` overflows a usize");
2525
let diff = if src_usize > dst_usize { src_usize - dst_usize } else { dst_usize - src_usize };
2526
// If the absolute distance between the ptrs is at least as big as the size of the buffer,
2527
// they do not overlap.
0 commit comments