From eaeaf027734624fa1fb0463be3b7681380412f68 Mon Sep 17 00:00:00 2001 From: Carolyn Zech Date: Tue, 27 Aug 2024 13:21:21 -0400 Subject: [PATCH] condense zst contract for readability Co-authored-by: Michael Tautschnig --- library/core/src/ptr/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index eef70c833113b..170499e6df86f 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -1887,7 +1887,7 @@ pub unsafe fn write_volatile(dst: *mut T, src: T) { #[safety::requires(a.is_power_of_two())] // If T is a ZST, then answer should either be 0 or usize::MAX #[safety::ensures(|result| - mem::size_of::() != 0 || (p.addr() % a == 0 && *result == 0) || (p.addr() % a != 0 && *result == usize::MAX) + mem::size_of::() != 0 || if p.addr() % a == 0 { *result == 0 } else { *result == usize::MAX}) )] #[safety::ensures(|result| { // If T is not a ZST and p can be aligned, then applying result as an offest should produce an aligned address