Struct rustc_const_eval::interpret::eval_context::Frame
source · pub struct Frame<'mir, 'tcx, Prov: Provenance = AllocId, Extra = ()> {
pub body: &'mir Body<'tcx>,
pub instance: Instance<'tcx>,
pub extra: Extra,
pub return_to_block: StackPopCleanup,
pub return_place: PlaceTy<'tcx, Prov>,
pub locals: IndexVec<Local, LocalState<'tcx, Prov>>,
tracing_span: SpanGuard,
pub loc: Either<Location, Span>,
}
Expand description
A stack frame.
Fields§
§body: &'mir Body<'tcx>
The MIR for the function called on this frame.
instance: Instance<'tcx>
The def_id and args of the current function.
extra: Extra
Extra data for the machine.
return_to_block: StackPopCleanup
Work to perform when returning from this function.
return_place: PlaceTy<'tcx, Prov>
The location where the result of the current stack frame should be written to, and its layout in the caller.
locals: IndexVec<Local, LocalState<'tcx, Prov>>
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!
tracing_span: SpanGuard
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.
loc: Either<Location, Span>
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.
Implementations§
source§impl<'mir, 'tcx, Prov: Provenance> Frame<'mir, 'tcx, Prov>
impl<'mir, 'tcx, Prov: Provenance> Frame<'mir, 'tcx, Prov>
pub fn with_extra<Extra>(self, extra: Extra) -> Frame<'mir, 'tcx, Prov, Extra>
source§impl<'mir, 'tcx, Prov: Provenance, Extra> Frame<'mir, 'tcx, Prov, Extra>
impl<'mir, 'tcx, Prov: Provenance, Extra> Frame<'mir, 'tcx, Prov, Extra>
sourcepub fn current_loc(&self) -> Either<Location, Span>
pub fn current_loc(&self) -> Either<Location, Span>
Get the current location within the Frame.
If this is Left
, 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.
sourcepub fn current_source_info(&self) -> Option<&SourceInfo>
pub fn current_source_info(&self) -> Option<&SourceInfo>
Return the SourceInfo
of the current instruction.
pub fn current_span(&self) -> Span
pub fn lint_root(&self) -> Option<HirId>
Auto Trait Implementations§
impl<'mir, 'tcx, Prov = AllocId, Extra = ()> !RefUnwindSafe for Frame<'mir, 'tcx, Prov, Extra>
impl<'mir, 'tcx, Prov = AllocId, Extra = ()> !Send for Frame<'mir, 'tcx, Prov, Extra>
impl<'mir, 'tcx, Prov = AllocId, Extra = ()> !Sync for Frame<'mir, 'tcx, Prov, Extra>
impl<'mir, 'tcx, Prov, Extra> Unpin for Frame<'mir, 'tcx, Prov, Extra>where Extra: Unpin, Prov: Unpin,
impl<'mir, 'tcx, Prov = AllocId, Extra = ()> !UnwindSafe for Frame<'mir, 'tcx, Prov, Extra>
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
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.