pub enum State<V> {
Unreachable,
Reachable(StateData<V>),
}
Expand description
Dataflow state.
Every instance specifies a lattice that represents the possible values of a single tracked
place. If we call this lattice V
and set of tracked places P
, then a State
is an
element of {unreachable} ∪ (P -> V)
. This again forms a lattice, where the bottom element is
unreachable
and the top element is the mapping p ↦ ⊤
. Note that the mapping p ↦ ⊥
is not
the bottom element (because joining an unreachable and any other reachable state yields a
reachable state). All operations on unreachable states are ignored.
Flooding means assigning a value (by default ⊤
) to all tracked projections of a given place.
Variants§
Implementations§
Source§impl<V: Clone + HasBottom> State<V>
impl<V: Clone + HasBottom> State<V>
pub fn new_reachable() -> State<V>
pub fn all_bottom(&self) -> bool
pub fn is_reachable(&self) -> bool
Sourcepub fn flood_with(&mut self, place: PlaceRef<'_>, map: &Map<'_>, value: V)
pub fn flood_with(&mut self, place: PlaceRef<'_>, map: &Map<'_>, value: V)
Assign value
to all places that are contained in place
or may alias one.
Sourcepub fn flood(&mut self, place: PlaceRef<'_>, map: &Map<'_>)where
V: HasTop,
pub fn flood(&mut self, place: PlaceRef<'_>, map: &Map<'_>)where
V: HasTop,
Assign TOP
to all places that are contained in place
or may alias one.
Sourcefn flood_discr_with(&mut self, place: PlaceRef<'_>, map: &Map<'_>, value: V)
fn flood_discr_with(&mut self, place: PlaceRef<'_>, map: &Map<'_>, value: V)
Assign value
to the discriminant of place
and all places that may alias it.
Sourcepub fn flood_discr(&mut self, place: PlaceRef<'_>, map: &Map<'_>)where
V: HasTop,
pub fn flood_discr(&mut self, place: PlaceRef<'_>, map: &Map<'_>)where
V: HasTop,
Assign TOP
to the discriminant of place
and all places that may alias it.
Sourcepub fn flood_with_tail_elem(
&mut self,
place: PlaceRef<'_>,
tail_elem: Option<TrackElem>,
map: &Map<'_>,
value: V,
)
pub fn flood_with_tail_elem( &mut self, place: PlaceRef<'_>, tail_elem: Option<TrackElem>, map: &Map<'_>, value: V, )
This method is the most general version of the flood_*
method.
Assign value
on the given place and all places that may alias it. In particular, when
the given place has a variant downcast, we invoke the function on all the other variants.
tail_elem
allows to support discriminants that are not a place in MIR, but that we track
as such.
Sourcefn insert_idx(
&mut self,
target: PlaceIndex,
result: ValueOrPlace<V>,
map: &Map<'_>,
)
fn insert_idx( &mut self, target: PlaceIndex, result: ValueOrPlace<V>, map: &Map<'_>, )
Low-level method that assigns to a place. This does nothing if the place is not tracked.
The target place must have been flooded before calling this method.
Sourcepub fn insert_value_idx(&mut self, target: PlaceIndex, value: V, map: &Map<'_>)
pub fn insert_value_idx(&mut self, target: PlaceIndex, value: V, map: &Map<'_>)
Low-level method that assigns a value to a place. This does nothing if the place is not tracked.
The target place must have been flooded before calling this method.
Sourcepub fn insert_place_idx(
&mut self,
target: PlaceIndex,
source: PlaceIndex,
map: &Map<'_>,
)
pub fn insert_place_idx( &mut self, target: PlaceIndex, source: PlaceIndex, map: &Map<'_>, )
Copies source
to target
, including all tracked places beneath.
If target
contains a place that is not contained in source
, it will be overwritten with
Top. Also, because this will copy all entries one after another, it may only be used for
places that are non-overlapping or identical.
The target place must have been flooded before calling this method.
Sourcepub fn assign(
&mut self,
target: PlaceRef<'_>,
result: ValueOrPlace<V>,
map: &Map<'_>,
)where
V: HasTop,
pub fn assign(
&mut self,
target: PlaceRef<'_>,
result: ValueOrPlace<V>,
map: &Map<'_>,
)where
V: HasTop,
Helper method to interpret target = result
.
Sourcepub fn assign_discr(
&mut self,
target: PlaceRef<'_>,
result: ValueOrPlace<V>,
map: &Map<'_>,
)where
V: HasTop,
pub fn assign_discr(
&mut self,
target: PlaceRef<'_>,
result: ValueOrPlace<V>,
map: &Map<'_>,
)where
V: HasTop,
Helper method for assignments to a discriminant.
Sourcepub fn try_get(&self, place: PlaceRef<'_>, map: &Map<'_>) -> Option<V>
pub fn try_get(&self, place: PlaceRef<'_>, map: &Map<'_>) -> Option<V>
Retrieve the value stored for a place, or None
if it is not tracked.
Sourcepub fn try_get_discr(&self, place: PlaceRef<'_>, map: &Map<'_>) -> Option<V>
pub fn try_get_discr(&self, place: PlaceRef<'_>, map: &Map<'_>) -> Option<V>
Retrieve the discriminant stored for a place, or None
if it is not tracked.
Sourcepub fn try_get_len(&self, place: PlaceRef<'_>, map: &Map<'_>) -> Option<V>
pub fn try_get_len(&self, place: PlaceRef<'_>, map: &Map<'_>) -> Option<V>
Retrieve the slice length stored for a place, or None
if it is not tracked.
Sourcepub fn try_get_idx(&self, place: PlaceIndex, map: &Map<'_>) -> Option<V>
pub fn try_get_idx(&self, place: PlaceIndex, map: &Map<'_>) -> Option<V>
Retrieve the value stored for a place index, or None
if it is not tracked.
Sourcepub fn get(&self, place: PlaceRef<'_>, map: &Map<'_>) -> V
pub fn get(&self, place: PlaceRef<'_>, map: &Map<'_>) -> V
Retrieve the value stored for a place, or ⊤ if it is not tracked.
This method returns ⊥ if the place is tracked and the state is unreachable.
Sourcepub fn get_discr(&self, place: PlaceRef<'_>, map: &Map<'_>) -> V
pub fn get_discr(&self, place: PlaceRef<'_>, map: &Map<'_>) -> V
Retrieve the value stored for a place, or ⊤ if it is not tracked.
This method returns ⊥ the current state is unreachable.
Trait Implementations§
Source§impl<V: JoinSemiLattice + Clone> JoinSemiLattice for State<V>
impl<V: JoinSemiLattice + Clone> JoinSemiLattice for State<V>
impl<V: Eq> Eq for State<V>
impl<V> StructuralPartialEq for State<V>
Auto Trait Implementations§
impl<V> DynSend for State<V>where
V: DynSend,
impl<V> DynSync for State<V>where
V: DynSync,
impl<V> Freeze for State<V>where
V: Freeze,
impl<V> RefUnwindSafe for State<V>where
V: RefUnwindSafe,
impl<V> Send for State<V>where
V: Send,
impl<V> Sync for State<V>where
V: Sync,
impl<V> Unpin for State<V>where
V: Unpin,
impl<V> UnwindSafe for State<V>where
V: UnwindSafe,
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§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<P> IntoQueryParam<P> for P
impl<P> IntoQueryParam<P> for P
fn into_query_param(self) -> P
Source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
Source§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> T
Source§impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
default fn from_cycle_error( tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed, ) -> T
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeSendSync for T
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.