Enum ConstSource
pub enum ConstSource<'tcx> {
Item {
def_id: DefId,
args: &'tcx RawList<(), GenericArg<'tcx>>,
},
Promoted {
def_id: DefId,
args: &'tcx RawList<(), GenericArg<'tcx>>,
promoted: Promoted,
},
Global(GlobalRef),
TyConst(Alias<TyCtxt<'tcx>, AliasConstKind<TyCtxt<'tcx>>>),
ValTree(Value<'tcx>),
Value(ConstValue, Ty<'tcx>),
}Expand description
A constant that we can ask rustc to evaluate.
Variants§
Item
A const item or associated const.
Promoted
A promoted constant in the body of def_id.
Global(GlobalRef)
The contents of a global, viewed at type [ConstReader::global_ty].
TyConst(Alias<TyCtxt<'tcx>, AliasConstKind<TyCtxt<'tcx>>>)
A type-system constant, e.g. an array length or an inline const {} block.
ValTree(Value<'tcx>)
An already-evaluated type-system constant.
Value(ConstValue, Ty<'tcx>)
An already-evaluated constant, e.g. found in MIR.
Trait Implementations§
§impl<'tcx> Clone for ConstSource<'tcx>
impl<'tcx> Clone for ConstSource<'tcx>
§fn clone(&self) -> ConstSource<'tcx>
fn clone(&self) -> ConstSource<'tcx>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'tcx> Copy for ConstSource<'tcx>
Auto Trait Implementations§
impl<'tcx> !RefUnwindSafe for ConstSource<'tcx>
impl<'tcx> !UnwindSafe for ConstSource<'tcx>
impl<'tcx> DynSend for ConstSource<'tcx>
impl<'tcx> DynSync for ConstSource<'tcx>
impl<'tcx> Freeze for ConstSource<'tcx>
impl<'tcx> Send for ConstSource<'tcx>
impl<'tcx> Sync for ConstSource<'tcx>
impl<'tcx> Unpin for ConstSource<'tcx>
impl<'tcx> UnsafeUnpin for ConstSource<'tcx>
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
Converts
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> ⓘ
Converts
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 more