Enum rustc_type_ir::ConstKind
source · pub enum ConstKind<I: Interner> {
Param(I::ParamConst),
Infer(InferConst),
Bound(DebruijnIndex, I::BoundConst),
Placeholder(I::PlaceholderConst),
Unevaluated(UnevaluatedConst<I>),
Value(I::Ty, 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(UnevaluatedConst<I>)
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::Ty, 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, __D: TyDecoder<I = I>> Decodable<__D> for ConstKind<I>where
I::ParamConst: Decodable<__D>,
I::BoundConst: Decodable<__D>,
I::PlaceholderConst: Decodable<__D>,
UnevaluatedConst<I>: Decodable<__D>,
I::Ty: Decodable<__D>,
I::ValueConst: Decodable<__D>,
I::ErrorGuaranteed: Decodable<__D>,
I::ExprConst: Decodable<__D>,
impl<I: Interner, __D: TyDecoder<I = I>> Decodable<__D> for ConstKind<I>where
I::ParamConst: Decodable<__D>,
I::BoundConst: Decodable<__D>,
I::PlaceholderConst: Decodable<__D>,
UnevaluatedConst<I>: Decodable<__D>,
I::Ty: Decodable<__D>,
I::ValueConst: Decodable<__D>,
I::ErrorGuaranteed: Decodable<__D>,
I::ExprConst: Decodable<__D>,
source§impl<I: Interner, __E: TyEncoder<I = I>> Encodable<__E> for ConstKind<I>where
I::ParamConst: Encodable<__E>,
I::BoundConst: Encodable<__E>,
I::PlaceholderConst: Encodable<__E>,
UnevaluatedConst<I>: Encodable<__E>,
I::Ty: Encodable<__E>,
I::ValueConst: Encodable<__E>,
I::ErrorGuaranteed: Encodable<__E>,
I::ExprConst: Encodable<__E>,
impl<I: Interner, __E: TyEncoder<I = I>> Encodable<__E> for ConstKind<I>where
I::ParamConst: Encodable<__E>,
I::BoundConst: Encodable<__E>,
I::PlaceholderConst: Encodable<__E>,
UnevaluatedConst<I>: Encodable<__E>,
I::Ty: Encodable<__E>,
I::ValueConst: Encodable<__E>,
I::ErrorGuaranteed: Encodable<__E>,
I::ExprConst: Encodable<__E>,
source§impl<I: Interner, __CTX> HashStable<__CTX> for ConstKind<I>where
I::ParamConst: HashStable<__CTX>,
I::BoundConst: HashStable<__CTX>,
I::PlaceholderConst: HashStable<__CTX>,
UnevaluatedConst<I>: HashStable<__CTX>,
I::Ty: HashStable<__CTX>,
I::ValueConst: HashStable<__CTX>,
I::ErrorGuaranteed: HashStable<__CTX>,
I::ExprConst: HashStable<__CTX>,
impl<I: Interner, __CTX> HashStable<__CTX> for ConstKind<I>where
I::ParamConst: HashStable<__CTX>,
I::BoundConst: HashStable<__CTX>,
I::PlaceholderConst: HashStable<__CTX>,
UnevaluatedConst<I>: HashStable<__CTX>,
I::Ty: HashStable<__CTX>,
I::ValueConst: HashStable<__CTX>,
I::ErrorGuaranteed: HashStable<__CTX>,
I::ExprConst: HashStable<__CTX>,
fn hash_stable(&self, __hcx: &mut __CTX, __hasher: &mut StableHasher)
impl<I> Copy for ConstKind<I>where
I: Interner,
impl<I> Eq for ConstKind<I>where
I: Interner,
Auto Trait Implementations§
impl<I> Freeze for ConstKind<I>where
<I as Interner>::ParamConst: Freeze,
<I as Interner>::BoundConst: Freeze,
<I as Interner>::PlaceholderConst: Freeze,
<I as Interner>::Ty: Freeze,
<I as Interner>::ValueConst: Freeze,
<I as Interner>::ErrorGuaranteed: Freeze,
<I as Interner>::ExprConst: Freeze,
<I as Interner>::DefId: Freeze,
<I as Interner>::GenericArgs: Freeze,
impl<I> RefUnwindSafe for ConstKind<I>where
<I as Interner>::ParamConst: RefUnwindSafe,
<I as Interner>::BoundConst: RefUnwindSafe,
<I as Interner>::PlaceholderConst: RefUnwindSafe,
<I as Interner>::Ty: RefUnwindSafe,
<I as Interner>::ValueConst: RefUnwindSafe,
<I as Interner>::ErrorGuaranteed: RefUnwindSafe,
<I as Interner>::ExprConst: RefUnwindSafe,
<I as Interner>::DefId: RefUnwindSafe,
<I as Interner>::GenericArgs: RefUnwindSafe,
impl<I> Send for ConstKind<I>where
<I as Interner>::ParamConst: Send,
<I as Interner>::BoundConst: Send,
<I as Interner>::PlaceholderConst: Send,
<I as Interner>::Ty: Send,
<I as Interner>::ValueConst: Send,
<I as Interner>::ErrorGuaranteed: Send,
<I as Interner>::ExprConst: Send,
<I as Interner>::DefId: Send,
<I as Interner>::GenericArgs: Send,
impl<I> Sync for ConstKind<I>where
<I as Interner>::ParamConst: Sync,
<I as Interner>::BoundConst: Sync,
<I as Interner>::PlaceholderConst: Sync,
<I as Interner>::Ty: Sync,
<I as Interner>::ValueConst: Sync,
<I as Interner>::ErrorGuaranteed: Sync,
<I as Interner>::ExprConst: Sync,
<I as Interner>::DefId: Sync,
<I as Interner>::GenericArgs: Sync,
impl<I> Unpin for ConstKind<I>where
<I as Interner>::ParamConst: Unpin,
<I as Interner>::BoundConst: Unpin,
<I as Interner>::PlaceholderConst: Unpin,
<I as Interner>::Ty: Unpin,
<I as Interner>::ValueConst: Unpin,
<I as Interner>::ErrorGuaranteed: Unpin,
<I as Interner>::ExprConst: Unpin,
<I as Interner>::DefId: Unpin,
<I as Interner>::GenericArgs: Unpin,
impl<I> UnwindSafe for ConstKind<I>where
<I as Interner>::ParamConst: UnwindSafe,
<I as Interner>::BoundConst: UnwindSafe,
<I as Interner>::PlaceholderConst: UnwindSafe,
<I as Interner>::Ty: UnwindSafe,
<I as Interner>::ValueConst: UnwindSafe,
<I as Interner>::ErrorGuaranteed: UnwindSafe,
<I as Interner>::ExprConst: UnwindSafe,
<I as Interner>::DefId: UnwindSafe,
<I as Interner>::GenericArgs: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
source§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> T
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
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.