[][src]Enum rustc::mir::interpret::Scalar

pub enum Scalar<Tag = (), Id = AllocId> {
    Raw {
        data: u128,
        size: u8,
    },
    Ptr(Pointer<Tag, Id>),
}
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

A Scalar represents an immediate, primitive value existing outside of a memory::Allocation. It is in many ways like a small chunk of a Allocation, up to 8 bytes in size. Like a range of bytes in an Allocation, a Scalar can either represent the raw bytes of a simple value or a pointer into another Allocation

Variants

Raw
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

The raw bytes of a simple value.

Fields of Raw

data: u128
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

The first size bytes of data are the value. Do not try to read less or more bytes than that. The remaining bytes must be 0.

size: u8
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Ptr(Pointer<Tag, Id>)
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

A pointer into an Allocation. An Allocation in the memory module has a list of relocations, but a Scalar is only large enough to contain one, so we just represent the relocation and its associated offset together as a Pointer here.

Methods

impl Scalar<()>[src]

fn check_data(data: u128, size: u8)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn with_tag<Tag>(self, new_tag: Tag) -> Scalar<Tag>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Tag this scalar with new_tag if it is a pointer, leave it unchanged otherwise.

Used by MemPlace::replace_tag.

impl<'tcx, Tag> Scalar<Tag>[src]

