[][src]Struct rustc_middle::mir::Body

pub struct Body<'tcx> {
    basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
    pub phase: MirPhase,
    pub source_scopes: IndexVec<SourceScope, SourceScopeData>,
    pub yield_ty: Option<Ty<'tcx>>,
    pub generator_drop: Option<Box<Body<'tcx>>>,
    pub generator_layout: Option<GeneratorLayout<'tcx>>,
    pub generator_kind: Option<GeneratorKind>,
    pub local_decls: IndexVec<Local, LocalDecl<'tcx>>,
    pub user_type_annotations: CanonicalUserTypeAnnotations<'tcx>,
    pub arg_count: usize,
    pub spread_arg: Option<Local>,
    pub var_debug_info: Vec<VarDebugInfo<'tcx>>,
    pub span: Span,
    pub required_consts: Vec<Constant<'tcx>>,
    pub ignore_interior_mut_in_const_validation: bool,
    predecessor_cache: PredecessorCache,
}
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

The lowered representation of a single function.

Fields

basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

A list of basic blocks. References to basic block use a newtyped index type BasicBlock that indexes into this vector.

phase: MirPhase
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Records how far through the "desugaring and optimization" process this particular MIR has traversed. This is particularly useful when inlining, since in that context we instantiate the promoted constants and add them to our promoted vector -- but those promoted items have already been optimized, whereas ours have not. This field allows us to see the difference and forego optimization on the inlined promoted items.

source_scopes: IndexVec<SourceScope, SourceScopeData>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

A list of source scopes; these are referenced by statements and used for debuginfo. Indexed by a SourceScope.

yield_ty: Option<Ty<'tcx>>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

The yield type of the function, if it is a generator.

generator_drop: Option<Box<Body<'tcx>>>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Generator drop glue.

generator_layout: Option<GeneratorLayout<'tcx>>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

The layout of a generator. Produced by the state transformation.

generator_kind: Option<GeneratorKind>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

If this is a generator then record the type of source expression that caused this generator to be created.

local_decls: IndexVec<Local, LocalDecl<'tcx>>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Declarations of locals.

The first local is the return value pointer, followed by arg_count locals for the function arguments, followed by any user-declared variables and temporaries.

user_type_annotations: CanonicalUserTypeAnnotations<'tcx>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

User type annotations.

arg_count: usize
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

The number of arguments this function takes.

Starting at local 1, arg_count locals will be provided by the caller and can be assumed to be initialized.

If this MIR was built for a constant, this will be 0.

spread_arg: Option<Local>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Mark an argument local (which must be a tuple) as getting passed as its individual components at the LLVM level.

This is used for the "rust-call" ABI.

var_debug_info: Vec<VarDebugInfo<'tcx>>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Debug information pertaining to user variables, including captures.

span: Span
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

A span representing this MIR, for error reporting.

required_consts: Vec<Constant<'tcx>>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Constants that are required to evaluate successfully for this MIR to be well-formed. We hold in this field all the constants we are not able to evaluate yet.

ignore_interior_mut_in_const_validation: bool
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

The user may be writing e.g. &[(SOME_CELL, 42)][i].1 and this would get promoted, because we'd statically know that no thing with interior mutability will ever be available to the user without some serious unsafe code. Now this means that our promoted is actually &[(SOME_CELL, 42)] and the MIR using it will do the &promoted[i].1 projection because the index may be a runtime value. Such a promoted value is illegal because it has reachable interior mutability. This flag just makes this situation very obvious where the previous implementation without the flag hid this situation silently. FIXME(oli-obk): rewrite the promoted during promotion to eliminate the cell components.

predecessor_cache: PredecessorCache
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Implementations

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

pub fn new(
    basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
    source_scopes: IndexVec<SourceScope, SourceScopeData>,
    local_decls: IndexVec<Local, LocalDecl<'tcx>>,
    user_type_annotations: CanonicalUserTypeAnnotations<'tcx>,
    arg_count: usize,
    var_debug_info: Vec<VarDebugInfo<'tcx>>,
    span: Span,
    generator_kind: Option<GeneratorKind>
) -> Self
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn new_cfg_only(
    basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>
) -> Self
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns a partially initialized MIR body containing only a list of basic blocks.

The returned MIR contains no LocalDecls (even for the return place) or source scopes. It is only useful for testing but cannot be #[cfg(test)] because it is used in a different crate.

