pub struct Ghost<T: ?Sized>(/* private fields */);Expand description
A type that can be used in ghost! context.
This type may be used to make more complicated proofs possible. In particular, some proof may need a notion of non-duplicable token to carry around.
Conceptually, a Ghost<T> is an object of type T that resides in a special “ghost”
heap. This heap is inaccessible from normal code, and Ghost values cannot be used
to influence the behavior of normal code.
This box can be accessed in a ghost! block:
ⓘ
let b: Ghost<i32> = Ghost::new(1);
ghost! {
let value: i32 = b.into_inner();
// use value here
}
let value: i32 = b.into_inner(); // compile error !Implementations§
Source§impl<T: ?Sized> Ghost<T>
impl<T: ?Sized> Ghost<T>
Sourcepub fn borrow_mut(&mut self) -> Ghost<&mut T>
pub fn borrow_mut(&mut self) -> Ghost<&mut T>
Transforms a &mut Ghost<T> into a Ghost<&mut T>.
Trait Implementations§
Source§impl<'a, L> NonAtomicInvariantExt<'a> for &'a Ghost<L>
impl<'a, L> NonAtomicInvariantExt<'a> for &'a Ghost<L>
Source§impl<'a, T: Protocol> NonAtomicInvariantExt<'a> for Ghost<&'a NonAtomicInvariant<T>>
impl<'a, T: Protocol> NonAtomicInvariantExt<'a> for Ghost<&'a NonAtomicInvariant<T>>
Source§impl<'a, T> NonAtomicInvariantExt<'a> for Ghost<&'a T>
impl<'a, T> NonAtomicInvariantExt<'a> for Ghost<&'a T>
impl<T: Copy> Copy for Ghost<T>
impl<T: ?Sized> Invariant for Ghost<T>
Auto Trait Implementations§
impl<T> Freeze for Ghost<T>where
T: ?Sized,
impl<T> RefUnwindSafe for Ghost<T>where
T: RefUnwindSafe + ?Sized,
impl<T> Send for Ghost<T>
impl<T> Sync for Ghost<T>
impl<T> Unpin for Ghost<T>
impl<T> UnsafeUnpin for Ghost<T>where
T: ?Sized,
impl<T> UnwindSafe for Ghost<T>where
T: UnwindSafe + ?Sized,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more