Enum rustc_middle::mir::terminator::TerminatorKind[−][src]

pub enum TerminatorKind<'tcx> {
Show variants Goto { target: BasicBlock, }, SwitchInt { discr: Operand<'tcx>, switch_ty: Ty<'tcx>, targets: SwitchTargets, }, Resume, Abort, Return, Unreachable, Drop { place: Place<'tcx>, target: BasicBlock, unwind: Option<BasicBlock>, }, DropAndReplace { place: Place<'tcx>, value: Operand<'tcx>, target: BasicBlock, unwind: Option<BasicBlock>, }, Call { func: Operand<'tcx>, args: Vec<Operand<'tcx>>, destination: Option<(Place<'tcx>, BasicBlock)>, cleanup: Option<BasicBlock>, from_hir_call: bool, fn_span: Span, }, Assert { cond: Operand<'tcx>, expected: bool, msg: AssertMessage<'tcx>, target: BasicBlock, cleanup: Option<BasicBlock>, }, Yield { value: Operand<'tcx>, resume: BasicBlock, resume_arg: Place<'tcx>, drop: Option<BasicBlock>, }, GeneratorDrop, FalseEdge { real_target: BasicBlock, imaginary_target: BasicBlock, }, FalseUnwind { real_target: BasicBlock, unwind: Option<BasicBlock>, }, InlineAsm { template: &'tcx [InlineAsmTemplatePiece], operands: Vec<InlineAsmOperand<'tcx>>, options: InlineAsmOptions, line_spans: &'tcx [Span], destination: Option<BasicBlock>, },
}

Variants

Goto
Expand description

Block should have one successor in the graph; we jump there.

Show fields

Fields of Goto

target: BasicBlock
SwitchInt
Expand description

Operand evaluates to an integer; jump depending on its value to one of the targets, and otherwise fallback to otherwise.

Show fields

Fields of SwitchInt

discr: Operand<'tcx>
Expand description

The discriminant value being tested.

switch_ty: Ty<'tcx>
Expand description

The type of value being tested. This is always the same as the type of discr. FIXME: remove this redundant information. Currently, it is relied on by pretty-printing.

targets: SwitchTargets
Resume
Expand description

Indicates that the landing pad is finished and unwinding should continue. Emitted by build::scope::diverge_cleanup.

Abort
Expand description

Indicates that the landing pad is finished and that the process should abort. Used to prevent unwinding for foreign items.

Return
Expand description

Indicates a normal return. The return place should have been filled in before this executes. This can occur multiple times in different basic blocks.

Unreachable
Expand description

Indicates a terminator that can never be reached.

Drop
Expand description

Drop the Place.

Show fields

Fields of Drop

place: Place<'tcx>target: BasicBlockunwind: Option<BasicBlock>
DropAndReplace
Expand description

Drop the Place and assign the new value over it. This ensures that the assignment to P occurs even if the destructor for place unwinds. Its semantics are best explained by the elaboration:

BB0 {
  DropAndReplace(P <- V, goto BB1, unwind BB2)
}

becomes

BB0 {
  Drop(P, goto BB1, unwind BB2)
}
BB1 {
  // P is now uninitialized
  P <- V
}
BB2 {
  // P is now uninitialized -- its dtor panicked
  P <- V
}

Note that DropAndReplace is eliminated as part of the ElaborateDrops pass.

Show fields

Fields of DropAndReplace

place: Place<'tcx>value: Operand<'tcx>target: BasicBlockunwind: Option<BasicBlock>
Call
Expand description

Block ends with a call of a function.

Show fields

Fields of Call

func: Operand<'tcx>
Expand description

The function that’s being called.

args: Vec<Operand<'tcx>>
Expand description

Arguments the function is called with. These are owned by the callee, which is free to modify them. This allows the memory occupied by “by-value” arguments to be reused across function calls without duplicating the contents.

