pub enum Terminator {
Goto {
target: BlockId,
args_start: u32,
args_len: u32,
},
Branch {
cond: CfgValue,
then_block: BlockId,
then_args_start: u32,
then_args_len: u32,
else_block: BlockId,
else_args_start: u32,
else_args_len: u32,
},
Switch {
scrutinee: CfgValue,
cases_start: u32,
cases_len: u32,
default: BlockId,
},
Return {
value: Option<CfgValue>,
},
Unreachable,
None,
}Expand description
Block terminator - how control leaves a basic block.
Terminators are the ONLY place where control flow happens in the CFG.
Block arguments are stored in the CFG’s extra array for efficiency.
Use Cfg::get_goto_args(), Cfg::get_branch_then_args(), and
Cfg::get_branch_else_args() to retrieve the arguments.
Variants§
Goto
Unconditional jump to another block. Arguments are stored in Cfg’s extra array.
Fields
Branch
Conditional branch. Arguments for each branch are stored in Cfg’s extra array.
Fields
Switch
Multi-way branch (switch/match). Cases are stored in Cfg’s switch_cases array.
Fields
Return
Return from function (None for unit-returning functions).
Unreachable
Unreachable - control never reaches here. Used after diverging expressions.
None
Placeholder for blocks under construction. Should not exist in a valid CFG.
Trait Implementations§
Source§impl Clone for Terminator
impl Clone for Terminator
Source§fn clone(&self) -> Terminator
fn clone(&self) -> Terminator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Terminator
impl Debug for Terminator
impl Copy for Terminator
Auto Trait Implementations§
impl Freeze for Terminator
impl RefUnwindSafe for Terminator
impl Send for Terminator
impl Sync for Terminator
impl Unpin for Terminator
impl UnwindSafe for Terminator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
An iterator over the items within this container, by reference.
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
Check whether an item is contained within this sequence.
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
Convert an item of the sequence into a [
MaybeRef].