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

Get the current span, skipping non-local frames. This function is backed by a cache, and can be assumed to be very fast.

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.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

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