Struct InferCtxtAt

Source
pub struct InferCtxtAt<'a, 'infcx, 'genv, 'tcx> {
    pub infcx: &'a mut InferCtxt<'infcx, 'genv, 'tcx>,
    pub span: Span,
}

Fields§

§infcx: &'a mut InferCtxt<'infcx, 'genv, 'tcx>§span: Span

Implementations§

Source§

impl<'genv, 'tcx> InferCtxtAt<'_, '_, 'genv, 'tcx>

Source

fn tag(&self, reason: ConstrReason) -> Tag

Source

pub fn check_pred(&mut self, pred: impl Into<Expr>, reason: ConstrReason)

Source

pub fn check_non_closure_clauses( &mut self, clauses: &[Clause], reason: ConstrReason, ) -> InferResult

Source

pub fn subtyping_with_env( &mut self, env: &mut impl LocEnv, a: &Ty, b: &Ty, reason: ConstrReason, ) -> InferResult

Relate types via subtyping. This is the same as InferCtxtAt::subtyping except that we also require a LocEnv to handle pointers and strong references

Source

pub fn subtyping( &mut self, a: &Ty, b: &Ty, reason: ConstrReason, ) -> InferResult<Vec<Binder<CoroutineObligPredicate>>>

Relate types via subtyping and returns coroutine obligations. This doesn’t handle subtyping when strong references are involved.

See comment for Sub::obligations.

Source

pub fn check_constructor( &mut self, variant: EarlyBinder<PolyVariant>, generic_args: &[GenericArg], fields: &[Ty], reason: ConstrReason, ) -> InferResult<Ty>

Source

pub fn ensure_resolved_evars<R>( &mut self, f: impl FnOnce(&mut InferCtxtAt<'_, '_, 'genv, 'tcx>) -> InferResult<R>, ) -> InferResult<R>

Methods from Deref<Target = InferCtxt<'a, 'genv, 'tcx>>§

Source

pub fn at(&mut self, span: Span) -> InferCtxtAt<'_, 'infcx, 'genv, 'tcx>

Source

pub fn instantiate_refine_args( &mut self, callee_def_id: DefId, args: &[GenericArg], ) -> InferResult<List<Expr>>

Source

pub fn instantiate_generic_args( &mut self, args: &[GenericArg], ) -> Vec<GenericArg>

Source

pub fn fresh_infer_var(&self, sort: &Sort, mode: InferMode) -> Expr

Source

pub fn fresh_infer_var_for_hole( &mut self, binders: &[BoundVariableKinds], kind: HoleKind, ) -> Expr

Source

pub fn fresh_kvar( &self, binders: &[BoundVariableKinds], encoding: KVarEncoding, ) -> Expr

Generate a fresh kvar in the current scope. See KVarGen::fresh.

Source

fn fresh_evar(&self) -> Expr

Source

pub fn unify_exprs(&self, a: &Expr, b: &Expr)

Source

fn enter_exists<T, U>( &mut self, t: &Binder<T>, f: impl FnOnce(&mut InferCtxt<'_, 'genv, 'tcx>, T) -> U, ) -> U
where T: TypeFoldable,

Source

pub fn push_evar_scope(&mut self)

Used in conjunction with InferCtxt::pop_evar_scope to ensure evars are solved at the end of some scope, for example, to ensure all evars generated during a function call are solved after checking argument subtyping. These functions can be used in a stack-like fashion to create nested scopes.

Source

pub fn pop_evar_scope(&mut self) -> InferResult

Pop a scope and check all evars have been solved. This only check evars generated from the last call to InferCtxt::push_evar_scope.

Source

pub fn ensure_resolved_evars<R>( &mut self, f: impl FnOnce(&mut Self) -> InferResult<R>, ) -> InferResult<R>

Convenience method pairing InferCtxt::push_evar_scope and InferCtxt::pop_evar_scope.

Source

pub fn fully_resolve_evars<T: TypeFoldable>(&self, t: &T) -> T

Source

pub fn tcx(&self) -> TyCtxt<'tcx>

Source

pub fn cursor(&self) -> &Cursor<'infcx>

Source

pub fn change_item<'a>( &'a mut self, def_id: LocalDefId, region_infcx: &'a InferCtxt<'tcx>, ) -> InferCtxt<'a, 'genv, 'tcx>

Source

pub fn move_to( &mut self, marker: &Marker, clear_children: bool, ) -> InferCtxt<'_, 'genv, 'tcx>

Source

pub fn branch(&mut self) -> InferCtxt<'_, 'genv, 'tcx>

Source

pub fn define_var(&mut self, sort: &Sort) -> Name

Source

pub fn check_pred(&mut self, pred: impl Into<Expr>, tag: Tag)

Source

pub fn assume_pred(&mut self, pred: impl Into<Expr>)

Source

pub fn unpack(&mut self, ty: &Ty) -> Ty

Source

pub fn marker(&self) -> Marker

Source

pub fn hoister( &mut self, assume_invariants: bool, ) -> Hoister<Unpacker<'_, 'infcx>>

Source

pub fn assume_invariants(&mut self, ty: &Ty)

Source

fn check_impl( &mut self, pred1: impl Into<Expr>, pred2: impl Into<Expr>, tag: Tag, )

Trait Implementations§

Source§

impl<'a, 'infcx, 'genv, 'tcx> Debug for InferCtxtAt<'a, 'infcx, 'genv, 'tcx>

Source§

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

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

impl<'a, 'genv, 'tcx> Deref for InferCtxtAt<'_, 'a, 'genv, 'tcx>

Source§

type Target = InferCtxt<'a, 'genv, 'tcx>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for InferCtxtAt<'_, '_, '_, '_>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'a, 'infcx, 'genv, 'tcx> Freeze for InferCtxtAt<'a, 'infcx, 'genv, 'tcx>

§

impl<'a, 'infcx, 'genv, 'tcx> !RefUnwindSafe for InferCtxtAt<'a, 'infcx, 'genv, 'tcx>

§

impl<'a, 'infcx, 'genv, 'tcx> !Send for InferCtxtAt<'a, 'infcx, 'genv, 'tcx>

§

impl<'a, 'infcx, 'genv, 'tcx> !Sync for InferCtxtAt<'a, 'infcx, 'genv, 'tcx>

§

impl<'a, 'infcx, 'genv, 'tcx> Unpin for InferCtxtAt<'a, 'infcx, 'genv, 'tcx>

§

impl<'a, 'infcx, 'genv, 'tcx> !UnwindSafe for InferCtxtAt<'a, 'infcx, 'genv, '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> 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.