Struct flux_refineck::checker::Checker

source ·
pub(crate) struct Checker<'ck, 'genv, 'tcx, M> {
    genv: GlobalEnv<'genv, 'tcx>,
    def_id: LocalDefId,
    inherited: Inherited<'ck, M>,
    body: &'ck Body<'tcx>,
    resume_ty: Option<Ty>,
    output: Binder<FnOutput>,
    snapshots: IndexVec<BasicBlock, Option<Snapshot>>,
    visited: BitSet<BasicBlock>,
    queue: WorkQueue<'ck>,
}

Fields§

§genv: GlobalEnv<'genv, 'tcx>§def_id: LocalDefId

LocalDefId of the function-like item being checked.

§inherited: Inherited<'ck, M>§body: &'ck Body<'tcx>§resume_ty: Option<Ty>

The type used for the resume argument if we are checking a generator.

§output: Binder<FnOutput>§snapshots: IndexVec<BasicBlock, Option<Snapshot>>

A snapshot of the refinement context at the end of the basic block after applying the effects of the terminator.

§visited: BitSet<BasicBlock>§queue: WorkQueue<'ck>

Implementations§

source§

impl<'ck, 'genv, 'tcx> Checker<'ck, 'genv, 'tcx, ShapeMode>

source

pub(crate) fn run_in_shape_mode( genv: GlobalEnv<'genv, 'tcx>, def_id: LocalDefId, ghost_stmts: &'ck UnordMap<LocalDefId, GhostStatements>, config: CheckerConfig, ) -> Result<ShapeResult, CheckerError>

source§

impl<'ck, 'genv, 'tcx> Checker<'ck, 'genv, 'tcx, RefineMode>

source

pub(crate) fn run_in_refine_mode( genv: GlobalEnv<'genv, 'tcx>, def_id: LocalDefId, ghost_stmts: &'ck UnordMap<LocalDefId, GhostStatements>, bb_env_shapes: ShapeResult, config: CheckerConfig, ) -> Result<(RefineTree, KVarGen), CheckerError>

source§

impl<'ck, 'genv, 'tcx, M: Mode> Checker<'ck, 'genv, 'tcx, M>

source

fn run( infcx: InferCtxt<'_, 'genv, 'tcx>, def_id: LocalDefId, inherited: Inherited<'ck, M>, poly_sig: PolyFnSig, ) -> Result<(), CheckerError>

source

fn check_basic_block( &mut self, infcx: InferCtxt<'_, 'genv, 'tcx>, env: TypeEnv<'_>, bb: BasicBlock, ) -> Result<(), CheckerError>

source

fn check_assign_ty( &mut self, infcx: &mut InferCtxt<'_, '_, '_>, env: &mut TypeEnv<'_>, place: &Place, ty: Ty, source_info: SourceInfo, ) -> Result<(), CheckerError>

source

fn check_statement( &mut self, infcx: &mut InferCtxt<'_, 'genv, 'tcx>, env: &mut TypeEnv<'_>, stmt: &Statement, ) -> Result<(), CheckerError>

source

fn is_exit_block(&self, bb: BasicBlock) -> bool

source

fn check_terminator( &mut self, infcx: &mut InferCtxt<'_, 'genv, 'tcx>, env: &mut TypeEnv<'_>, terminator: &Terminator<'tcx>, last_stmt_span: Option<Span>, ) -> Result<Vec<(BasicBlock, Guard)>, CheckerError>

For check_terminator, the output Vec<BasicBlock, Guard> denotes,

  • BasicBlock “successors” of the current terminator, and
  • Guard are extra control information from, e.g. the SwitchInt (or Assert) you can assume when checking the corresponding successor.
source

fn check_ret( &mut self, infcx: &mut InferCtxt<'_, 'genv, 'tcx>, env: &mut TypeEnv<'_>, span: Span, ) -> Result<(), CheckerError>

source

fn check_call( &mut self, infcx: &mut InferCtxt<'_, 'genv, 'tcx>, env: &mut TypeEnv<'_>, span: Span, callee_def_id: Option<DefId>, fn_sig: EarlyBinder<PolyFnSig>, generic_args: &[GenericArg], actuals: &[Ty], ) -> Result<Ty, CheckerError>

source

fn check_coroutine_obligations( &mut self, infcx: &mut InferCtxt<'_, 'genv, 'tcx>, obligs: Vec<Binder<CoroutineObligPredicate>>, ) -> Result<(), CheckerError>

source

fn check_fn_trait_clause( &mut self, infcx: &mut InferCtxt<'_, 'genv, 'tcx>, fn_trait_pred: &FnTraitPredicate, span: Span, ) -> Result<(), CheckerError>

source

fn check_closure_clauses( &mut self, infcx: &mut InferCtxt<'_, 'genv, 'tcx>, clauses: &[Binder<FnTraitPredicate>], span: Span, ) -> Result<(), CheckerError>

source

fn check_assert( &mut self, infcx: &mut InferCtxt<'_, '_, '_>, env: &mut TypeEnv<'_>, terminator_span: Span, cond: &Operand, expected: bool, msg: &AssertKind, ) -> Result<Guard, CheckerError>

source

fn check_if(discr_ty: &Ty, targets: &SwitchTargets) -> Vec<(BasicBlock, Guard)>

Checks conditional branching as in a match statement. SwitchTargets (https://doc.rust-lang.org/nightly/nightly-rustc/stable_mir/mir/struct.SwitchTargets.html) contains a list of branches - the exact bit value which is being compared and the block to jump to. Using the conditionals, each branch can be checked using the new control flow information. See https://github.com/flux-rs/flux/pull/840#discussion_r1786543174

source

fn check_match( discr_ty: &Ty, targets: &SwitchTargets, ) -> Vec<(BasicBlock, Guard)>

source

fn check_successors( &mut self, infcx: InferCtxt<'_, 'genv, 'tcx>, env: TypeEnv<'_>, from: BasicBlock, terminator_span: Span, successors: Vec<(BasicBlock, Guard)>, ) -> Result<(), CheckerError>

source

fn check_goto( &mut self, infcx: InferCtxt<'_, 'genv, 'tcx>, env: TypeEnv<'_>, span: Span, target: BasicBlock, ) -> Result<(), CheckerError>

source

fn check_rvalue( &mut self, infcx: &mut InferCtxt<'_, 'genv, 'tcx>, env: &mut TypeEnv<'_>, stmt_span: Span, rvalue: &Rvalue, ) -> Result<Ty, CheckerError>

source

fn check_len( &mut self, infcx: &mut InferCtxt<'_, '_, '_>, env: &mut TypeEnv<'_>, stmt_span: Span, place: &Place, ) -> Result<Ty, CheckerError>

source

fn check_binary_op( &mut self, infcx: &mut InferCtxt<'_, '_, '_>, env: &mut TypeEnv<'_>, stmt_span: Span, bin_op: BinOp, op1: &Operand, op2: &Operand, ) -> Result<Ty, CheckerError>

source

fn check_nullary_op(&self, null_op: NullOp, _ty: &Ty) -> Ty

source

fn check_unary_op( &mut self, infcx: &mut InferCtxt<'_, 'genv, 'tcx>, env: &mut TypeEnv<'_>, stmt_span: Span, un_op: UnOp, op: &Operand, ) -> Result<Ty, CheckerError>

source

fn check_mk_array( &mut self, infcx: &mut InferCtxt<'_, 'genv, 'tcx>, env: &mut TypeEnv<'_>, stmt_span: Span, args: &[Ty], arr_ty: Ty, ) -> Result<Ty, CheckerError>

source

fn check_cast( &self, infcx: &mut InferCtxt<'_, 'genv, 'tcx>, env: &mut TypeEnv<'_>, stmt_span: Span, kind: CastKind, from: &Ty, to: &Ty, ) -> Result<Ty, CheckerError>

source

fn discr_to_int_cast(adt_def: &AdtDef, bty: BaseTy) -> Ty

source

fn check_unsize_cast( &self, infcx: &mut InferCtxt<'_, 'genv, 'tcx>, env: &mut TypeEnv<'_>, span: Span, src: &Ty, dst: &Ty, ) -> Result<Ty, CheckerError>

source

fn check_operands( &mut self, infcx: &mut InferCtxt<'_, 'genv, 'tcx>, env: &mut TypeEnv<'_>, source_span: Span, operands: &[Operand], ) -> Result<Vec<Ty>, CheckerError>

source

fn check_operand( &mut self, infcx: &mut InferCtxt<'_, '_, '_>, env: &mut TypeEnv<'_>, source_span: Span, operand: &Operand, ) -> Result<Ty, CheckerError>

source

fn check_constant(&mut self, c: &Constant) -> Result<Ty, CheckerError>

source

fn check_ghost_statements_at( &mut self, infcx: &mut InferCtxt<'_, 'genv, 'tcx>, env: &mut TypeEnv<'_>, point: Point, span: Span, ) -> Result<(), CheckerError>

source

fn check_ghost_statement( &mut self, infcx: &mut InferCtxt<'_, 'genv, 'tcx>, env: &mut TypeEnv<'_>, stmt: &GhostStatement, span: Span, ) -> Result<(), CheckerError>

source

fn snapshot_at_dominator(&self, bb: BasicBlock) -> &Snapshot

source

fn dominators(&self) -> &'ck Dominators<BasicBlock>

source

fn ghost_stmts(&self) -> &'ck GhostStatements

source

fn config(&self) -> CheckerConfig

source

fn check_overflow(&self) -> bool

source

fn default_refiner(&self) -> QueryResult<Refiner<'genv, 'tcx>>

source

fn refine_default(&self, ty: &Ty) -> QueryResult<Ty>

source

fn refine_with_holes(&self, ty: &Ty) -> QueryResult<Ty>

Auto Trait Implementations§

§

impl<'ck, 'genv, 'tcx, M> Freeze for Checker<'ck, 'genv, 'tcx, M>

§

impl<'ck, 'genv, 'tcx, M> !RefUnwindSafe for Checker<'ck, 'genv, 'tcx, M>

§

impl<'ck, 'genv, 'tcx, M> !Send for Checker<'ck, 'genv, 'tcx, M>

§

impl<'ck, 'genv, 'tcx, M> !Sync for Checker<'ck, 'genv, 'tcx, M>

§

impl<'ck, 'genv, 'tcx, M> Unpin for Checker<'ck, 'genv, 'tcx, M>

§

impl<'ck, 'genv, 'tcx, M> !UnwindSafe for Checker<'ck, 'genv, 'tcx, M>

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, U> TryFrom<U> for T
where 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 T
where 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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more