Enum rustc_const_eval::interpret::ConstValue[][src]

pub enum ConstValue<'tcx> {
    Scalar(Scalar<AllocId>),
    Slice {
        data: &'tcx Allocation<AllocId, ()>,
        start: usize,
        end: usize,
    },
    ByRef {
        alloc: &'tcx 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.

Tuple Fields of Scalar

0: Scalar<AllocId>
Slice

Used only for &[u8] and &str

Fields of Slice

data: &'tcx Allocation<AllocId, ()>start: usizeend: usize
ByRef

A value not represented/representable by Scalar or Slice

Fields of ByRef

alloc: &'tcx 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: Size

Offset into alloc

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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: