From 44196af562b093ba54dadef455a66da17a7ce14b Mon Sep 17 00:00:00 2001 From: Qinheping Hu Date: Fri, 8 Nov 2024 15:46:36 -0600 Subject: [PATCH] Update library/core/src/str/pattern.rs Co-authored-by: Celina G. Val --- library/core/src/str/pattern.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/str/pattern.rs b/library/core/src/str/pattern.rs index 8c168400f7df0..489cf3a09bb16 100644 --- a/library/core/src/str/pattern.rs +++ b/library/core/src/str/pattern.rs @@ -1960,8 +1960,8 @@ unsafe fn small_slice_eq(x: &[u8], y: &[u8]) -> bool { let (pxend, pyend) = (px.add(x.len() - 4), py.add(y.len() - 4)); #[loop_invariant(crate::ub_checks::same_allocation(x.as_ptr(), px) && crate::ub_checks::same_allocation(y.as_ptr(), py) - && px as isize >= x.as_ptr() as isize - && py as isize >= y.as_ptr() as isize + && px.addr() >= x.addr() + && py.addr() >= y.addr() && px as isize - x.as_ptr() as isize == (py as isize - y.as_ptr() as isize))] while px < pxend { let vx = (px as *const u32).read_unaligned();