Frame in rustc_const_eval::interpret - Rust (original) (raw)

pub struct Frame<'tcx, Prov: Provenance = CtfeProvenance, Extra = ()> {
    pub(super) body: &'tcx Body<'tcx>,
    pub(super) instance: Instance<'tcx>,
    pub extra: Extra,
    return_to_block: StackPopCleanup,
    pub return_place: MPlaceTy<'tcx, Prov>,
    pub locals: IndexVec<Local, LocalState<'tcx, Prov>>,
    tracing_span: SpanGuard,
    pub(super) loc: Either<Location, Span>,
}

Expand description

A stack frame.

§body: &'tcx [Body](../../rustc%5Fmiddle/mir/struct.Body.html "struct rustc_middle::mir::Body")<'tcx>

The MIR for the function called on this frame.

The def_id and args of the current function.

Extra data for the machine.

Work to perform when returning from this function.

The location where the result of the current stack frame should be written to, and its layout in the caller.

The list of locals for this stack frame, stored in order as[return_ptr, arguments..., variables..., temporaries...]. The locals are stored as Option<Value>s.None represents a local that is currently dead, while a live local can either directly contain Scalar or refer to some part of an Allocation.

Do not access this directly; always go through the machine hook!

The span of the tracing crate is stored here. When the guard is dropped, the span is exited. This gives us a full stack trace on all tracing statements.

If this is Right, we are not currently executing any particular statement in this frame (can happen e.g. during frame initialization, and during unwinding on frames without cleanup code).

Needs to be public because ConstProp does unspeakable things to it.

Source§

Source

Get the current location within the Frame.

If this is Right, we are not currently executing any particular statement in this frame (can happen e.g. during frame initialization, and during unwinding on frames without cleanup code).

Used by priroda.

Source

Source

Source

Return the SourceInfo of the current instruction.

Source

Source

Source

Returns the address of the buffer where the locals are stored. This is used by Place as a sanity check to detect bugs where we mix up which stack frame a place refers to.

Source

Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.