@@ -168,15 +168,14 @@ macro_rules! kani_mem {
168
168
169
169
/// Checks that `ptr` points to an allocation that can hold data of size calculated from `T`.
170
170
///
171
- /// This will panic if `ptr` points to an invalid `non_null`
172
- /// Returns `false` if:
173
- /// - The computed size overflows.
174
- /// - The computed size exceeds `isize::MAX`.
175
- /// - The pointer is null (except for zero-sized types).
176
- /// - The pointer references unallocated memory.
177
- ///
178
- /// This function aligns with Rust's memory safety requirements, which restrict valid allocations
179
- /// to sizes no larger than `isize::MAX`.
171
+ /// This function always returns `true` for ZSTs, since every pointer to a ZST is valid.
172
+ /// For non-ZSTs, this function will:
173
+ /// - Panic if `ptr` does not point to allocated memory,
174
+ /// - Return `false` if the size of the val pointed to exceeds `isize::MAX`,
175
+ /// - Return `false` if the pointer is null.
176
+ ///
177
+ /// If none of the above conditions hold, it will return `true` if and only if
178
+ /// `ptr` points to allocated memory that can hold data of size calculated from `T`.
180
179
#[ crate :: kani:: unstable_feature(
181
180
feature = "mem-predicates" ,
182
181
issue = 3946 ,
@@ -192,7 +191,7 @@ macro_rules! kani_mem {
192
191
} else {
193
192
// Note that this branch can't be tested in concrete execution as `is_read_ok` needs to be
194
193
// stubbed.
195
- // We first assert that the data_ptr
194
+ // We first assert that the data_ptr points to a valid allocation.
196
195
let data_ptr = ptr as * const ( ) ;
197
196
if !unsafe { is_allocated( data_ptr, 0 ) } {
198
197
crate :: kani:: unsupported(
0 commit comments