Struct miri::helpers::CurrentSpan
source · pub struct CurrentSpan<'a, 'mir, 'tcx> {
current_frame_idx: Option<usize>,
tcx: TyCtxt<'tcx>,
machine: &'a Evaluator<'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>
tcx: TyCtxt<'tcx>
machine: &'a Evaluator<'mir, 'tcx>
Implementations
sourceimpl<'a, 'mir: 'a, 'tcx: 'a + 'mir> CurrentSpan<'a, 'mir, 'tcx>
impl<'a, 'mir: 'a, 'tcx: 'a + 'mir> CurrentSpan<'a, '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_parent(&mut self) -> Span
pub fn get_parent(&mut self) -> Span
Similar to CurrentSpan::get
, but retrieves the parent frame of the first non-local frame.
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 frame_span(machine: &Evaluator<'_, '_>, idx: usize) -> Span
fn current_frame_idx(&mut self) -> usize
fn compute_current_frame_index(
tcx: TyCtxt<'_>,
machine: &Evaluator<'_, '_>
) -> usize
Trait Implementations
sourceimpl<'a, 'mir, 'tcx> Clone for CurrentSpan<'a, 'mir, 'tcx>
impl<'a, 'mir, 'tcx> Clone for CurrentSpan<'a, 'mir, 'tcx>
sourcefn clone(&self) -> CurrentSpan<'a, 'mir, 'tcx>
fn clone(&self) -> CurrentSpan<'a, 'mir, 'tcx>
1.0.0 · sourcefn 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
fn vzip(self) -> V
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: 32 bytes