Enum rustc_borrowck::StatementKind[−][src]

pub(crate) enum StatementKind<'tcx> {
    Assign(Box<(Place<'tcx>, Rvalue<'tcx>), Global>),
    FakeRead(Box<(FakeReadCause, Place<'tcx>), Global>),
    SetDiscriminant {
        place: Box<Place<'tcx>, Global>,
        variant_index: VariantIdx,
    },
    StorageLive(Local),
    StorageDead(Local),
    LlvmInlineAsm(Box<LlvmInlineAsm<'tcx>, Global>),
    Retag(RetagKind, Box<Place<'tcx>, Global>),
    AscribeUserType(Box<(Place<'tcx>, UserTypeProjection), Global>, Variance),
    Coverage(Box<Coverage, Global>),
    CopyNonOverlapping(Box<CopyNonOverlapping<'tcx>, Global>),
    Nop,
}

Variants

Assign(Box<(Place<'tcx>, Rvalue<'tcx>), Global>)

Tuple Fields

0: Box<(Place<'tcx>, Rvalue<'tcx>), Global>

Write the RHS Rvalue to the LHS Place.

FakeRead(Box<(FakeReadCause, Place<'tcx>), Global>)

Tuple Fields

This represents all the reading that a pattern match may do (e.g., inspecting constants and discriminant values), and the kind of pattern it comes from. This is in order to adapt potential error messages to these specific patterns.

Note that this also is emitted for regular let bindings to ensure that locals that are never accessed still get some sanity checks for, e.g., let x: ! = ..;

SetDiscriminant

Fields

place: Box<Place<'tcx>, Global>
variant_index: VariantIdx

Write the discriminant for a variant to the enum Place.

StorageLive(Local)

Tuple Fields

0: Local

Start a live range for the storage of the local.

StorageDead(Local)

Tuple Fields

0: Local

End the current live range for the storage of the local.

LlvmInlineAsm(Box<LlvmInlineAsm<'tcx>, Global>)

Tuple Fields

Executes a piece of inline Assembly. Stored in a Box to keep the size of StatementKind low.

Retag(RetagKind, Box<Place<'tcx>, Global>)

Tuple Fields

1: Box<Place<'tcx>, Global>

Retag references in the given place, ensuring they got fresh tags. This is part of the Stacked Borrows model. These statements are currently only interpreted by miri and only generated when “-Z mir-emit-retag” is passed. See https://internals.rust-lang.org/t/stacked-borrows-an-aliasing-model-for-rust/8153/ for more details.

AscribeUserType(Box<(Place<'tcx>, UserTypeProjection), Global>, Variance)

Tuple Fields

Encodes a user’s type ascription. These need to be preserved intact so that NLL can respect them. For example:

let a: T = y;

The effect of this annotation is to relate the type T_y of the place y to the user-given type T. The effect depends on the specified variance:

Coverage(Box<Coverage, Global>)

Tuple Fields

Marks the start of a “coverage region”, injected with ‘-Zinstrument-coverage’. A Coverage statement carries metadata about the coverage region, used to inject a coverage map into the binary. If Coverage::kind is a Counter, the statement also generates executable code, to increment a counter variable at runtime, each time the code region is executed.

CopyNonOverlapping(Box<CopyNonOverlapping<'tcx>, Global>)

Tuple Fields

Denotes a call to the intrinsic function copy_overlapping, where src_dst denotes the memory being read from and written to(one field to save memory), and size indicates how many bytes are being copied over.

Nop

No-op. Useful for deleting instructions without affecting statement indices.

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: 16 bytes

Size for each variant: