Struct miri::CurrentSpan
source · pub struct CurrentSpan<'a, 'mir, 'tcx> {
current_frame_idx: Option<usize>,
machine: &'a MiriMachine<'mir, 'tcx>,
}Expand description
A CurrentSpan should be created infrequently (ideally once) per interpreter step. It does
nothing on creation, but when CurrentSpan::get is called, searches the current stack for the
topmost frame which corresponds to a local crate, and returns the current span in that frame.
The result of that search is cached so that later calls are approximately free.
Fields§
§current_frame_idx: Option<usize>§machine: &'a MiriMachine<'mir, 'tcx>Implementations§
source§impl<'a, 'mir: 'a, 'tcx: 'a + 'mir> CurrentSpan<'a, 'mir, 'tcx>
impl<'a, 'mir: 'a, 'tcx: 'a + 'mir> CurrentSpan<'a, 'mir, 'tcx>
pub fn machine(&self) -> &'a MiriMachine<'mir, 'tcx>
sourcepub fn get(&mut self) -> Span
pub fn get(&mut self) -> Span
Get the current span, skipping non-local frames. This function is backed by a cache, and can be assumed to be very fast.
sourcepub fn get_caller(&mut self) -> Span
pub fn get_caller(&mut self) -> Span
Returns the span of the caller of the current operation, again walking down the stack to find the closest frame in a local crate, if the caller of the current operation is not in a local crate. This is useful when we are processing something which occurs on function-entry and we want to point at the call to the function, not the function definition generally.
fn stack(&self) -> &[Frame<'mir, 'tcx, Provenance, FrameData<'tcx>>]
fn current_frame_idx(&mut self) -> usize
fn compute_current_frame_index(machine: &MiriMachine<'_, '_>) -> usize
Trait Implementations§
source§impl<'a, 'mir, 'tcx> Clone for CurrentSpan<'a, 'mir, 'tcx>
impl<'a, 'mir, 'tcx> Clone for CurrentSpan<'a, 'mir, 'tcx>
source§fn clone(&self) -> CurrentSpan<'a, 'mir, 'tcx>
fn clone(&self) -> CurrentSpan<'a, 'mir, 'tcx>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<'a, 'mir, 'tcx> !RefUnwindSafe for CurrentSpan<'a, 'mir, 'tcx>
impl<'a, 'mir, 'tcx> !Send for CurrentSpan<'a, 'mir, 'tcx>
impl<'a, 'mir, 'tcx> !Sync for CurrentSpan<'a, 'mir, 'tcx>
impl<'a, 'mir, 'tcx> Unpin for CurrentSpan<'a, 'mir, 'tcx>where
'mir: 'a,
'tcx: 'a,
impl<'a, 'mir, 'tcx> !UnwindSafe for CurrentSpan<'a, 'mir, 'tcx>
Blanket Implementations§
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: 24 bytes