Enum miri::borrow_tracker::tree_borrows::perms::PermissionPriv
source · enum PermissionPriv {
ReservedFrz {
conflicted: bool,
},
ReservedIM,
Active,
Frozen,
Disabled,
}
Expand description
The activation states of a pointer.
Variants§
ReservedFrz
represents: a local mutable reference that has not yet been written to; allows: child reads, foreign reads; affected by: child writes (becomes Active), rejects: foreign writes (Disabled).
ReservedFrz
is mostly for types that are Freeze
(no interior mutability).
If the type has interior mutability, see ReservedIM
instead.
(Note: since the discovery of tests/fail/tree_borrows/reservedim_spurious_write.rs
,
we also use ReservedFreeze
for mutable references that were retagged with a protector
independently of interior mutability)
special case: behaves differently when protected, which is where conflicted
is relevant
conflicted
is set on foreign reads,conflicted
must not be set on child writes (there is UB otherwise).
This is so that the behavior of Reserved
adheres to the rules of noalias
:
- foreign-read then child-write is UB due to
conflicted
, - child-write then foreign-read is UB since child-write will activate and then
foreign-read disables a protected
Active
, which is UB.
ReservedIM
Alternative version of ReservedFrz
made for types with interior mutability.
allows: child reads, foreign reads, foreign writes (extra);
affected by: child writes (becomes Active);
rejects: nothing.
Active
represents: a unique pointer; allows: child reads, child writes; rejects: foreign reads (Frozen), foreign writes (Disabled).
Frozen
represents: a shared pointer; allows: all read accesses; rejects child writes (UB), foreign writes (Disabled).
Disabled
represents: a dead pointer; allows: all foreign accesses; rejects: all child accesses (UB).
Implementations§
source§impl PermissionPriv
impl PermissionPriv
sourcefn is_initial(&self) -> bool
fn is_initial(&self) -> bool
Check if self
can be the initial state of a pointer.
sourcefn compatible_with_protector(&self) -> bool
fn compatible_with_protector(&self) -> bool
Reject ReservedIM
that cannot exist in the presence of a protector.
Trait Implementations§
source§impl Clone for PermissionPriv
impl Clone for PermissionPriv
source§fn clone(&self) -> PermissionPriv
fn clone(&self) -> PermissionPriv
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PermissionPriv
impl Debug for PermissionPriv
source§impl Display for PermissionPriv
impl Display for PermissionPriv
source§impl Hash for PermissionPriv
impl Hash for PermissionPriv
source§impl PartialEq for PermissionPriv
impl PartialEq for PermissionPriv
source§impl PartialOrd for PermissionPriv
impl PartialOrd for PermissionPriv
source§fn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
PermissionPriv is ordered by the reflexive transitive closure of
Reserved(conflicted=false) < Reserved(conflicted=true) < Active < Frozen < Disabled
.
Reserved
that have incompatible ty_is_freeze
are incomparable to each other.
This ordering matches the reachability by transitions, as asserted by the exhaustive test
permissionpriv_partialord_is_reachability
.
impl Copy for PermissionPriv
impl Eq for PermissionPriv
impl StructuralPartialEq for PermissionPriv
Auto Trait Implementations§
impl Freeze for PermissionPriv
impl RefUnwindSafe for PermissionPriv
impl Send for PermissionPriv
impl Sync for PermissionPriv
impl Unpin for PermissionPriv
impl UnwindSafe for PermissionPriv
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 1 byte
Size for each variant:
ReservedFrz
: 1 byteReservedIM
: 0 bytesActive
: 0 bytesFrozen
: 0 bytesDisabled
: 0 bytes