pub fn basic_blocks(&self) -> &IndexVec<BasicBlock, BasicBlockData<'tcx>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn basic_blocks_mut(
    &mut self
) -> &mut IndexVec<BasicBlock, BasicBlockData<'tcx>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn basic_blocks_and_local_decls_mut(
    &mut self
) -> (&mut IndexVec<BasicBlock, BasicBlockData<'tcx>>, &mut IndexVec<Local, LocalDecl<'tcx>>)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn is_cfg_cyclic(&self) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns true if a cycle exists in the control-flow graph that is reachable from the START_BLOCK.

pub fn local_kind(&self, local: Local) -> LocalKind[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn temps_iter<'a>(&'a self) -> impl Iterator<Item = Local> + 'a[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns an iterator over all temporaries.

pub fn vars_iter<'a>(&'a self) -> impl Iterator<Item = Local> + 'a[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns an iterator over all user-declared locals.

pub fn mut_vars_iter<'a>(&'a self) -> impl Iterator<Item = Local> + 'a[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns an iterator over all user-declared mutable locals.

pub fn mut_vars_and_args_iter<'a>(&'a self) -> impl Iterator<Item = Local> + 'a[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns an iterator over all user-declared mutable arguments and locals.

pub fn args_iter(&self) -> impl Iterator<Item = Local> + ExactSizeIterator[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns an iterator over all function arguments.

pub fn vars_and_temps_iter(
    &self
) -> impl Iterator<Item = Local> + ExactSizeIterator
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns an iterator over all user-defined variables and compiler-generated temporaries (all locals that are neither arguments nor the return place).

pub fn make_statement_nop(&mut self, location: Location)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Changes a statement to a nop. This is both faster than deleting instructions and avoids invalidating statement indices in Locations.

pub fn source_info(&self, location: Location) -> &SourceInfo[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns the source info associated with location.

pub fn is_sub_scope(&self, sub: SourceScope, sup: SourceScope) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Checks if sub is a sub scope of sup

pub fn return_ty(&self) -> Ty<'tcx>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns the return type; it always return first element from local_decls array.

pub fn terminator_loc(&self, bb: BasicBlock) -> Location[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Gets the location of the terminator for the given block.

pub fn predecessors(
    &self
) -> impl Deref<Target = IndexVec<BasicBlock, SmallVec<[BasicBlock; 4]>>> + '_
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn dominators(&self) -> Dominators<BasicBlock>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Trait Implementations

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

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

impl<'tcx> Decodable for Body<'tcx>[src]

impl<'tcx> DirectedGraph for Body<'tcx>[src]

type Node = BasicBlock

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

impl<'tcx> Encodable for Body<'tcx>[src]

impl<'graph, 'tcx> GraphPredecessors<'graph> for Body<'tcx>[src]

type Item = BasicBlock

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

type Iter = IntoIter<[BasicBlock; 4]>

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

impl<'a, 'b> GraphSuccessors<'b> for Body<'a>[src]

type Item = BasicBlock

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

type Iter = Cloned<Successors<'b>>

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

impl<'tcx> HasLocalDecls<'tcx> for Body<'tcx>[src]

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

impl<'tcx> Index<BasicBlock> for Body<'tcx>[src]

type Output = BasicBlockData<'tcx>

The returned type after indexing.

impl<'tcx> IndexMut<BasicBlock> for Body<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for Body<'tcx>[src]

impl<'tcx> WithNumNodes for Body<'tcx>[src]

impl<'tcx> WithPredecessors for Body<'tcx>[src]

impl<'tcx> WithStartNode for Body<'tcx>[src]

impl<'tcx> WithSuccessors for Body<'tcx>[src]

Auto Trait Implementations

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

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

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

impl<'tcx> Unpin for Body<'tcx>

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

Blanket Implementations

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

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

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

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

impl<T> Cast for T

impl<T> ControlFlowGraph for T where
    T: DirectedGraph + WithStartNode + WithPredecessors + WithSuccessors + WithNumNodes
[src]

impl<T> Decodable for T where
    T: UseSpecializedDecodable
[src]

impl<Ctxt, T> DepNodeParams<Ctxt> for T where
    Ctxt: DepContext,
    T: HashStable<<Ctxt as DepContext>::StableHashingContext> + Debug
[src]

impl<T> Encodable for T where
    T: UseSpecializedEncodable + ?Sized
[src]

impl<T> Erased for T[src]

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

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

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

type Error = !

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

impl<T> Same<T> for T

type Output = T

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Should always be Self

impl<E> SpecializationError for E[src]

impl<'tcx, T> Subst<'tcx> for T where
    T: TypeFoldable<'tcx>, 
[src]

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

type Owned = T

The resulting type after obtaining ownership.

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.

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.

impl<T> WithConstness for T[src]