Struct miri::borrow_tracker::tree_borrows::perms::PermTransition
source · pub struct PermTransition {
from: PermissionPriv,
to: PermissionPriv,
}
Expand description
Transition from one permission to the next.
Fields§
§from: PermissionPriv
§to: PermissionPriv
Implementations§
source§impl PermTransition
impl PermTransition
sourcepub fn summary(&self) -> &'static str
pub fn summary(&self) -> &'static str
Readable explanation of the consequences of an event. Fits in the sentence “This accessed caused {trans.summary()}”.
Important: for the purposes of this explanation, Reserved
is considered
to have write permissions, because that’s what the diagnostics care about
(otherwise Reserved -> Frozen
would be considered a noop).
sourcepub(in borrow_tracker::tree_borrows) fn is_relevant(
&self,
err: TransitionError
) -> bool
pub(in borrow_tracker::tree_borrows) fn is_relevant( &self, err: TransitionError ) -> bool
Determines whether self
is a relevant transition for the error err
.
self
will be a transition that happened to a tag some time before
that tag caused the error.
Irrelevant events:
- modifications of write permissions when the error is related to read permissions
(on failed reads and protected
Frozen -> Disabled
, ignoreReserved -> Active
,Reserved -> Frozen
, andActive -> Frozen
) - all transitions for attempts to deallocate strongly protected tags
Panics
This function assumes that its arguments apply to the same location and that they were obtained during a normal execution. It will panic otherwise.
- all transitions involved in
self
anderr
should be increasing (Reserved < Active < Frozen < Disabled); - between
self
anderr
the permission should also be increasing, so all permissions insideerr
should be greater thanself.1
; Active
andReserved
cannot cause an error due to insufficient permissions, soerr
cannot be aChildAccessForbidden(_)
of either of them;err
should not beProtectedDisabled(Disabled)
, because the protected tag should not have beenDisabled
in the first place (if this occurs it means we have unprotected tags that become protected)
sourcepub fn endpoint(&self) -> Permission
pub fn endpoint(&self) -> Permission
Endpoint of a transition.
Meant only for diagnostics, use applied
in non-diagnostics
code, which also checks that the starting point matches the current state.
source§impl PermTransition
impl PermTransition
sourcefn is_possible(self) -> bool
fn is_possible(self) -> bool
All transitions created through normal means (using perform_access
)
should be possible, but the same is not guaranteed by construction of
transitions inferred by diagnostics. This checks that a transition
reconstructed by diagnostics is indeed one that could happen.
pub fn from(from: Permission, to: Permission) -> Option<Self>
pub fn is_noop(self) -> bool
sourcepub fn applied(self, starting_point: Permission) -> Option<Permission>
pub fn applied(self, starting_point: Permission) -> Option<Permission>
Extract result of a transition (checks that the starting point matches).
sourcepub fn started(self) -> Permission
pub fn started(self) -> Permission
Extract starting point of a transition
sourcepub fn produces_disabled(self) -> bool
pub fn produces_disabled(self) -> bool
Determines if this transition would disable the permission.
Trait Implementations§
source§impl Clone for PermTransition
impl Clone for PermTransition
source§fn clone(&self) -> PermTransition
fn clone(&self) -> PermTransition
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PermTransition
impl Debug for PermTransition
source§impl Display for PermTransition
impl Display for PermTransition
source§impl PartialEq<PermTransition> for PermTransition
impl PartialEq<PermTransition> for PermTransition
source§fn eq(&self, other: &PermTransition) -> bool
fn eq(&self, other: &PermTransition) -> bool
self
and other
values to be equal, and is used
by ==
.impl Copy for PermTransition
impl Eq for PermTransition
impl StructuralEq for PermTransition
impl StructuralPartialEq for PermTransition
Auto Trait Implementations§
impl RefUnwindSafe for PermTransition
impl Send for PermTransition
impl Sync for PermTransition
impl Unpin for PermTransition
impl UnwindSafe for PermTransition
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
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: 2 bytes