Enum rustc_const_eval::interpret::ConstValue
source · pub enum ConstValue<'tcx> {
Scalar(Scalar<AllocId>),
ZeroSized,
Slice {
data: ConstAllocation<'tcx>,
start: usize,
end: usize,
},
ByRef {
alloc: ConstAllocation<'tcx>,
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.
Not using the enum Value
to encode that this must not be Uninit
.
ZeroSized
Only used for ZSTs.
Slice
Used only for &[u8]
and &str
ByRef
Fields
alloc: ConstAllocation<'tcx>
The backing memory of the value, may contain more memory than needed for just the value
in order to share ConstAllocation
s between values
A value not represented/representable by Scalar
or Slice
Auto Trait Implementations§
impl<'tcx> RefUnwindSafe for ConstValue<'tcx>
impl<'tcx> Send for ConstValue<'tcx>
impl<'tcx> Sync for ConstValue<'tcx>
impl<'tcx> Unpin for ConstValue<'tcx>
impl<'tcx> UnwindSafe for ConstValue<'tcx>
Blanket Implementations§
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 bytesZeroSized
: 0 bytesSlice
: 24 bytesByRef
: 16 bytes