pub struct Inherited<'tcx> {
    pub(crate) infcx: InferCtxt<'tcx>,
    pub(crate) typeck_results: RefCell<TypeckResults<'tcx>>,
    pub(crate) locals: RefCell<HirIdMap<Ty<'tcx>>>,
    pub(crate) fulfillment_cx: RefCell<Box<dyn TraitEngine<'tcx>>>,
    pub(crate) deferred_sized_obligations: RefCell<Vec<(Ty<'tcx>, Span, ObligationCauseCode<'tcx>)>>,
    pub(crate) deferred_call_resolutions: RefCell<LocalDefIdMap<Vec<DeferredCallResolution<'tcx>>>>,
    pub(crate) deferred_cast_checks: RefCell<Vec<CastCheck<'tcx>>>,
    pub(crate) deferred_transmute_checks: RefCell<Vec<(Ty<'tcx>, Ty<'tcx>, HirId)>>,
    pub(crate) deferred_asm_checks: RefCell<Vec<(&'tcx InlineAsm<'tcx>, HirId)>>,
    pub(crate) deferred_generator_interiors: RefCell<Vec<(LocalDefId, BodyId, Ty<'tcx>, GeneratorKind)>>,
    pub(crate) diverging_type_vars: RefCell<UnordSet<Ty<'tcx>>>,
    pub(crate) infer_var_info: RefCell<UnordMap<TyVid, InferVarInfo>>,
}
Expand description

Closures defined within the function. For example:

fn foo() {
    bar(move|| { ... })
}

Here, the function foo() and the closure passed to bar() will each have their own FnCtxt, but they will share the inherited fields.

Fields§

§infcx: InferCtxt<'tcx>§typeck_results: RefCell<TypeckResults<'tcx>>§locals: RefCell<HirIdMap<Ty<'tcx>>>§fulfillment_cx: RefCell<Box<dyn TraitEngine<'tcx>>>§deferred_sized_obligations: RefCell<Vec<(Ty<'tcx>, Span, ObligationCauseCode<'tcx>)>>

Some additional Sized obligations badly affect type inference. These obligations are added in a later stage of typeck. Removing these may also cause additional complications, see #101066.

§deferred_call_resolutions: RefCell<LocalDefIdMap<Vec<DeferredCallResolution<'tcx>>>>

When we process a call like c() where c is a closure type, we may not have decided yet whether c is a Fn, FnMut, or FnOnce closure. In that case, we defer full resolution of the call until upvar inference can kick in and make the decision. We keep these deferred resolutions grouped by the def-id of the closure, so that once we decide, we can easily go back and process them.

§deferred_cast_checks: RefCell<Vec<CastCheck<'tcx>>>§deferred_transmute_checks: RefCell<Vec<(Ty<'tcx>, Ty<'tcx>, HirId)>>§deferred_asm_checks: RefCell<Vec<(&'tcx InlineAsm<'tcx>, HirId)>>§deferred_generator_interiors: RefCell<Vec<(LocalDefId, BodyId, Ty<'tcx>, GeneratorKind)>>§diverging_type_vars: RefCell<UnordSet<Ty<'tcx>>>

Whenever we introduce an adjustment from ! into a type variable, we record that type variable here. This is later used to inform fallback. See the fallback module for details.

§infer_var_info: RefCell<UnordMap<TyVid, InferVarInfo>>

Implementations§

source§

impl<'tcx> Inherited<'tcx>

source

pub fn new(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> Self

source

pub(crate) fn register_predicate(&self, obligation: PredicateObligation<'tcx>)

source

pub(crate) fn register_predicates<I>(&self, obligations: I)where I: IntoIterator<Item = PredicateObligation<'tcx>>,

source

pub(crate) fn register_infer_ok_obligations<T>( &self, infer_ok: InferOk<'tcx, T> ) -> T

source

pub fn update_infer_var_info(&self, obligation: &PredicateObligation<'tcx>)

Trait Implementations§

source§

impl<'tcx> Deref for Inherited<'tcx>

§

type Target = InferCtxt<'tcx>

The resulting type after dereferencing.
source§

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

Dereferences the value.

Auto Trait Implementations§

§

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

§

impl<'tcx> !Send for Inherited<'tcx>

§

impl<'tcx> !Sync for Inherited<'tcx>

§

impl<'tcx> Unpin for Inherited<'tcx>

§

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

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, 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: 1872 bytes