pub enum ConstKind<I: Interner> {
    Param(I::ParamConst),
    Infer(I::InferConst),
    Bound(DebruijnIndex, I::BoundConst),
    Placeholder(I::PlaceholderConst),
    Unevaluated(I::AliasConst),
    Value(I::ValueConst),
    Error(I::ErrorGuaranteed),
    Expr(I::ExprConst),
}
Expand description

Represents a constant in Rust.

Variants§

§

Param(I::ParamConst)

A const generic parameter.

§

Infer(I::InferConst)

Infer the value of the const.

§

Bound(DebruijnIndex, I::BoundConst)

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

§

Placeholder(I::PlaceholderConst)

A placeholder const - universally quantified higher-ranked const.

§

Unevaluated(I::AliasConst)

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(I::ValueConst)

Used to hold computed value.

§

Error(I::ErrorGuaranteed)

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

§

Expr(I::ExprConst)

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

Trait Implementations§

source§

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

source§

fn clone(&self) -> Self

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: Interner> Debug for ConstKind<I>

source§

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

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

impl<I: Interner> DebugWithInfcx<I> for ConstKind<I>

source§

fn fmt<InfCtx: InferCtxtLike<I>>( this: OptWithInfcx<'_, I, InfCtx, &Self>, f: &mut Formatter<'_> ) -> Result

source§

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

source§

fn decode(d: &mut D) -> Self

source§

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

source§

fn encode(&self, e: &mut E)

source§

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

source§

fn hash<H: Hasher>(&self, state: &mut H)

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: HashStableContext, I: Interner> HashStable<CTX> for ConstKind<I>where I::ParamConst: HashStable<CTX>, I::InferConst: HashStable<CTX>, I::BoundConst: HashStable<CTX>, I::PlaceholderConst: HashStable<CTX>, I::AliasConst: HashStable<CTX>, I::ValueConst: HashStable<CTX>, I::ErrorGuaranteed: HashStable<CTX>, I::ExprConst: HashStable<CTX>,

source§

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

source§

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

source§

fn cmp(&self, other: &Self) -> Ordering

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

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

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

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

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

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

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

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

source§

fn eq(&self, other: &Self) -> 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: Interner> PartialOrd<ConstKind<I>> for ConstKind<I>

source§

fn partial_cmp(&self, other: &Self) -> 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: Interner> Eq for ConstKind<I>

Auto Trait Implementations§

§

impl<I> RefUnwindSafe for ConstKind<I>where <I as Interner>::AliasConst: RefUnwindSafe, <I as Interner>::BoundConst: RefUnwindSafe, <I as Interner>::ErrorGuaranteed: RefUnwindSafe, <I as Interner>::ExprConst: RefUnwindSafe, <I as Interner>::InferConst: RefUnwindSafe, <I as Interner>::ParamConst: RefUnwindSafe, <I as Interner>::PlaceholderConst: RefUnwindSafe, <I as Interner>::ValueConst: RefUnwindSafe,

§

impl<I> Send for ConstKind<I>where <I as Interner>::AliasConst: Send, <I as Interner>::BoundConst: Send, <I as Interner>::ErrorGuaranteed: Send, <I as Interner>::ExprConst: Send, <I as Interner>::InferConst: Send, <I as Interner>::ParamConst: Send, <I as Interner>::PlaceholderConst: Send, <I as Interner>::ValueConst: Send,

§

impl<I> Sync for ConstKind<I>where <I as Interner>::AliasConst: Sync, <I as Interner>::BoundConst: Sync, <I as Interner>::ErrorGuaranteed: Sync, <I as Interner>::ExprConst: Sync, <I as Interner>::InferConst: Sync, <I as Interner>::ParamConst: Sync, <I as Interner>::PlaceholderConst: Sync, <I as Interner>::ValueConst: Sync,

§

impl<I> Unpin for ConstKind<I>where <I as Interner>::AliasConst: Unpin, <I as Interner>::BoundConst: Unpin, <I as Interner>::ErrorGuaranteed: Unpin, <I as Interner>::ExprConst: Unpin, <I as Interner>::InferConst: Unpin, <I as Interner>::ParamConst: Unpin, <I as Interner>::PlaceholderConst: Unpin, <I as Interner>::ValueConst: Unpin,

§

impl<I> UnwindSafe for ConstKind<I>where <I as Interner>::AliasConst: UnwindSafe, <I as Interner>::BoundConst: UnwindSafe, <I as Interner>::ErrorGuaranteed: UnwindSafe, <I as Interner>::ExprConst: UnwindSafe, <I as Interner>::InferConst: UnwindSafe, <I as Interner>::ParamConst: UnwindSafe, <I as Interner>::PlaceholderConst: UnwindSafe, <I as Interner>::ValueConst: UnwindSafe,

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, R> CollectAndApply<T, R> for T

source§

fn collect_and_apply<I, F>(iter: I, f: F) -> Rwhere I: Iterator<Item = T>, F: FnOnce(&[T]) -> R,

Equivalent to f(&iter.collect::<Vec<_>>()).

§

type Output = R

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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.