pub enum Terminator {
Jump {
target: BlockId,
range: SourceRange,
},
Branch {
cond: Expr,
then_blk: BlockId,
else_blk: BlockId,
},
Switch {
value: Expr,
cases: Vec<(CaseRange, BlockId)>,
default: BlockId,
range: SourceRange,
},
Return {
value: Option<Expr>,
range: SourceRange,
},
Unreachable,
InvalidTarget,
}Expand description
How a BasicBlock ends.
Variants§
Jump
Control moves to another block.
Branch
Control moves to one of two blocks depending on a condition.
Fields
Switch
A switch dispatch — also what a computed goto becomes; see Labels
as values.
Fields
§
range: SourceRangeWhere the statement was written.
Return
The function returns.
Unreachable
Control never gets here.
Only reachable through a bug in this module, and emitted as
unreachable!() so that such a bug is loud rather than silent.
InvalidTarget
The default of a computed goto’s dispatch: a value that is no
label’s number, which is undefined behaviour in C.
Emitted as unreachable!() in a build with debug assertions, which
catches the bug, and as unreachable_unchecked() otherwise — what GCC
assumes too, and what lets the match be a bare jump table.
Trait Implementations§
Source§impl Clone for Terminator
impl Clone 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 UnsafeUnpin 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