Type Alias RegionKind

Source
pub type RegionKind<'tcx> = RegionKind<TyCtxt<'tcx>>;

Aliased Type§

pub enum RegionKind<'tcx> {
    ReEarlyParam(EarlyParamRegion),
    ReBound(DebruijnIndex, BoundRegion),
    ReLateParam(LateParamRegion),
    ReStatic,
    ReVar(RegionVid),
    RePlaceholder(Placeholder<BoundRegion>),
    ReErased,
    ReError(ErrorGuaranteed),
}

Variants§

§

ReEarlyParam(EarlyParamRegion)

A region parameter; for example 'a in impl<'a> Trait for &'a ().

There are some important differences between region and type parameters. Not all region parameters in the source are represented via ReEarlyParam: late-bound function parameters are instead lowered to a ReBound. Late-bound regions get eagerly replaced with ReLateParam which behaves in the same way as ReEarlyParam. Region parameters are also sometimes implicit, e.g. in impl Trait for &().

§

ReBound(DebruijnIndex, BoundRegion)

A higher-ranked region. These represent either late-bound function parameters or bound variables from a for<'a>-binder.

While inside of a function, e.g. during typeck, the late-bound function parameters can be converted to ReLateParam by calling tcx.liberate_late_bound_regions.

Bound regions inside of types must not be erased, as they impact trait selection and the TypeId of that type. for<'a> fn(&'a ()) and fn(&'static ()) are different types and have to be treated as such.

§

ReLateParam(LateParamRegion)

Late-bound function parameters are represented using a ReBound. When inside of a function, we convert these bound variables to placeholder parameters via tcx.liberate_late_bound_regions. They are then treated the same way as ReEarlyParam while inside of the function.

See https://rustc-dev-guide.rust-lang.org/early-late-bound-params/early-late-bound-summary.html for more info about early and late bound lifetime parameters.

§

ReStatic

Static data that has an “infinite” lifetime. Top in the region lattice.

§

ReVar(RegionVid)

A region variable. Should not exist outside of type inference.

§

RePlaceholder(Placeholder<BoundRegion>)

A placeholder region – the higher-ranked version of ReLateParam. Should not exist outside of type inference.

Used when instantiating a forall binder via infcx.enter_forall.

§

ReErased

Erased region, used by trait selection, in MIR and during codegen.

§

ReError(ErrorGuaranteed)

A region that resulted from some other error. Used exclusively for diagnostics.

Layout§

Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.

Trait Implementations

Source§

impl<I> Clone for RegionKind<I>
where I: Interner,

Source§

fn clone(&self) -> RegionKind<I>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<I> Debug for RegionKind<I>
where I: Interner,

Source§

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

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

impl<I, __D> Decodable<__D> for RegionKind<I>

Source§

fn decode(__decoder: &mut __D) -> RegionKind<I>

Source§

impl<I, __E> Encodable<__E> for RegionKind<I>

Source§

fn encode(&self, __encoder: &mut __E)

Source§

impl<I> Hash for RegionKind<I>
where I: Interner,

Source§

fn hash<__H>(&self, __state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<CTX, I> HashStable<CTX> for RegionKind<I>

Source§

fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher<SipHasher128>)

Source§

impl<I> PartialEq for RegionKind<I>
where I: Interner,

Source§

fn eq(&self, __other: &RegionKind<I>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<I> Copy for RegionKind<I>
where I: Interner,

Source§

impl<I> Eq for RegionKind<I>
where I: Interner,