TerminatorKind in rustc_middle::mir - Rust
Description: The various kinds of terminators, representing ways of exiting from a basic block.

Skip to main content

## TerminatorKind

# Enum TerminatorKind

Source

    pub enum TerminatorKind<'tcx> {
    Show 15 variants    Goto {
            target: BasicBlock,
        },
        SwitchInt {
            discr: Operand<'tcx>,
            targets: SwitchTargets,
        },
        UnwindResume,
        UnwindTerminate(UnwindTerminateReason),
        Return,
        Unreachable,
        Drop {
            place: Place<'tcx>,
            target: BasicBlock,
            unwind: UnwindAction,
            replace: bool,
            drop: Option<BasicBlock>,
            async_fut: Option<Local>,
        },
        Call {
            func: Operand<'tcx>,
            args: Box<[Spanned<Operand<'tcx>>]>,
            destination: Place<'tcx>,
            target: Option<BasicBlock>,
            unwind: UnwindAction,
            call_source: CallSource,
            fn_span: Span,
        },
        TailCall {
            func: Operand<'tcx>,
            args: Box<[Spanned<Operand<'tcx>>]>,
            fn_span: Span,
        },
        Assert {
            cond: Operand<'tcx>,
            expected: bool,
            msg: Box<AssertMessage<'tcx>>,
            target: BasicBlock,
            unwind: UnwindAction,
        },
        Yield {
            value: Operand<'tcx>,
            resume: BasicBlock,
            resume_arg: Place<'tcx>,
            drop: Option<BasicBlock>,
        },
        CoroutineDrop,
        FalseEdge {
            real_target: BasicBlock,
            imaginary_target: BasicBlock,
        },
        FalseUnwind {
            real_target: BasicBlock,
            unwind: UnwindAction,
        },
        InlineAsm {
            asm_macro: InlineAsmMacro,
            template: &'tcx [InlineAsmTemplatePiece],
            operands: Box<[InlineAsmOperand<'tcx>]>,
            options: InlineAsmOptions,
            line_spans: &'tcx [Span],
            targets: Box<[BasicBlock]>,
            unwind: UnwindAction,
        },
    }

Expand description

The various kinds of terminators, representing ways of exiting from a basic block.

A note on unwinding: Panics may occur during the execution of some terminators. Depending on the `-C panic` flag, this may either cause the program to abort or the call stack to unwind. Such terminators have a `unwind: UnwindAction` field on them. If stack unwinding occurs, then once the current function is reached, an action will be taken based on the `unwind` field. If the action is `Cleanup`, then the execution continues at the given basic block. If the action is `Continue` then no cleanup is performed, and the stack continues unwinding.

The basic block pointed to by a `Cleanup` unwind action must have its `cleanup` flag set. `cleanup` basic blocks have a couple restrictions:

1. All `unwind` fields in them must be `UnwindAction::Terminate` or `UnwindAction::Unreachable`.

2. `Return` terminators are not allowed in them. `Terminate` and `Resume` terminators are.

3. All other basic blocks (in the current body) that are reachable from `cleanup` basic blocks must also be `cleanup`. This is a part of the type system and checked statically, so it is still an error to have such an edge in the CFG even if it’s known that it won’t be taken at runtime.

4. The control flow between cleanup blocks must look like an upside down tree. Roughly speaking, this means that control flow that looks like a V is allowed, while control flow that looks like a W is not. This is necessary to ensure that landing pad information can be correctly codegened on MSVC. More precisely:

   Begin with the standard control flow graph `G`. Modify `G` as follows: for any two cleanup vertices `u` and `v` such that `u` dominates `v`, contract `u` and `v` into a single vertex, deleting self edges and duplicate edges in the process. Now remove all vertices from `G` that are not cleanup vertices or are not reachable. The resulting graph must be an inverted tree, that is each vertex may have at most one successor and there may be no cycles.

## Variants§

§

### Goto

Block has one successor; we continue execution there.

#### Fields

§`target: BasicBlock`
§

### SwitchInt

Switches based on the computed value.

First, evaluates the `discr` operand. The type of the operand must be a signed or unsigned integer, char, or bool, and must match the given type. Then, if the list of switch targets contains the computed value, continues execution at the associated basic block. Otherwise, continues execution at the “otherwise” basic block.

Target values may not appear more than once.

#### Fields

§`discr: Operand<'tcx>`

The discriminant value being tested.

§`targets: SwitchTargets`
§

### UnwindResume

Indicates that the landing pad is finished and that the process should continue unwinding.

Like a return, this marks the end of this invocation of the function.

Only permitted in cleanup blocks. `Resume` is not permitted with `-C unwind=abort` after deaggregation runs.

§

### UnwindTerminate(UnwindTerminateReason)

Indicates that the landing pad is finished and that the process should terminate.

Used to prevent unwinding for foreign items or with `-C unwind=abort`. Only permitted in cleanup blocks.

§

### Return

Returns from the function.

Like function calls, the exact semantics of returns in Rust are unclear. Returning very likely at least assigns the value currently in the return place (`_0`) to the place specified in the associated `Call` terminator in the calling function, as if assigned via `dest = move _0`. It might additionally do other things, like have side-effects in the aliasing model.

If the body is a coroutine body, this has slightly different semantics; it instead causes a `CoroutineState::Returned(_0)` to be created (as if by an `Aggregate` rvalue) and assigned to the return place.

§

### Unreachable

Indicates a terminator that can never be reached.

Executing this terminator is UB.

§

### Drop

The behavior of this statement differs significantly before and after drop elaboration.

After drop elaboration: `Drop` terminators are a complete nop for types that have no drop glue. For other types, `Drop` terminators behave exactly like a call to `core::mem::drop_glue` with a reference to the given place.

`Drop` before drop elaboration is a conditional execution of the drop glue. Specifically, the `Drop` will be executed if…

Needs clarification: End of that sentence. This in effect should document the exact behavior of drop elaboration. The following sounds vaguely right, but I’m not quite sure:

> The drop glue is executed if, among all statements executed within this `Body`, an assignment to the place or one of its “parents” occurred more recently than a move out of it. This does not consider indirect assignments.

The `replace` flag indicates whether this terminator was created as part of an assignment. This should only be used for diagnostic purposes, and does not have any operational meaning.

Async drop processing: In compiler/rustc_mir_build/src/build/scope.rs we detect possible async drop: drop of object with `needs_async_drop`. Async drop later, in StateTransform pass, may be expanded into additional yield-point for poll-loop of async drop future. So we need prepared ‘drop’ target block in the similar way as for `Yield` terminator (see `drops.build_mir::<CoroutineDrop>` in scopes.rs). In compiler/rustc_mir_transform/src/elaborate_drops.rs for object implementing `AsyncDrop` trait we need to prepare async drop feature - resolve `AsyncDrop::drop` and codegen call. `async_fut` is set to the corresponding local. For coroutine drop we don’t need this logic because coroutine drop works with the same layout object as coroutine itself. So `async_fut` will be `None` for coroutine drop. Both `drop` and `async_fut` fields are only used in compiler/rustc_mir_transform/src/coroutine.rs, StateTransform pass. In `expand_async_drops` async drops are expanded into one or two yield points with poll ready/pending switch. When a coroutine has any internal async drop, the coroutine drop function will be async (generated by `create_coroutine_drop_shim_async`, not `create_coroutine_drop_shim`).

#### Fields

§`place: Place<'tcx>`
§`target: BasicBlock`
§`unwind: UnwindAction`
§`replace: bool`
§`drop: Option<BasicBlock>`

Cleanup to be done if the coroutine is dropped at this suspend point (for async drop).

§`async_fut: Option<Local>`

Prepared async future local (for async drop)

§

### Call

Roughly speaking, evaluates the `func` operand and the arguments, and starts execution of the referred to function. The operand types must match the argument types of the function. The return place type must match the return type. The type of the `func` operand must be callable, meaning either a function pointer, a function type, or a closure type.

Needs clarification: The exact semantics of this. Current backends rely on `move` operands not aliasing the return place. It is unclear how this is justified in MIR, see #71117.

#### Fields

§`func: Operand<'tcx>`

The function that’s being called.

§`args: Box<[Spanned<Operand<'tcx>>]>`

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. The span for each arg is also included (e.g. `a` and `b` in `x.foo(a, b)`).

§`destination: Place<'tcx>`

Where the returned value will be written

§`target: Option<BasicBlock>`

Where to go after this call returns. If none, the call necessarily diverges.

§`unwind: UnwindAction`

Action to be taken if the call unwinds.

§`call_source: CallSource`

Where this call came from in HIR/THIR.

§`fn_span: Span`

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

§

### TailCall

Tail call.

Roughly speaking this is a chimera of `Call` and `Return`, with some caveats. Semantically tail calls consists of two actions:

- pop of the current stack frame
- a call to the `func`, with the return address of the current caller
  - so that a `return` inside `func` returns to the caller of the caller of the function that is currently being executed

Note that in difference with `Call` this is missing

- `destination` (because it’s always the return place)
- `target` (because it’s always taken from the current stack frame)
- `unwind` (because it’s always taken from the current stack frame)

#### Fields

§`func: Operand<'tcx>`

The function that’s being called.

§`args: Box<[Spanned<Operand<'tcx>>]>`

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.

§`fn_span: Span`

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

§

### Assert

Evaluates the operand, which must have type `bool`. If it is not equal to `expected`, initiates a panic. Initiating a panic corresponds to a `Call` terminator with some unspecified constant as the function to call, all the operands stored in the `AssertMessage` as parameters, and `None` for the destination. Keep in mind that the `cleanup` path is not necessarily executed even in the case of a panic, for example in `-C panic=abort`. If the assertion does not fail, execution continues at the specified basic block.

When overflow checking is disabled and this is run-time MIR (as opposed to compile-time MIR that is used for CTFE), the following variants of this terminator behave as `goto target`:

- `OverflowNeg(..)`,
- `Overflow(op, ..)` if op is add, sub, mul, shl, shr, but NOT div or rem.

#### Fields

§`cond: Operand<'tcx>`
§`expected: bool`
§`msg: Box<AssertMessage<'tcx>>`
§`target: BasicBlock`
§`unwind: UnwindAction`
§

### Yield

Marks a suspend point.

Like `Return` terminators in coroutine bodies, this computes `value` and then a `CoroutineState::Yielded(value)` as if by `Aggregate` rvalue. That value is then assigned to the return place of the function calling this one, and execution continues in the calling function. When next invoked with the same first argument, execution of this function continues at the `resume` basic block, with the second argument written to the `resume_arg` place. If the coroutine is dropped before then, the `drop` basic block is invoked.

Note that coroutines can be (unstably) cloned under certain conditions, which means that this terminator can return multiple times! MIR optimizations that reorder code into different basic blocks needs to be aware of that. See https://github.com/rust-lang/rust/issues/95360.

Not permitted in bodies that are not coroutine bodies, or after coroutine lowering.

Needs clarification: What about the evaluation order of the `resume_arg` and `value`?

#### Fields

§`value: Operand<'tcx>`

The value to return.

§`resume: BasicBlock`

Where to resume to.

§`resume_arg: Place<'tcx>`

The place to store the resume argument in.

§`drop: Option<BasicBlock>`

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

§

### CoroutineDrop

Indicates the end of dropping a coroutine.

Semantically just a `return` (from the coroutines drop glue). Only permitted in the same situations as `yield`.

Needs clarification: Is that even correct? The coroutine drop code is always confusing to me, because it’s not even really in the current body.

Needs clarification: Are there type system constraints on these terminators? Should there be a “block type” like `cleanup` blocks for them?

§

### FalseEdge

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

At runtime this is semantically just a goto.

Disallowed after drop elaboration.

#### Fields

§`real_target: BasicBlock`

The target normal control flow will take.

§`imaginary_target: BasicBlock`

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

§

### FalseUnwind

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.

At runtime this is semantically just a goto.

Disallowed after drop elaboration.

#### Fields

§`real_target: BasicBlock`

The target normal control flow will take.

§`unwind: UnwindAction`

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.

§

### InlineAsm

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

#### Fields

§`asm_macro: InlineAsmMacro`

Macro used to create this inline asm: one of `asm!` or `naked_asm!`

§`template: &'tcx [InlineAsmTemplatePiece]`

The template for the inline assembly, with placeholders.

§`operands: Box<[InlineAsmOperand<'tcx>]>`

The operands for the inline assembly, as `Operand`s or `Place`s.

§`options: InlineAsmOptions`

Miscellaneous options for the inline assembly.

§`line_spans: &'tcx [Span]`

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.

§`targets: Box<[BasicBlock]>`

Valid targets for the inline assembly. The first element is the fallthrough destination, unless asm_macro == InlineAsmMacro::NakedAsm or InlineAsmOptions::NORETURN is set.

§`unwind: UnwindAction`

Action to be taken if the inline assembly unwinds. This is present if and only if InlineAsmOptions::MAY_UNWIND is set.

## Implementations§

Source§

### impl<'tcx> TerminatorKind<'tcx>

Source

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

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.

Source

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

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

Source§

### impl<'tcx> TerminatorKind<'tcx>

Source

#### pub fn successors(&self) -> Successors<'_>

Source

#### pub fn successors_mut<'a>(&'a mut self, f: impl FnMut(&'a mut BasicBlock))

Source§

### impl<'tcx> TerminatorKind<'tcx>

Source

#### pub const fn name(&self) -> &'static str

Returns a simple string representation of a `TerminatorKind` variant, independent of any values it might hold (e.g. `TerminatorKind::Call` always returns `"Call"`).

Source

#### pub fn if_( cond: Operand<'tcx>, t: BasicBlock, f: BasicBlock, ) -> TerminatorKind<'tcx>

Source§

### impl<'tcx> TerminatorKind<'tcx>

Source

#### pub fn unwind(&self) -> Option<&UnwindAction>

Source

#### pub fn unwind_mut(&mut self) -> Option<&mut UnwindAction>

Source

#### pub fn as_switch(&self) -> Option<(&Operand<'tcx>, &SwitchTargets)>

Source

#### pub fn as_goto(&self) -> Option<BasicBlock>

Source§

### impl<'tcx> TerminatorKind<'tcx>

Source

#### pub fn edges(&self) -> TerminatorEdges<'_, 'tcx>

## Trait Implementations§

Source§

### impl<'tcx> Clone for TerminatorKind<'tcx>

Source§

#### fn clone(&self) -> TerminatorKind<'tcx>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

#### fn clone_from(&mut self, source: &Self)

Performs copy-assignment from `source`. Read more
Source§

### impl<'tcx> Debug for TerminatorKind<'tcx>

Source§

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

Formats the value using the given formatter. Read more
Source§

### impl<'tcx, __D: TyDecoder<'tcx>> Decodable<__D> for TerminatorKind<'tcx>

Source§

#### fn decode(__decoder: &mut __D) -> Self

Source§

### impl<'tcx, __E: TyEncoder<'tcx>> Encodable<__E> for TerminatorKind<'tcx>

Source§

#### fn encode(&self, __encoder: &mut __E)

Source§

### impl<'tcx> Hash for TerminatorKind<'tcx>

Source§

#### fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given `Hasher`. Read more
1.3.0 · Source§

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

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

### impl<'tcx> PartialEq for TerminatorKind<'tcx>

Source§

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

Tests for `self` and `other` values to be equal, and is used by `==`.
1.0.0 (const: unstable) · Source§

#### fn ne(&self, other: &Rhs) -> bool

Tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

### impl<'tcx> StableHash for TerminatorKind<'tcx>

Source§

#### fn stable_hash<__Hcx: StableHashCtxt>( &self, __hcx: &mut __Hcx, __hasher: &mut StableHasher, )

Source§

### impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for TerminatorKind<'tcx>

Source§

#### fn try_fold_with<__F: FallibleTypeFolder<TyCtxt<'tcx>>>( self, __folder: &mut __F, ) -> Result<Self, __F::Error>

The entry point for folding. To fold a value `t` with a folder `f` call: `t.try_fold_with(f)`. Read more
Source§

#### fn fold_with<__F: TypeFolder<TyCtxt<'tcx>>>(self, __folder: &mut __F) -> Self

The entry point for folding. To fold a value `t` with a folder `f` call: `t.fold_with(f)`. Read more
Source§

### impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for TerminatorKind<'tcx>

Source§

#### fn visit_with<__V: TypeVisitor<TyCtxt<'tcx>>>( &self, __visitor: &mut __V, ) -> __V::Result

The entry point for visiting. To visit a value `t` with a visitor `v` call: `t.visit_with(v)`. Read more
Source§

### impl<'tcx> StructuralPartialEq for TerminatorKind<'tcx>

## Auto Trait Implementations§

§

### impl<'tcx> DynSend for TerminatorKind<'tcx>

§

### impl<'tcx> DynSync for TerminatorKind<'tcx>

§

### impl<'tcx> Freeze for TerminatorKind<'tcx>

§

### 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> UnsafeUnpin for TerminatorKind<'tcx>

§

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

## Blanket Implementations§

Source§

### impl<T> Aligned for T

Source§

#### const ALIGN: Alignment

Alignment of `Self`.
Source§

### impl<T> Any for T
where T: 'static + ?Sized,

Source§

#### fn type_id(&self) -> TypeId

Gets the `TypeId` of `self`. Read more
Source§

### impl<T> AnyEq for T
where T: Any + PartialEq,

Source§

#### fn equals(&self, other: &(dyn Any + 'static)) -> bool

Source§

#### fn as_any(&self) -> &(dyn Any + 'static)

Source§

### impl<T> Borrow<T> for T
where T: ?Sized,

Source§

#### fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

### impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

#### fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

### impl<T> CloneToUninit for T
where T: Clone,

Source§

#### unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (`clone_to_uninit`)
Performs copy-assignment from `self` to `dest`. Read more
Source§

### impl<T, R> CollectAndApply<T, R> for T

Source§

#### fn collect_and_apply<I, F>(iter: I, f: F) -> R
where I: Iterator<Item = T>, F: FnOnce(&[T]) -> R,

Equivalent to `f(&iter.collect::<Vec<_>>())`.

Source§

#### type Output = R

Source§

### impl<'tcx, T> DepNodeKey<'tcx> for T
where T: StableHash + Debug,

Source§

#### default fn key_fingerprint_style() -> KeyFingerprintStyle

Source§

#### default fn to_fingerprint(&self, tcx: TyCtxt<'tcx>) -> Fingerprint

This method turns a query key into an opaque `Fingerprint` to be used in `DepNode`.
Source§

#### default fn try_recover_key(_: TyCtxt<'tcx>, _: &DepNode) -> Option<T>

This method tries to recover the query key from the given `DepNode`, something which is needed when forcing `DepNode`s during red-green evaluation. The query system will only call this method if `fingerprint_style()` is not `FingerprintStyle::Opaque`. It is always valid to return `None` here, in which case incremental compilation will treat the query as having changed instead of forcing it.
Source§

### impl<T> DynClone for T
where T: Clone,

Source§

#### fn __clone_box(&self, _: Private) -> *mut ()

Source§

### impl<T> From<T> for T

Source§

#### fn from(t: T) -> T

Returns the argument unchanged.

Source§

### impl<T> Instrument for T

Source§

#### fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided `Span`, returning an `Instrumented` wrapper. Read more
Source§

#### fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current `Span`, returning an `Instrumented` wrapper. Read more
Source§

### impl<T, U> Into<U> for T
where U: From<T>,

Source§

#### fn into(self) -> U

Calls `U::from(self)`.

That is, this conversion is whatever the implementation of `From<T> for U` chooses to do.

Source§

### impl<T> IntoEither for T

Source§

#### fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts `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 more
Source§

#### fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts `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
Source§

### impl<K> IntoQueryKey<K> for K

Source§

#### fn into_query_key(self) -> K

Argument conversion from `Self` to `K`. This should always be a very cheap conversion, e.g. `LocalDefId::to_def_id`.
Source§

### impl<'tcx, T> IsSuggestable<'tcx> for T
where T: TypeVisitable<TyCtxt<'tcx>> + TypeFoldable<TyCtxt<'tcx>>,

Source§

#### fn is_suggestable(self, tcx: TyCtxt<'tcx>, infer_suggestable: bool) -> bool

Whether this makes sense to suggest in a diagnostic. Read more
Source§

#### fn make_suggestable( self, tcx: TyCtxt<'tcx>, infer_suggestable: bool, placeholder: Option<Ty<'tcx>>, ) -> Option<T>

Source§

### impl<T> MaybeResult<T> for T

Source§

#### type Error = !

Source§

#### fn from(_: Result<T, <T as MaybeResult<T>>::Error>) -> T

Source§

#### fn to_result(self) -> Result<T, <T as MaybeResult<T>>::Error>

Source§

### impl<T> Pointable for T

Source§

#### const ALIGN: usize

The alignment of pointer.
Source§

#### type Init = T

The type for initializers.
Source§

#### unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

#### unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

#### unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

#### unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

### impl<T> Same for T

Source§

#### type Output = T

Should always be `Self`
Source§

### impl<T> ToOwned for T
where T: Clone,

Source§

#### type Owned = T

The resulting type after obtaining ownership.
Source§

#### fn to_owned(&self) -> T

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

#### fn clone_into(&self, target: &mut T)

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

### impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

#### type Error = Infallible

The type returned in the event of a conversion error.
Source§

#### fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

### impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

#### type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

#### fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

### impl<I, T> TypeVisitableExt<I> for T
where I: Interner, T: TypeVisitable<I>,

Source§

#### fn has_type_flags(&self, flags: TypeFlags) -> bool

Source§

#### fn has_vars_bound_at_or_above(&self, binder: DebruijnIndex) -> bool

Returns `true` if `self` has any late-bound regions that are either bound by `binder` or bound by some binder outside of `binder`. If `binder` is `ty::INNERMOST`, this indicates whether there are any late-bound regions that appear free.
Source§

#### fn error_reported(&self) -> Result<(), <I as Interner>::ErrorGuaranteed>

Source§

#### fn non_region_error_reported( &self, ) -> Result<(), <I as Interner>::ErrorGuaranteed>

Source§

#### fn has_vars_bound_above(&self, binder: DebruijnIndex) -> bool

Returns `true` if this type has any regions that escape `binder` (and hence are not bound by it).
Source§

#### fn has_escaping_bound_vars(&self) -> bool

Returns `true` if this type has regions that are not a part of the type. For example, given a `for<'a> fn(&'a i32)` this function returns `false`, while given a `fn(&'a i32)` it returns `true`. The latter can occur when traversing through the former. Read more
Source§

#### fn has_aliases(&self) -> bool

Source§

#### fn has_opaque_types(&self) -> bool

Source§

#### fn has_coroutines(&self) -> bool

Source§

#### fn references_error(&self) -> bool

Source§

#### fn has_non_region_param(&self) -> bool

Source§

#### fn has_regions(&self) -> bool

Source§

#### fn has_infer_regions(&self) -> bool

Source§

#### fn has_infer_types(&self) -> bool

Source§

#### fn has_non_region_infer(&self) -> bool

Source§

#### fn has_infer(&self) -> bool

Source§

#### fn has_placeholders(&self) -> bool

Source§

#### fn has_non_region_placeholders(&self) -> bool

Source§

#### fn has_param(&self) -> bool

Source§

#### fn has_free_regions(&self) -> bool

“Free” regions in this context means that it has any region that is not (a) erased or (b) late-bound.
Source§

#### fn has_erased_regions(&self) -> bool

Source§

#### fn has_erasable_regions(&self) -> bool

True if there are any un-erased free regions.
Source§

#### fn is_global(&self) -> bool

Indicates whether this value references only ‘global’ generic parameters that are the same regardless of what fn we are in. This is used for caching.
Source§

#### fn has_bound_regions(&self) -> bool

True if there are any late-bound regions
Source§

#### fn has_non_region_bound_vars(&self) -> bool

True if there are any late-bound non-region variables
Source§

#### fn has_bound_vars(&self) -> bool

True if there are any bound variables
Source§

#### fn still_further_specializable(&self) -> bool

Indicates whether this value still has parameters/placeholders/inference variables which could be replaced later, in a way that would change the results of `impl` specialization.
Source§

#### fn has_non_region_error(&self) -> bool

True if a type or const error is reachable
Source§

### impl<I, T, U> Upcast<I, U> for T
where U: UpcastFrom<I, T>,

Source§

#### fn upcast(self, interner: I) -> U

Source§

### impl<I, T> UpcastFrom<I, T> for T

Source§

#### fn upcast_from(from: T, _tcx: I) -> T

Source§

### impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

#### fn vzip(self) -> V

Source§

### impl<T> WithSubscriber for T

Source§

#### fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided `Subscriber` to this type, returning a `WithDispatch` wrapper. Read more
Source§

#### fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default `Subscriber` to this type, returning a `WithDispatch` wrapper. Read more
Source§

### impl<T> ErasedDestructor for T
where T: 'static,

## 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: 80 bytes

Size for each variant:

- `Goto`: 7 bytes
- `SwitchInt`: 79 bytes
- `UnwindResume`: 0 bytes
- `UnwindTerminate`: 1 byte
- `Return`: 0 bytes
- `Unreachable`: 0 bytes
- `Drop`: 39 bytes
- `Call`: 79 bytes
- `TailCall`: 55 bytes
- `Assert`: 47 bytes
- `Yield`: 55 bytes
- `CoroutineDrop`: 0 bytes
- `FalseEdge`: 11 bytes
- `FalseUnwind`: 15 bytes
- `InlineAsm`: 79 bytes