[−][src]Struct rustc_infer::infer::canonical::canonicalizer::Canonicalizer

pub(in infer::canonical::canonicalizer) struct Canonicalizer<'cx, 'tcx> {
    infcx: Option<&'cx InferCtxt<'cx, 'tcx>>,
    tcx: TyCtxt<'tcx>,
    variables: SmallVec<[CanonicalVarInfo<'tcx>; 8]>,
    query_state: &'cx mut OriginalQueryValues<'tcx>,
    indices: FxHashMap<GenericArg<'tcx>, BoundVar>,
    canonicalize_region_mode: &'cx dyn CanonicalizeRegionMode,
    needs_canonical_flags: TypeFlags,
    binder_index: DebruijnIndex,
}

Fields

infcx: Option<&'cx InferCtxt<'cx, 'tcx>>tcx: TyCtxt<'tcx>variables: SmallVec<[CanonicalVarInfo<'tcx>; 8]>query_state: &'cx mut OriginalQueryValues<'tcx>indices: FxHashMap<GenericArg<'tcx>, BoundVar>canonicalize_region_mode: &'cx dyn CanonicalizeRegionModeneeds_canonical_flags: TypeFlagsbinder_index: DebruijnIndex

Implementations

impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx>[src]

pub(in infer::canonical::canonicalizer) fn canonicalize<V>(
    value: V,
    infcx: Option<&InferCtxt<'_, 'tcx>>,
    tcx: TyCtxt<'tcx>,
    canonicalize_region_mode: &dyn CanonicalizeRegionMode,
    query_state: &mut OriginalQueryValues<'tcx>
) -> Canonicalized<'tcx, V> where
    V: TypeFoldable<'tcx>, 
[src]

The main canonicalize method, shared impl of canonicalize_query and canonicalize_response.

pub(in infer::canonical::canonicalizer) fn canonical_var(
    &mut self,
    info: CanonicalVarInfo<'tcx>,
    kind: GenericArg<'tcx>
) -> BoundVar
[src]

Creates a canonical variable replacing kind from the input, or returns an existing variable if kind has already been seen. kind is expected to be an unbound variable (or potentially a free region).

pub(in infer::canonical::canonicalizer) fn canonical_var_for_region_in_root_universe(
    &mut self,
    r: Region<'tcx>
) -> Region<'tcx>
[src]

Shorthand helper that creates a canonical region variable for r (always in the root universe). The reason that we always put these variables into the root universe is because this method is used during query construction: in that case, we are taking all the regions and just putting them into the most generic context we can. This may generate solutions that don't fit (e.g., that equate some region variable with a placeholder it can't name) on the caller side, but that's ok, the caller can figure that out. In the meantime, it maximizes our caching.

(This works because unification never fails -- and hence trait selection is never affected -- due to a universe mismatch.)

pub(in infer::canonical::canonicalizer) fn region_var_universe(
    &self,
    vid: RegionVid
) -> UniverseIndex
[src]

Returns the universe in which vid is defined.

pub(in infer::canonical::canonicalizer) fn canonical_var_for_region(
    &mut self,
    info: CanonicalVarInfo<'tcx>,
    r: Region<'tcx>
) -> Region<'tcx>
[src]

Creates a canonical variable (with the given info) representing the region r; return a region referencing it.

pub(in infer::canonical::canonicalizer) fn canonicalize_ty_var(
    &mut self,
    info: CanonicalVarInfo<'tcx>,
    ty_var: Ty<'tcx>
) -> Ty<'tcx>
[src]

Given a type variable ty_var of the given kind, first check if ty_var is bound to anything; if so, canonicalize that. Otherwise, create a new canonical variable for ty_var.

pub(in infer::canonical::canonicalizer) fn canonicalize_const_var(
    &mut self,
    info: CanonicalVarInfo<'tcx>,
    const_var: &'tcx Const<'tcx>
) -> &'tcx Const<'tcx>
[src]

Given a type variable const_var of the given kind, first check if const_var is bound to anything; if so, canonicalize that. Otherwise, create a new canonical variable for const_var.

Trait Implementations

impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx>[src]

Auto Trait Implementations

impl<'cx, 'tcx> !RefUnwindSafe for Canonicalizer<'cx, 'tcx>

impl<'cx, 'tcx> !Send for Canonicalizer<'cx, 'tcx>

impl<'cx, 'tcx> !Sync for Canonicalizer<'cx, 'tcx>

impl<'cx, 'tcx> Unpin for Canonicalizer<'cx, 'tcx> where
    'tcx: 'cx, 

impl<'cx, 'tcx> !UnwindSafe for Canonicalizer<'cx, 'tcx>

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<'a, T> Captures<'a> for T where
    T: ?Sized, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> WithConstness for T[src]