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>)
Write the RHS Rvalue to the LHS Place.
FakeRead(Box<(FakeReadCause, Place<'tcx>), Global>)
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
Write the discriminant for a variant to the enum Place.
StorageLive(Local)
Tuple Fields
0: LocalStart a live range for the storage of the local.
StorageDead(Local)
Tuple Fields
0: LocalEnd the current live range for the storage of the local.
LlvmInlineAsm(Box<LlvmInlineAsm<'tcx>, Global>)
Tuple Fields
0: Box<LlvmInlineAsm<'tcx>, Global>Executes a piece of inline Assembly. Stored in a Box to keep the size
of StatementKind low.
Retag(RetagKind, 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)
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:
Covariant– requires thatT_y <: TContravariant– requires thatT_y :> TInvariant– requires thatT_y == TBivariant– no effect
Coverage(Box<Coverage, Global>)
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
0: Box<CopyNonOverlapping<'tcx>, Global>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
impl<'tcx> !RefUnwindSafe for StatementKind<'tcx>
impl<'tcx> !Send for StatementKind<'tcx>
impl<'tcx> !Sync for StatementKind<'tcx>
impl<'tcx> Unpin for StatementKind<'tcx>
impl<'tcx> !UnwindSafe for StatementKind<'tcx>
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn subst_spanned(
self,
tcx: TyCtxt<'tcx>,
substs: &[GenericArg<'tcx>],
span: Option<Span>
) -> T
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:
Assign: 15 bytesFakeRead: 15 bytesSetDiscriminant: 15 bytesStorageLive: 7 bytesStorageDead: 7 bytesLlvmInlineAsm: 15 bytesRetag: 15 bytesAscribeUserType: 15 bytesCoverage: 15 bytesCopyNonOverlapping: 15 bytesNop: 0 bytes