pub fn erase_tag(self) -> Scalar[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Erase the tag from the scalar, if any.

Used by error reporting code to avoid having the error type depend on Tag.

pub fn ptr_null(cx: &impl HasDataLayout) -> Self[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn zst() -> Self[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn ptr_offset(
    self,
    i: Size,
    cx: &impl HasDataLayout
) -> InterpResult<'tcx, Self>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn ptr_wrapping_offset(self, i: Size, cx: &impl HasDataLayout) -> Self[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn ptr_signed_offset(
    self,
    i: i64,
    cx: &impl HasDataLayout
) -> InterpResult<'tcx, Self>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn ptr_wrapping_signed_offset(self, i: i64, cx: &impl HasDataLayout) -> Self[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn from_bool(b: bool) -> Self[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn from_char(c: char) -> Self[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn try_from_uint(i: impl Into<u128>, size: Size) -> Option<Self>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn from_uint(i: impl Into<u128>, size: Size) -> Self[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn from_u8(i: u8) -> Self[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn from_u16(i: u16) -> Self[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn from_u32(i: u32) -> Self[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn from_u64(i: u64) -> Self[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn try_from_int(i: impl Into<i128>, size: Size) -> Option<Self>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn from_int(i: impl Into<i128>, size: Size) -> Self[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn from_f32(f: Single) -> Self[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn from_f64(f: Double) -> Self[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn to_bits_or_ptr(
    self,
    target_size: Size,
    cx: &impl HasDataLayout
) -> Result<u128, Pointer<Tag>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

This is very rarely the method you want! You should dispatch on the type and use force_bits/assert_bits/force_ptr/assert_ptr. This method only exists for the benefit of low-level memory operations as well as the implementation of the force_* methods.

pub fn check_raw(data: u128, size: u8, target_size: Size)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn to_bits(self, target_size: Size) -> InterpResult<'tcx, u128>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Do not call this method! Use either assert_bits or force_bits.

pub fn assert_bits(self, target_size: Size) -> u128[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn to_ptr(self) -> InterpResult<'tcx, Pointer<Tag>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Do not call this method! Use either assert_ptr or force_ptr. This method is intentionally private, do not make it public.

pub fn assert_ptr(self) -> Pointer<Tag>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn is_bits(self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Do not call this method! Dispatch based on the type instead.

pub fn is_ptr(self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Do not call this method! Dispatch based on the type instead.

pub fn to_bool(self) -> InterpResult<'tcx, bool>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn to_char(self) -> InterpResult<'tcx, char>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn to_unsigned_with_bit_width(self, bits: u64) -> InterpResult<'static, u128>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn to_u8(self) -> InterpResult<'static, u8>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Converts the scalar to produce an u8. Fails if the scalar is a pointer.

pub fn to_u16(self) -> InterpResult<'static, u16>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Converts the scalar to produce an u16. Fails if the scalar is a pointer.

pub fn to_u32(self) -> InterpResult<'static, u32>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Converts the scalar to produce an u32. Fails if the scalar is a pointer.

pub fn to_u64(self) -> InterpResult<'static, u64>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Converts the scalar to produce an u64. Fails if the scalar is a pointer.

pub fn to_machine_usize(
    self,
    cx: &impl HasDataLayout
) -> InterpResult<'static, u64>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn to_signed_with_bit_width(self, bits: u64) -> InterpResult<'static, i128>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn to_i8(self) -> InterpResult<'static, i8>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Converts the scalar to produce an i8. Fails if the scalar is a pointer.

pub fn to_i16(self) -> InterpResult<'static, i16>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Converts the scalar to produce an i16. Fails if the scalar is a pointer.

pub fn to_i32(self) -> InterpResult<'static, i32>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Converts the scalar to produce an i32. Fails if the scalar is a pointer.

pub fn to_i64(self) -> InterpResult<'static, i64>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Converts the scalar to produce an i64. Fails if the scalar is a pointer.

pub fn to_machine_isize(
    self,
    cx: &impl HasDataLayout
) -> InterpResult<'static, i64>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn to_f32(self) -> InterpResult<'static, Single>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn to_f64(self) -> InterpResult<'static, Double>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Trait Implementations

impl<Tag: Clone, Id: Clone> Clone for Scalar<Tag, Id>[src]

impl<Tag: Copy, Id: Copy> Copy for Scalar<Tag, Id>[src]

impl<Tag: Debug, Id: Debug> Debug for Scalar<Tag, Id>[src]

impl<Tag: Decodable, Id: Decodable> Decodable for Scalar<Tag, Id>[src]

impl<Tag> Display for Scalar<Tag>[src]

impl<Tag: Encodable, Id: Encodable> Encodable for Scalar<Tag, Id>[src]

impl<Tag: Eq, Id: Eq> Eq for Scalar<Tag, Id>[src]

impl<Tag> From<IeeeFloat<DoubleS>> for Scalar<Tag>[src]

impl<Tag> From<IeeeFloat<SingleS>> for Scalar<Tag>[src]

impl<Tag> From<Pointer<Tag, AllocId>> for Scalar<Tag>[src]

impl<Tag> From<Scalar<Tag, AllocId>> for ScalarMaybeUndef<Tag>[src]

impl<Tag: Hash, Id: Hash> Hash for Scalar<Tag, Id>[src]

impl<'__ctx, Tag, Id> HashStable<StableHashingContext<'__ctx>> for Scalar<Tag, Id> where
    Tag: HashStable<StableHashingContext<'__ctx>>,
    Id: HashStable<StableHashingContext<'__ctx>>, 
[src]

impl<Tag: Ord, Id: Ord> Ord for Scalar<Tag, Id>[src]

impl<Tag: PartialEq, Id: PartialEq> PartialEq<Scalar<Tag, Id>> for Scalar<Tag, Id>[src]

impl<Tag: PartialOrd, Id: PartialOrd> PartialOrd<Scalar<Tag, Id>> for Scalar<Tag, Id>[src]

impl<Tag, Id> StructuralEq for Scalar<Tag, Id>[src]

impl<Tag, Id> StructuralPartialEq for Scalar<Tag, Id>[src]

Auto Trait Implementations

impl<Tag, Id> RefUnwindSafe for Scalar<Tag, Id> where
    Id: RefUnwindSafe,
    Tag: RefUnwindSafe

impl<Tag, Id> Send for Scalar<Tag, Id> where
    Id: Send,
    Tag: Send

impl<Tag, Id> Sync for Scalar<Tag, Id> where
    Id: Sync,
    Tag: Sync

impl<Tag, Id> Unpin for Scalar<Tag, Id> where
    Id: Unpin,
    Tag: Unpin

impl<Tag, Id> UnwindSafe for Scalar<Tag, Id> where
    Id: UnwindSafe,
    Tag: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> ArenaAllocatable for T where
    T: Copy
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<'a, T> Captures<'a> for T where
    T: ?Sized
[src]

impl<T> Decodable for T where
    T: UseSpecializedDecodable
[src]

impl<T> Encodable for T where
    T: UseSpecializedEncodable + ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> Erased for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> MaybeResult<T> for T[src]

type Error = !

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

impl<E> SpecializationError for E[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.