pub struct State<V>(StateData<V>);
Expand description

The dataflow state for an instance of ValueAnalysis.

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.

Tuple Fields§

§0: StateData<V>

Implementations§

source§

impl<V: Clone + HasTop + HasBottom> State<V>

source

pub fn is_reachable(&self) -> bool

source

pub fn mark_unreachable(&mut self)

source

pub fn flood_all(&mut self)

source

pub fn flood_all_with(&mut self, value: V)

source

pub fn flood_with(&mut self, place: PlaceRef<'_>, map: &Map, value: V)

source

pub fn flood(&mut self, place: PlaceRef<'_>, map: &Map)

source

pub fn flood_discr_with(&mut self, place: PlaceRef<'_>, map: &Map, value: V)

source

pub fn flood_discr(&mut self, place: PlaceRef<'_>, map: &Map)

source

pub 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.

source

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.

source

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.

source

pub fn assign( &mut self, target: PlaceRef<'_>, result: ValueOrPlace<V>, map: &Map )

Helper method to interpret target = result.

source

pub fn assign_discr( &mut self, target: PlaceRef<'_>, result: ValueOrPlace<V>, map: &Map )

Helper method for assignments to a discriminant.

source

pub fn get(&self, place: PlaceRef<'_>, map: &Map) -> V

Retrieve the value stored for a place, or ⊤ if it is not tracked.

source

pub fn get_discr(&self, place: PlaceRef<'_>, map: &Map) -> V

Retrieve the value stored for a place, or ⊤ if it is not tracked.

source

pub fn get_len(&self, place: PlaceRef<'_>, map: &Map) -> V

Retrieve the value stored for a place, or ⊤ if it is not tracked.

source

pub fn get_idx(&self, place: PlaceIndex, map: &Map) -> V

Retrieve the value stored for a place index, or ⊤ if it is not tracked.

Trait Implementations§

source§

impl<V: Clone> Clone for State<V>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<V: Debug> Debug for State<V>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'tcx, T> DebugWithContext<ValueAnalysisWrapper<T>> for State<T::Value>where T: ValueAnalysis<'tcx>, T::Value: Debug,

This is used to visualize the dataflow analysis.

source§

fn fmt_with( &self, ctxt: &ValueAnalysisWrapper<T>, f: &mut Formatter<'_> ) -> Result

source§

fn fmt_diff_with( &self, old: &Self, ctxt: &ValueAnalysisWrapper<T>, f: &mut Formatter<'_> ) -> Result

Print the difference between self and old. Read more
source§

impl<V: JoinSemiLattice + Clone> JoinSemiLattice for State<V>

source§

fn join(&mut self, other: &Self) -> bool

Computes the least upper bound of two elements, storing the result in self and returning true if self has changed. Read more
source§

impl<V: PartialEq> PartialEq<State<V>> for State<V>

source§

fn eq(&self, other: &State<V>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<V: Eq> Eq for State<V>

source§

impl<V> StructuralEq for State<V>

source§

impl<V> StructuralPartialEq for State<V>

Auto Trait Implementations§

§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

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: 24 bytes