You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Requested feature: Enable contracts for functions that modify memory via encapsulated pointer.
Use case: Kani contracts require that all writeable memory to be specified. However, they may not be visible in the current context
Link to relevant documentation (Rust reference, Nomicon, RFC):
Test case:
mod heap {#[derive(Default)]pubstructHeapArray<T,constN:usize>{inner:Box<[T;N]>,}impl<T,constN:usize>HeapArray<T,N>{pubfnset(&mutself,val:T,idx:usize){}}}mod other {structStack<T>{buf:HeapArray,next:usize,}impl<T>Stack<T>{#[modifies(buf)]// This is not enough today#[kani::ensures(|_| self.contains(val))]fnenqueue(&mutself,val:T){assert!(!self.is_full());self.buf.set(val, next);}}}
A good example here is Arc, which contains a pointer to an ArcInner which includes the object itself, but also an atomic counter which is changed in get_mut.
Activity
celinval commentedon Jul 25, 2024
A good example here is
Arc, which contains a pointer to anArcInnerwhich includes the object itself, but also an atomic counter which is changed inget_mut.