Open celinval opened 3 months ago
Note that https://github.com/model-checking/kani/pull/3363 removes the decouple_lifetime
function, but untracked_deref
function is still unsafe and my cause UB for arguments that are dropped inside the function.
I was wondering if we can use something similar to Prusti's snapshots: https://viperproject.github.io/prusti-dev/dev-guide/encoding/types-snap.html to replace untracked_deref
.
Looking at the
kani::internal::Pointer
implementation for*mut T
:https://github.com/model-checking/kani/blob/1491dd6eaf453efc61e915e0a3d247c2ce03abaf/library/kani/src/internal.rs#L59-L63
This can trigger UB if the location pointed by
*mut T
does not contain a valid value of typeT
since it is converting it to a&T
. Converting*const T
into&mut T
and*mut T
to&mut T
is also unsafe, and may break aliasing rules.