Skip to content

Commit

Permalink
condense zst contract for readability
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Tautschnig <mt@debian.org>
  • Loading branch information
carolynzech and tautschnig committed Aug 27, 2024
1 parent b3572ea commit eaeaf02
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/core/src/ptr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1887,7 +1887,7 @@ pub unsafe fn write_volatile<T>(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::<T>() != 0 || (p.addr() % a == 0 && *result == 0) || (p.addr() % a != 0 && *result == usize::MAX)
mem::size_of::<T>() != 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
Expand Down

0 comments on commit eaeaf02

Please sign in to comment.