pub enum ConstKind<I: Interner> {
    Param(I::ParamConst),
    Infer(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(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<Infcx: InferCtxtLike<Interner = I>>( this: WithInfcx<'_, Infcx, &Self>, f: &mut Formatter<'_> ) -> Result

source§

impl<I: Interner, __D: TyDecoder<I = I>> Decodable<__D> for ConstKind<I>

source§

fn decode(__decoder: &mut __D) -> Self

source§

impl<I: Interner, __E: TyEncoder<I = I>> Encodable<__E> for ConstKind<I>

source§

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

source§

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

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: Interner, __CTX> HashStable<__CTX> for ConstKind<I>
where I::ParamConst: 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) -> 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: Interner> PartialEq 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 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> Copy for ConstKind<I>

source§

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

Auto Trait Implementations§

§

impl<I> RefUnwindSafe for ConstKind<I>

§

impl<I> Send for ConstKind<I>

§

impl<I> Sync for ConstKind<I>

§

impl<I> Unpin for ConstKind<I>

§

impl<I> UnwindSafe for ConstKind<I>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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) -> R
where 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 T
where 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 T
where 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 T
where 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 T
where 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.