destination: Option<(Place<'tcx>, BasicBlock)>
Expand description

Destination for the return value. If some, the call is converging.

cleanup: Option<BasicBlock>
Expand description

Cleanups to be done if the call unwinds.

from_hir_call: bool
Expand description

true if this is from a call in HIR rather than from an overloaded operator. True for overloaded function call.

fn_span: Span
Expand description

This Span is the span of the function, without the dot and receiver (e.g. foo(a, b) in x.foo(a, b)

Assert
Expand description

Jump to the target if the condition has the expected value, otherwise panic with a message and a cleanup target.

Show fields

Fields of Assert

cond: Operand<'tcx>expected: boolmsg: AssertMessage<'tcx>target: BasicBlockcleanup: Option<BasicBlock>
Yield
Expand description

A suspend point.

Show fields

Fields of Yield

value: Operand<'tcx>
Expand description

The value to return.

resume: BasicBlock
Expand description

Where to resume to.

resume_arg: Place<'tcx>
Expand description

The place to store the resume argument in.

drop: Option<BasicBlock>
Expand description

Cleanup to be done if the generator is dropped at this suspend point.

GeneratorDrop
Expand description

Indicates the end of the dropping of a generator.

FalseEdge
Expand description

A block where control flow only ever takes one real path, but borrowck needs to be more conservative.

Show fields

Fields of FalseEdge

real_target: BasicBlock
Expand description

The target normal control flow will take.

imaginary_target: BasicBlock
Expand description

A block control flow could conceptually jump to, but won’t in practice.

FalseUnwind
Expand description

A terminator for blocks that only take one path in reality, but where we reserve the right to unwind in borrowck, even if it won’t happen in practice. This can arise in infinite loops with no function calls for example.

Show fields

Fields of FalseUnwind

real_target: BasicBlock
Expand description

The target normal control flow will take.

unwind: Option<BasicBlock>
Expand description

The imaginary cleanup block link. This particular path will never be taken in practice, but in order to avoid fragility we want to always consider it in borrowck. We don’t want to accept programs which pass borrowck only when panic=abort or some assertions are disabled due to release vs. debug mode builds. This needs to be an Option because of the remove_noop_landing_pads and no_landing_pads passes.

InlineAsm
Expand description

Block ends with an inline assembly block. This is a terminator since inline assembly is allowed to diverge.

Show fields

Fields of InlineAsm

template: &'tcx [InlineAsmTemplatePiece]
Expand description

The template for the inline assembly, with placeholders.

operands: Vec<InlineAsmOperand<'tcx>>
Expand description

The operands for the inline assembly, as Operands or Places.

options: InlineAsmOptions
Expand description

Miscellaneous options for the inline assembly.

line_spans: &'tcx [Span]
Expand description

Source spans for each line of the inline assembly code. These are used to map assembler errors back to the line in the source code.

destination: Option<BasicBlock>
Expand description

Destination block after the inline assembly returns, unless it is diverging (InlineAsmOptions::NORETURN).

Implementations

impl<'tcx> TerminatorKind<'tcx>[src]

pub fn if_(
    tcx: TyCtxt<'tcx>,
    cond: Operand<'tcx>,
    t: BasicBlock,
    f: BasicBlock
) -> TerminatorKind<'tcx>
[src]

pub fn successors(&self) -> Successors<'_>[src]

pub fn successors_mut(&mut self) -> SuccessorsMut<'_>[src]

pub fn unwind(&self) -> Option<&Option<BasicBlock>>[src]

pub fn unwind_mut(&mut self) -> Option<&mut Option<BasicBlock>>[src]

pub fn as_switch(&self) -> Option<(&Operand<'tcx>, Ty<'tcx>, &SwitchTargets)>[src]

pub fn as_goto(&self) -> Option<BasicBlock>[src]

impl<'tcx> TerminatorKind<'tcx>[src]

pub fn fmt_head<W: Write>(&self, fmt: &mut W) -> Result[src]

Writes the “head” part of the terminator; that is, its name and the data it uses to pick the successor basic block, if any. The only information not included is the list of possible successors, which may be rendered differently between the text and the graphviz format.

pub fn fmt_successor_labels(&self) -> Vec<Cow<'static, str>>[src]

Returns the list of labels for the edges to the successor basic blocks.

Trait Implementations

impl<'tcx> Clone for TerminatorKind<'tcx>[src]

fn clone(&self) -> TerminatorKind<'tcx>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'tcx> Debug for TerminatorKind<'tcx>[src]

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

Formats the value using the given formatter. Read more

impl<'tcx, __D: TyDecoder<'tcx>> Decodable<__D> for TerminatorKind<'tcx>[src]

fn decode(__decoder: &mut __D) -> Result<Self, <__D as Decoder>::Error>[src]

impl<'tcx, __E: TyEncoder<'tcx>> Encodable<__E> for TerminatorKind<'tcx>[src]

fn encode(&self, __encoder: &mut __E) -> Result<(), <__E as Encoder>::Error>[src]

impl<'tcx> Hash for TerminatorKind<'tcx>[src]

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher, 
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl<'tcx, '__ctx> HashStable<StableHashingContext<'__ctx>> for TerminatorKind<'tcx>[src]

fn hash_stable(
    &self,
    __hcx: &mut StableHashingContext<'__ctx>,
    __hasher: &mut StableHasher
)
[src]

impl<'tcx> PartialEq<TerminatorKind<'tcx>> for TerminatorKind<'tcx>[src]

fn eq(&self, other: &TerminatorKind<'tcx>) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &TerminatorKind<'tcx>) -> bool[src]

This method tests for !=.

impl<'tcx> PartialOrd<TerminatorKind<'tcx>> for TerminatorKind<'tcx>[src]

fn partial_cmp(&self, other: &TerminatorKind<'tcx>) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<'tcx> StructuralPartialEq for TerminatorKind<'tcx>[src]

Auto Trait Implementations

impl<'tcx> !RefUnwindSafe for TerminatorKind<'tcx>

impl<'tcx> !Send for TerminatorKind<'tcx>

impl<'tcx> !Sync for TerminatorKind<'tcx>

impl<'tcx> Unpin for TerminatorKind<'tcx>

impl<'tcx> !UnwindSafe for TerminatorKind<'tcx>

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Error = !

pub fn from(Result<T, <T as MaybeResult<T>>::Error>) -> T[src]

pub fn to_result(self) -> Result<T, <T as MaybeResult<T>>::Error>[src]

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

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

recently added

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

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

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

Performs the conversion.

impl<T> WithConstness for T[src]

fn with_constness(self, constness: Constness) -> ConstnessAnd<Self>[src]

fn with_const(self) -> ConstnessAnd<Self>[src]

fn without_const(self) -> ConstnessAnd<Self>[src]

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