Enum rustc_const_eval::interpret::ConstValue
source · [−]pub enum ConstValue<'tcx> {
Scalar(Scalar<AllocId>),
Slice {
data: &Allocation<AllocId, ()>,
start: usize,
end: usize,
},
ByRef {
alloc: &Allocation<AllocId, ()>,
offset: Size,
},
}Expand description
Represents a constant value in Rust. Scalar and Slice are optimizations for
array length computations, enum discriminants and the pattern matching logic.
Variants
Scalar(Scalar<AllocId>)
Used only for types with layout::abi::Scalar ABI and ZSTs.
Not using the enum Value to encode that this must not be Uninit.
Slice
Used only for &[u8] and &str
ByRef
Fields
alloc: &Allocation<AllocId, ()>The backing memory of the value, may contain more memory than needed for just the value
in order to share Allocations between values
offset: SizeOffset into alloc
A value not represented/representable by Scalar or Slice
Auto Trait Implementations
impl<'tcx> RefUnwindSafe for ConstValue
impl<'tcx> Send for ConstValue
impl<'tcx> Sync for ConstValue
impl<'tcx> Unpin for ConstValue
impl<'tcx> UnwindSafe for ConstValue
Blanket Implementations
Mutably borrows from an owned value. Read more
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:
Scalar: 24 bytesSlice: 24 bytesByRef: 16 bytes