struct UniversalRegionIndices<'tcx> {
    indices: FxHashMap<Region<'tcx>, RegionVid>,
    pub fr_static: RegionVid,
}

Fields§

§indices: FxHashMap<Region<'tcx>, RegionVid>

For those regions that may appear in the parameter environment (’static and early-bound regions), we maintain a map from the ty::Region to the internal RegionVid we are using. This is used because trait matching and type-checking will feed us region constraints that reference those regions and we need to be able to map them to our internal RegionVid. This is basically equivalent to an GenericArgs, except that it also contains an entry for ReStatic – it might be nice to just use an args, and then handle ReStatic another way.

§fr_static: RegionVid

The vid assigned to 'static. Used only for diagnostics.

Implementations§

source§

impl<'tcx> UniversalRegionIndices<'tcx>

source

fn insert_late_bound_region(&mut self, r: Region<'tcx>, vid: RegionVid)

Initially, the UniversalRegionIndices map contains only the early-bound regions in scope. Once that is all setup, we come in later and instantiate the late-bound regions, and then we insert the ReFree version of those into the map as well. These are used for error reporting.

source

pub fn to_region_vid(&self, r: Region<'tcx>) -> RegionVid

Converts r into a local inference variable: r can either be a ReVar (i.e., already a reference to an inference variable) or it can be 'static or some early-bound region. This is useful when taking the results from type-checking and trait-matching, which may sometimes reference those regions from the ParamEnv. It is also used during initialization. Relies on the indices map having been fully initialized.

source

pub fn fold_to_region_vids<T>(&self, tcx: TyCtxt<'tcx>, value: T) -> Twhere T: TypeFoldable<TyCtxt<'tcx>>,

Replaces all free regions in value with region vids, as returned by to_region_vid.

Trait Implementations§

source§

impl<'tcx> Debug for UniversalRegionIndices<'tcx>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'tcx> RefUnwindSafe for UniversalRegionIndices<'tcx>

§

impl<'tcx> Send for UniversalRegionIndices<'tcx>

§

impl<'tcx> Sync for UniversalRegionIndices<'tcx>

§

impl<'tcx> Unpin for UniversalRegionIndices<'tcx>

§

impl<'tcx> UnwindSafe for UniversalRegionIndices<'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: 40 bytes