Skip to main content

PlaceKind

Enum PlaceKind 

Source
pub enum PlaceKind {
    Object(ObjectId),
    Deref(Box<Expr>),
    Index {
        base: Box<Expr>,
        index: Box<Expr>,
    },
    Field {
        base: Box<Place>,
        record: RecordId,
        index: usize,
    },
    ComplexPart {
        base: Box<Place>,
        imag: bool,
    },
    Str(StrId),
    Temporary(Box<Expr>),
    CompoundLiteral {
        object: ObjectId,
        init: Box<Expr>,
    },
}
Expand description

The shape of a Place.

Variants§

§

Object(ObjectId)

A named object.

§

Deref(Box<Expr>)

*ptr, where ptr has pointer type.

§

Index

base[index], where base has pointer type: the same thing as *(base + index), which is what C says it is.

Fields

§base: Box<Expr>

The pointer the subscript is relative to.

§index: Box<Expr>

The subscript, of integer type.

§

Field

base.field, where field indexes the record’s member list. p->f arrives as a Field over a Deref.

Fields

§base: Box<Place>

The record the member belongs to.

§record: RecordId

The record’s identity.

§index: usize

The index of the member in the record’s field list.

§

ComplexPart

__real__ z or __imag__ z: one part of a complex object, which GNU C makes an lvalue whenever z is one, so __imag__ z = 1.0; assigns.

The type of the place is the corresponding real type; base is the complex object, which may be a PlaceKind::Temporary when the operand was an rvalue.

Fields

§base: Box<Place>

The complex object the part belongs to.

§imag: bool

Whether this is __imag__ rather than __real__.

§

Str(StrId)

A string literal, whose type is an array of char (or of wchar_t).

§

Temporary(Box<Expr>)

A temporary holding the value of an expression, which is what makes f().field work for a struct returned by value.

§

CompoundLiteral

The object a block-scope compound literal ((T){ … }, C99 6.5.2.5) denotes.

Unlike a PlaceKind::Temporary it is a real object with automatic storage duration and the lifetime of the enclosing block, so its address may be taken and used for the rest of that block. object is a hidden local sema declares at the top of that block, zero-initialised; init is the value the literal was written with, and is evaluated here — where the literal stands — so that C’s evaluation order survives and a literal inside a loop is built afresh on every iteration. A compound literal at file scope is an ordinary Storage::Static object instead and arrives as a PlaceKind::Object.

Fields

§object: ObjectId

The hidden local the object lives in.

§init: Box<Expr>

The value stored into it where the literal was written.

Trait Implementations§

Source§

impl Clone for PlaceKind

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PlaceKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.