Enum Terminator
pub enum Terminator {
Goto(BbName),
Switch {
value: ValueExpr,
cases: Map<Int, BbName>,
fallback: BbName,
},
Unreachable,
Intrinsic {
intrinsic: IntrinsicOp,
arguments: List<ValueExpr>,
ret: PlaceExpr,
next_block: Option<BbName>,
},
Call {
callee: ValueExpr,
calling_convention: CallingConvention,
arguments: List<ArgumentExpr>,
ret: PlaceExpr,
next_block: Option<BbName>,
unwind_block: Option<BbName>,
},
Return,
StartUnwind {
unwind_payload: ValueExpr,
unwind_block: BbName,
},
StopUnwind(BbName),
ResumeUnwind,
}Variants§
Goto(BbName)
Just jump to the next block.
Switch
value needs to evaluate to a Value::Int.
cases map those values to blocks to jump to and therefore have to have the equivalent type.
If no value matches we fall back to the block given in fallback.
Unreachable
If this is ever executed, we have UB.
Intrinsic
Invoke the given intrinsic operation with the given arguments.
Intrinsics are langauge primitives that can have arbitrary side-effects, including divergence.
Fields
intrinsic: IntrinsicOpCall
Call the given function with the given arguments.
Fields
callee: ValueExprWhat function or method to call. This must evaluate to a function pointer and for safe behaviour, the functions signature must match the arguments.
Dynamic dispatch is represented with the callee being the result of VTableMethodLookup(GetMetadata(self)),
and the self argument appropriately cast to a thin pointer type.
calling_convention: CallingConventionThe calling convention to use for this call.
arguments: List<ArgumentExpr>The arguments to pass.
next_block: Option<BbName>The block to jump to when this call returns.
If None, UB will be raised when the function returns.
unwind_block: Option<BbName>The block to jump to when this call unwinds.
If None, UB will be raised when the function unwinds.
This comes with a well-formedness requirement: if the current block is a regular block,
unwind_block must be either a cleanup block or a catch block;
otherwise, unwind_block must be a terminating block.
Return
Return from the current function.
StartUnwind
Starts unwinding, jump to the indicated cleanup block.
Fields
StopUnwind(BbName)
Stops unwinding, jump to the indicated regular block. This also removes the topmost unwinding payload. UB if not currently unwinding.
ResumeUnwind
Ends this function call. The unwinding should continue at the caller’s stack frame.
Trait Implementations§
§impl Clone for Terminator
impl Clone for Terminator
§fn clone(&self) -> Terminator
fn clone(&self) -> Terminator
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for Terminator
§impl Debug for Terminator
impl Debug for Terminator
§impl<'de> Deserialize<'de> for Terminator
impl<'de> Deserialize<'de> for Terminator
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Terminator, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Terminator, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for Terminator
§impl Hash for Terminator
impl Hash for Terminator
§impl Ord for Terminator
impl Ord for Terminator
§fn cmp(&self, other: &Terminator) -> Ordering
fn cmp(&self, other: &Terminator) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
§impl PartialEq for Terminator
impl PartialEq for Terminator
§impl PartialOrd for Terminator
impl PartialOrd for Terminator
§impl Serialize for Terminator
impl Serialize for Terminator
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Terminator
Auto Trait Implementations§
impl !Send for Terminator
impl !Sync for Terminator
impl Freeze for Terminator
impl RefUnwindSafe 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more