Expand description
Tools and reasoning principles for raw pointers. The tools here are meant to address “real Rust pointers, including all their subtleties on the Rust Abstract Machine, to the largest extent that is reasonable.”
For a gentler introduction to some of the concepts here, see PPtr, which uses a much-simplified pointer model.
§Pointer model
A pointer consists of an address (ptr.addr() or ptr as usize), a provenance ptr@.provenance,
and metadata ptr@.metadata (which is trivial except for pointers to non-sized types).
Note that in spec code, pointer equality requires all 3 to be equal, whereas runtime equality (eq)
only compares addresses and metadata.
*mut T vs. *const T do not have any semantic difference and Verus treats them as the same;
they can be seamlessly cast to and fro.
Structs§
- Dealloc
- Permission to perform a deallocation with the global allocator.
- DeallocData 
- Data associated with a Deallocpermission.
- IsExposed
- Tracked object that indicates a given provenance has been exposed.
- PointsTo 
- Permission to access possibly-initialized, typed memory.
- PointsToData 
- Data associated with a PointsTopermission. We keep track of both the pointer and the (potentially uninitialized) value it points to.
- PointsToRaw 
- Variable-sized uninitialized memory.
- Provenance
- Provenance
- PtrData
- Model of a pointer *mut Tor*const Tin Rust’s abstract machine. In addition to the address, each pointer has its corresponding provenance and metadata.
- SharedReference 
- This is meant to be a replacement for &'a Tthat allows Verus to keep track of not just theTvalue but the pointer as well. It would be better to get rid of this and use normal reference types&'a T, but there are a lot of unsolved implementation questions. The existence ofSharedReference<'a, T>is a stop-gap.
Enums§
- MemContents
- Represents (typed) contents of memory.
Functions§
- _verus_external_ ⚠fn_ specification_ 3__ 60__ 32__ 42__ 32_ mut_ 32_ T_ 32_ as_ 32_ Partial Eq_ 32__ 60__ 32__ 42__ 32_ mut_ 32_ T_ 32__ 62__ 32__ 62__ 32__ 58__ 58__ 32_ eq 
- _verus_external_ ⚠fn_ specification_ 4__ 60__ 32__ 42__ 32_ const_ 32_ T_ 32_ as_ 32_ Partial Eq_ 32__ 60__ 32__ 42__ 32_ const_ 32_ T_ 32__ 62__ 32__ 62__ 32__ 58__ 58__ 32_ eq 
- _verus_external_ ⚠fn_ specification_ 5_ core_ 32__ 58__ 58__ 32_ ptr_ 32__ 58__ 58__ 32_ null 
- _verus_external_ ⚠fn_ specification_ 6_ core_ 32__ 58__ 58__ 32_ ptr_ 32__ 58__ 58__ 32_ null__ mut 
- allocate
- axiom_ptr_ mut_ from_ data 
- cast_array_ ptr_ to_ slice_ ptr 
- cast_ptr_ to_ thin_ ptr 
- cast_ptr_ to_ usize 
- deallocate
- expose_provenance 
- group_raw_ ptr_ axioms 
- ptr_from_ data 
- ptr_mut_ from_ data 
- ptr_mut_ read 
- ptr_mut_ write 
- ptr_null 
- ptr_null_ mut 
- ptr_ref
- ptr_ref2 
- ptrs_mut_ eq 
- ptrs_mut_ eq_ sized 
- spec_cast_ array_ ptr_ to_ slice_ ptr 
- spec_cast_ ptr_ to_ thin_ ptr 
- spec_cast_ ptr_ to_ usize 
- with_exposed_ provenance 
Type Aliases§
- Metadata
- Metadata