Skip to main content

DebugLocal

Struct DebugLocal 

Source
#[repr(C)]
pub struct DebugLocal { pub source_name: *const u8, pub name_len: u32, pub symbol_id: u32, pub descriptor: *const TypeDescriptor, pub value: Option<DebugValue>, pub type_id: u32, pub kind: u8, pub span_start: u32, pub span_end: u32, pub callee_name: *const u8, pub callee_name_len: u32, }
Expand description

One local variable in a debug frame snapshot (§9.3).

Carries the source name, the compiler-assigned symbol_id (which disambiguates shadowed bindings — two var a in the same scope get distinct ids, §4.2), the local’s type descriptor, and the current GcRef value. The prologue and epilogue push and pop the frames, the spill updates the values, and the crash debugger reads them to display locals.

Fields§

§source_name: *const u8

The source name as written (e.g. a). Not owned by the frame; points at a 'static string the compiler embedded.

§name_len: u32

The name’s byte length.

§symbol_id: u32

The compiler-assigned symbol id (disambiguates shadowed bindings, §4.2).

§descriptor: *const TypeDescriptor

The local’s static type descriptor (§9.3 “local type descriptors”), so the debugger can render a local without re-deriving its type. Embedded by the backend at push time from the MIR local’s Type. Null when the local has no static type (MirType::Opaque — a pipeline accumulator, a fused-loop item), alongside NO_STATIC_TYPE in type_id; and null on its own when the type has no runtime descriptor (Never, an unresolved inference variable), where type_id is still a real handle. Either way the debugger omits the type column.

§value: Option<DebugValue>

The current value of the local, or None for a slot no value has been written into yet.

Decoded from the slot’s one machine word by DebugLocalMeta::read, under the DebugSlotKind the compiler recorded for this local — so a temp whose box ADR-120 elided is a DebugValue::Scalar carrying its payload and no reference, and everything else is a DebugValue::Reference. A consumer that means to follow the value into the heap says so with DebugValue::reference, which is the one door a scalar cannot pass.

The word itself is Option<GcRef>-shaped in the slot, and the zeroed slot a fresh frame starts with is the None niche (F18).

§type_id: u32

The full static Type id (a praxis_typeck::Type(u32) handle), so the crash debugger can reconstruct the local’s exact type — including collection element types (Vec[Int], Map[Text, Int]) and record field shapes — which the runtime descriptor alone loses. The debugger pairs this id with the live TypeDb to type-check p EXPR against the selected frame (§9.5). NO_STATIC_TYPE when the local has none; every other u32 is a valid arena index, so there is no in-band zero sentinel.

§kind: u8

The debugger classification: LOCAL_KIND_USER (a binding the programmer wrote) or LOCAL_KIND_TEMP (a compiler intermediate). See crate::debug::LOCAL_KIND_USER.

§span_start: u32

The local’s source span start (byte offset), paired with span_end.

§span_end: u32

The local’s source span end (byte offset). (span_start, span_end) == (0, 0) means “no span” (the return slot, span-less captures).

§callee_name: *const u8

The function a direct call defines this local from, copied from DebugLocalMeta::callee_name. Null for every local that is not a direct call’s result.

§callee_name_len: u32

The callee name’s byte length; 0 where there is no name.

Implementations§

Source§

impl DebugLocal

Source

pub fn name(&self) -> String

The source name as a String. Allocates; for testing/debugger only.

Source

pub fn is_user(&self) -> bool

True iff this local is a user-written binding (a var/param/ capture), as opposed to a compiler-generated temporary.

Source

pub fn span(&self) -> Option<(u32, u32)>

The local’s source span [start, end) (byte offsets into program source), or None if none was threaded. None is signalled by the (0, 0) sentinel (the zero-width span at offset 0 is not a meaningful program location for a local that exists).

Source

pub unsafe fn callee(&self) -> Option<&'static str>

The function a direct call defines this local from, or None where the local is not a direct call’s result.

§Safety

The pointer is a compiler-embedded 'static UTF-8 string — the same contract Self::name reads source_name under — so the borrow this returns outlives any frame it came from.

Trait Implementations§

Source§

impl Clone for DebugLocal

Source§

fn clone(&self) -> DebugLocal

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 Copy for DebugLocal

Source§

impl Debug for DebugLocal

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.