Enum rustc_middle::mir::interpret::value::ConstValue [−][src]
pub enum ConstValue<'tcx> {
Scalar(Scalar),
Slice {
data: &'tcx Allocation,
start: usize,
end: usize,
},
ByRef {
alloc: &'tcx Allocation,
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)
Used only for types with layout::abi::Scalar
ABI and ZSTs.
Not using the enum Value
to encode that this must not be Uninit
.
Tuple Fields of Scalar
0: Scalar
Used only for &[u8]
and &str
Fields of Slice
A value not represented/representable by Scalar
or Slice
Fields of ByRef
alloc: &'tcx Allocation
The backing memory of the value, may contain more memory than needed for just the value
in order to share Allocation
s between values
offset: Size
Offset into alloc
Implementations
Trait Implementations
type Lifted = ConstValue<'tcx>
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
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
Mutably borrows from an owned value. Read more
impl<Ctxt, T> DepNodeParams<Ctxt> for T where
Ctxt: DepContext,
T: for<'a> HashStable<StableHashingContext<'a>> + Debug,
impl<Ctxt, T> DepNodeParams<Ctxt> for T where
Ctxt: DepContext,
T: for<'a> HashStable<StableHashingContext<'a>> + Debug,
This method turns the parameters of a DepNodeConstructor into an opaque Fingerprint to be used in DepNode. Not all DepNodeParams support being turned into a Fingerprint (they don’t need to if the corresponding DepNode is anonymous). Read more
This method tries to recover the query key from the given DepNode
,
something which is needed when forcing DepNode
s during red-green
evaluation. The query system will only call this method if
fingerprint_style()
is not FingerprintStyle::Opaque
.
It is always valid to return None
here, in which case incremental
compilation will treat the query as having changed instead of forcing it. 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