Type Alias rustc_middle::ty::ConstKind

source ·
pub type ConstKind<'tcx> = ConstKind<TyCtxt<'tcx>>;

Aliased Type§

enum ConstKind<'tcx> {
    Param(ParamConst),
    Infer(InferConst),
    Bound(DebruijnIndex, BoundVar),
    Placeholder(Placeholder<BoundVar>),
    Unevaluated(UnevaluatedConst<'tcx>),
    Value(ValTree<'tcx>),
    Error(ErrorGuaranteed),
    Expr(Expr<'tcx>),
}

Variants§

§

Param(ParamConst)

A const generic parameter.

§

Infer(InferConst)

Infer the value of the const.

§

Bound(DebruijnIndex, BoundVar)

Bound const variable, used only when preparing a trait query.

§

Placeholder(Placeholder<BoundVar>)

A placeholder const - universally quantified higher-ranked const.

§

Unevaluated(UnevaluatedConst<'tcx>)

An unnormalized const item such as an anon const or assoc const or free const item. Right now anything other than anon consts does not actually work properly but this should

§

Value(ValTree<'tcx>)

Used to hold computed value.

§

Error(ErrorGuaranteed)

A placeholder for a const which could not be computed; this is propagated to avoid useless error messages.

§

Expr(Expr<'tcx>)

Unevaluated non-const-item, used by feature(generic_const_exprs) to represent const arguments such as N + 1 or foo(N)

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: 32 bytes

Size for each variant:

  • Param: 8 bytes
  • Infer: 8 bytes
  • Bound: 8 bytes
  • Placeholder: 8 bytes
  • Unevaluated: 20 bytes
  • Value: 28 bytes
  • Error: 0 bytes
  • Expr: 28 bytes

Trait Implementations

source§

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

source§

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

Returns a copy 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 ConstKind<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> DebugWithInfcx<I> for ConstKind<I>
where I: Interner,

source§

fn fmt<Infcx>( this: WithInfcx<'_, Infcx, &ConstKind<I>>, f: &mut Formatter<'_> ) -> Result<(), Error>
where Infcx: InferCtxtLike<Interner = I>,

source§

impl<I, __D> Decodable<__D> for ConstKind<I>
where I: Interner, __D: TyDecoder<I = I>, <I as Interner>::ParamConst: Decodable<__D>, <I as Interner>::BoundConst: Decodable<__D>, <I as Interner>::PlaceholderConst: Decodable<__D>, <I as Interner>::AliasConst: Decodable<__D>, <I as Interner>::ValueConst: Decodable<__D>, <I as Interner>::ErrorGuaranteed: Decodable<__D>, <I as Interner>::ExprConst: Decodable<__D>,

source§

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

source§

impl<I, __E> Encodable<__E> for ConstKind<I>
where I: Interner, __E: TyEncoder<I = I>, <I as Interner>::ParamConst: Encodable<__E>, <I as Interner>::BoundConst: Encodable<__E>, <I as Interner>::PlaceholderConst: Encodable<__E>, <I as Interner>::AliasConst: Encodable<__E>, <I as Interner>::ValueConst: Encodable<__E>, <I as Interner>::ErrorGuaranteed: Encodable<__E>, <I as Interner>::ExprConst: Encodable<__E>,

source§

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

source§

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

source§

fn hash<__HI>(&self, __state: &mut __HI)
where __HI: 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<I, __CTX> HashStable<__CTX> for ConstKind<I>
where I: Interner, <I as Interner>::ParamConst: HashStable<__CTX>, <I as Interner>::BoundConst: HashStable<__CTX>, <I as Interner>::PlaceholderConst: HashStable<__CTX>, <I as Interner>::AliasConst: HashStable<__CTX>, <I as Interner>::ValueConst: HashStable<__CTX>, <I as Interner>::ErrorGuaranteed: HashStable<__CTX>, <I as Interner>::ExprConst: HashStable<__CTX>,

source§

fn hash_stable(&self, __hcx: &mut __CTX, __hasher: &mut StableHasher)

source§

impl<I> Ord for ConstKind<I>
where I: Interner,

source§

fn cmp(&self, other: &ConstKind<I>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

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

source§

fn eq(&self, other: &ConstKind<I>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<I> PartialOrd for ConstKind<I>
where I: Interner,

source§

fn partial_cmp(&self, other: &ConstKind<I>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

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

source§

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