pub struct TranslatedSpec {
    pub saved_memory: BTreeMap<QualifiedInstId<StructId>, MemoryLabel>,
    pub saved_spec_vars: BTreeMap<QualifiedInstId<SpecVarId>, MemoryLabel>,
    pub saved_params: BTreeMap<TempIndex, TempIndex>,
    pub debug_traces: Vec<(NodeId, Exp)>,
    pub pre: Vec<(Loc, Exp)>,
    pub post: Vec<(Loc, Exp)>,
    pub aborts: Vec<(Loc, Exp, Option<Exp>)>,
    pub aborts_with: Vec<(Loc, Vec<Exp>)>,
    pub emits: Vec<(Loc, Exp, Exp, Option<Exp>)>,
    pub modifies: Vec<(Loc, Exp)>,
    pub invariants: Vec<(Loc, GlobalId, Exp)>,
    pub lets: Vec<(Loc, bool, TempIndex, Exp)>,
}
Expand description

Represents a translated spec.

Fields§

§saved_memory: BTreeMap<QualifiedInstId<StructId>, MemoryLabel>§saved_spec_vars: BTreeMap<QualifiedInstId<SpecVarId>, MemoryLabel>§saved_params: BTreeMap<TempIndex, TempIndex>§debug_traces: Vec<(NodeId, Exp)>§pre: Vec<(Loc, Exp)>§post: Vec<(Loc, Exp)>§aborts: Vec<(Loc, Exp, Option<Exp>)>§aborts_with: Vec<(Loc, Vec<Exp>)>§emits: Vec<(Loc, Exp, Exp, Option<Exp>)>§modifies: Vec<(Loc, Exp)>§invariants: Vec<(Loc, GlobalId, Exp)>§lets: Vec<(Loc, bool, TempIndex, Exp)>

Implementations§

source§

impl TranslatedSpec

source

pub fn aborts_condition<'a, T: ExpGenerator<'a>>( &self, builder: &T ) -> Option<Exp>

Creates a boolean expression which describes the overall abort condition. This is a disjunction of the individual abort conditions.

source

pub fn aborts_code_condition<'a, T: ExpGenerator<'a>>( &self, builder: &T, actual_code: &Exp ) -> Option<Exp>

Creates a boolean expression which describes the overall condition which constraints the abort code.

Let (P1, C1)..(Pj, Cj) be aborts_if with a code, Pk..Pl aborts_if without a code, and the Cm..Cn standalone aborts codes from an aborts_with:

 P1 && abort_code == C1 || .. || Pj && abort_code == Cj
     || Pk || .. || Pl
     || abort_code == Cm || .. || abort_code == Cn

This characterizes the allowed value of the code. In the presence of aborts_if with code, whenever the aborts condition is true, the code must also be the specified ones. Notice that still allows any other member of the disjunction to make the overall condition true. Specifically, if someone specifies aborts_if P with C1; aborts_with C2, then even if P is true, C2 is allowed as an abort code.

source

pub fn has_aborts_code_specs(&self) -> bool

Returns true if there are any specs about the abort code.

source

pub fn pre_conditions<'a, T: ExpGenerator<'a>>( &self, _builder: &T ) -> impl Iterator<Item = (Loc, Exp)> + '_

Return an iterator of effective pre conditions.

source

pub fn emits_conditions<'a, T: ExpGenerator<'a>>( &self, builder: &T ) -> Vec<(Loc, Exp)>

Returns a sequence of EventStoreIncludes expressions which verify the emits clauses of a function spec. While logically we could generate a single EventStoreIncludes, for better error reporting we construct incrementally multiple EventStoreIncludes expressions with some redundancy for each individual `emits, so we the see the exact failure at the right emit condition.

source

pub fn emits_completeness_condition<'a, T: ExpGenerator<'a>>( &self, builder: &T ) -> Exp

Trait Implementations§

source§

impl Default for TranslatedSpec

source§

fn default() -> TranslatedSpec

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · 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.
const: unstable · source§

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

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V