Skip to content

Commit

Permalink
Use fully-qualified name for size_of
Browse files Browse the repository at this point in the history
  • Loading branch information
zhassan-aws committed Jan 16, 2025
1 parent 35015dc commit 90f2a2f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions library/kani_core/src/arbitrary/pointer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ macro_rules! ptr_generator {
let ptr = match status {
AllocationStatus::Dangling => {
// Generate potentially unaligned pointer.
let offset = kani::any_where(|b: &usize| *b < size_of::<T>());
let offset = kani::any_where(|b: &usize| *b < core::mem::size_of::<T>());
crate::ptr::NonNull::<T>::dangling().as_ptr().wrapping_add(offset)
}
AllocationStatus::DeadObject => {
Expand All @@ -279,7 +279,7 @@ macro_rules! ptr_generator {
AllocationStatus::OutOfBounds => {
// Generate potentially unaligned pointer.
let buf_ptr = addr_of_mut!(self.buf) as *mut u8;
let offset = kani::any_where(|b: &usize| *b < size_of::<T>());
let offset = kani::any_where(|b: &usize| *b < core::mem::size_of::<T>());
unsafe { buf_ptr.add(Self::BUF_LEN - offset) as *mut T }
}
};
Expand Down Expand Up @@ -331,7 +331,7 @@ macro_rules! ptr_generator {
"Cannot generate in-bounds object of the requested type. Buffer is not big enough."
);
let buf_ptr = addr_of_mut!(self.buf) as *mut u8;
let offset = kani::any_where(|b: &usize| *b <= Self::BUF_LEN - size_of::<T>());
let offset = kani::any_where(|b: &usize| *b <= Self::BUF_LEN - core::mem::size_of::<T>());
let ptr = unsafe { buf_ptr.add(offset) as *mut T };
let is_initialized = kani::any();
if is_initialized {
Expand All @@ -356,8 +356,8 @@ macro_rules! ptr_generator_fn {
() => {
/// Create a pointer generator that fits at least `N` elements of type `T`.
pub fn pointer_generator<T, const NUM_ELTS: usize>()
-> PointerGenerator<{ size_of::<T>() * NUM_ELTS }> {
PointerGenerator::<{ size_of::<T>() * NUM_ELTS }>::new()
-> PointerGenerator<{ core::mem::size_of::<T>() * NUM_ELTS }> {
PointerGenerator::<{ core::mem::size_of::<T>() * NUM_ELTS }>::new()
}
};
}
Expand Down

0 comments on commit 90f2a2f

Please sign in to comment.