Skip to main content

Call

Struct Call 

Source
pub struct Call { /* private fields */ }
Expand description

One live call, as a debugger sees it.

Implementations§

Source§

impl Call

Source

pub fn function(&self) -> &str

module.name of the function running here.

The body that was written, which for a frame lower::inline expanded is the leaf and not the function that holds its instructions. Call::within is that other answer.

Source

pub fn within(&self) -> &str

module.name of the function whose code Call::pc is a counter of.

The same as Call::function for a frame the machine pushed, and the caller for one that is an expanded body: the expansion wrote the leaf’s instructions into the caller and there is no other numbering for them.

A reader showing a disassembly needs both, and showing one under the other’s name is the mistake this exists to stop — a pane titled playground.twice holding playground.main’s four instructions, which is what a table keyed on Call::function alone produced.

Source

pub fn pc(&self) -> Pc

Where in it this call is: the instruction about to run for the innermost call, and the one to return to for every other.

A counter of Call::within, not of Call::function.

Source

pub fn span(&self) -> Span

Where that instruction was written.

Source

pub fn locals(&self) -> &[Local]

The names the source bound that are in scope at this pc, in declaration order.

One name may appear twice. Shadowing is recorded rather than resolved — see cove_ir::Local — so let x = 1; let x = x + 41 is two live bindings of two words, and both are here. Call::local is what chooses between them.

Source

pub fn words(&self) -> &[Word]

The frame’s own words that no name in scope covers.

For a frame that is an expanded body, that includes every word the caller holds. They are in the same physical frame — an expansion appends the callee’s run to the caller’s rather than pushing one — and they are not names this body bound, which is exactly what this reports: a word no name in scope covers, whoever else may have a name for it.

Source

pub fn local(&self, name: &str) -> Option<&Local>

The local called name that the source means at this pc, if one is in scope here.

The last match wins, which is cove_ir::Function::local_at’s rule and is the rule because the lowering resolves a name by searching its scope backwards. Two bindings of one name are live at once and the later one is what the source at this pc means; taking the first match would answer with the shadowed binding, which is a debugger that is wrong about the value of a name exactly where a person is most likely to ask.

The earlier binding is not hidden — it is still in Call::locals, where a reader can see both — because it is still in the frame, and a view of the machine that quietly dropped a word would be a worse lie than a view that shows two.

Trait Implementations§

Source§

impl Clone for Call

Source§

fn clone(&self) -> Call

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Call

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Call

§

impl RefUnwindSafe for Call

§

impl Send for Call

§

impl Sync for Call

§

impl Unpin for Call

§

impl UnsafeUnpin for Call

§

impl UnwindSafe for Call

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.