PropertyContract

Enum PropertyContract 

Source
pub enum PropertyContract<'tcx> {
Show 26 variants Align(Ty<'tcx>), Size(), NoPadding, NonNull, Allocated(Ty<'tcx>, ContractExpr<'tcx>), InBound(Ty<'tcx>, ContractExpr<'tcx>), NonOverlap, ValidNum(Vec<NumericPredicate<'tcx>>), ValidString, ValidCStr, Init(Ty<'tcx>, ContractExpr<'tcx>), Unwrap, Typed(Ty<'tcx>), Owning, Alias, Alive, Pinned, NonVolatile, Opened, Trait, Unreachable, ValidPtr(Ty<'tcx>, ContractExpr<'tcx>), Deref, Ptr2Ref, Layout, Unknown,
}
Expand description

A parsed safety-property contract.

The variants correspond to the primitive safety-property tags used by the annotation DSL and the built-in standard-library contract database.

Variants§

§

Align(Ty<'tcx>)

Alignment requirement for a pointer interpreted as Ty.

§

Size()

Size requirement placeholder.

§

NoPadding

No-padding layout requirement placeholder.

§

NonNull

Non-null pointer requirement.

§

Allocated(Ty<'tcx>, ContractExpr<'tcx>)

Allocation provenance requirement for Ty and length.

§

InBound(Ty<'tcx>, ContractExpr<'tcx>)

Object-boundary requirement for Ty and length.

§

NonOverlap

Non-overlapping memory range requirement placeholder.

§

ValidNum(Vec<NumericPredicate<'tcx>>)

Numeric relationship requirements.

§

ValidString

UTF-8 string validity requirement placeholder.

§

ValidCStr

NUL-terminated C string validity requirement placeholder.

§

Init(Ty<'tcx>, ContractExpr<'tcx>)

Initialization requirement for Ty and length.

§

Unwrap

Option/Result unwrap safety requirement placeholder.

§

Typed(Ty<'tcx>)

Dynamic type compatibility requirement.

§

Owning

Ownership requirement placeholder.

§

Alias

Aliasing requirement placeholder.

§

Alive

Liveness requirement placeholder.

§

Pinned

Pinning requirement placeholder.

§

NonVolatile

Non-volatile access requirement placeholder.

§

Opened

Resource-open state requirement placeholder.

§

Trait

Trait invariant requirement placeholder.

§

Unreachable

Unreachable-code contract placeholder.

§

ValidPtr(Ty<'tcx>, ContractExpr<'tcx>)

Composite valid-pointer requirement.

§

Deref

Dereferenceability requirement placeholder.

§

Ptr2Ref

Pointer-to-reference conversion requirement placeholder.

§

Layout

Layout compatibility requirement placeholder.

§

Unknown

Unknown or currently unsupported safety-property tag.

Implementations§

Source§

impl<'tcx> PropertyContract<'tcx>

Source

pub fn new( tcx: TyCtxt<'tcx>, def_id: DefId, name: &str, exprs: &Vec<Expr>, ) -> Self

Parse one safety-property tag from the annotation DSL.

Source

pub fn new_partial_order(lhs: usize, rhs: usize, op: MirBinOp) -> Self

Create a numeric partial-order contract between two MIR locals.

Source

pub fn new_obj_boundary(ty: Ty<'tcx>, len: ContractExpr<'tcx>) -> Self

Create the default object-boundary contract for a newly modeled object.

Source

fn check_arg_length(expr_len: usize, required_len: usize, sp: &str) -> bool

Validate the number of parsed annotation arguments.

Source

fn parse_type( tcx: TyCtxt<'tcx>, def_id: DefId, expr: &Expr, sp: &str, ) -> Ty<'tcx>

Parse a type argument from a contract expression.

Source

fn parse_target_type( tcx: TyCtxt<'tcx>, def_id: DefId, expr: &Expr, ) -> Option<Ty<'tcx>>

Parse the current type of a target place used by a two-argument contract form.

Source

fn parse_contract_expr( tcx: TyCtxt<'tcx>, def_id: DefId, expr: &Expr, sp: &str, ) -> ContractExpr<'tcx>

Parse any numeric expression used by a contract.

Source

fn parse_contract_place( tcx: TyCtxt<'tcx>, def_id: DefId, expr: &Expr, ) -> Option<ContractPlace<'tcx>>

Parse a place expression from an annotation expression.

Source

fn parse_arg_place(expr: &Expr) -> Option<ContractPlace<'tcx>>

Parse contract argument references such as Arg_1.

Source

fn parse_valid_num( tcx: TyCtxt<'tcx>, def_id: DefId, exprs: &Vec<Expr>, ) -> Vec<NumericPredicate<'tcx>>

Parse ValidNum into one or more numeric predicates.

Source

fn parse_numeric_predicate( tcx: TyCtxt<'tcx>, def_id: DefId, expr: &Expr, ) -> Option<NumericPredicate<'tcx>>

Parse a single comparison predicate, falling back to expr != 0.

Source

fn parse_interval_predicates( tcx: TyCtxt<'tcx>, def_id: DefId, value: &Expr, range: &Expr, ) -> Option<Vec<NumericPredicate<'tcx>>>

Parse interval-style ValidNum(value, [lower, upper]) predicates.

Source

fn parse_string_interval( tcx: TyCtxt<'tcx>, def_id: DefId, value: &Expr, raw_range: &str, ) -> Option<Vec<NumericPredicate<'tcx>>>

Parse string interval notation such as "[0,self.len)".

Source

fn build_interval_predicates( tcx: TyCtxt<'tcx>, def_id: DefId, value: &Expr, lower: &Expr, lower_inclusive: bool, upper: &Expr, upper_inclusive: bool, ) -> Vec<NumericPredicate<'tcx>>

Build lower/upper bound predicates for an interval contract.

Trait Implementations§

Source§

impl<'tcx> Clone for PropertyContract<'tcx>

Source§

fn clone(&self) -> PropertyContract<'tcx>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'tcx> Debug for PropertyContract<'tcx>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'tcx> Freeze for PropertyContract<'tcx>

§

impl<'tcx> !RefUnwindSafe for PropertyContract<'tcx>

§

impl<'tcx> Send for PropertyContract<'tcx>

§

impl<'tcx> Sync for PropertyContract<'tcx>

§

impl<'tcx> Unpin for PropertyContract<'tcx>

§

impl<'tcx> !UnwindSafe for PropertyContract<'tcx>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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

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

§

fn vzip(self) -> V