Skip to main content

DebugValue

Enum DebugValue 

Source
pub enum DebugValue {
    Reference(GcRef),
    Scalar(ScalarValue),
    Reclaimed,
}
Expand description

What a debug slot holds: a reference the collector and the debugger may follow, or a raw scalar neither may.

DebugLocalMeta::read is the only constructor, and it is the only place in the runtime where a slot word becomes something typed.

Variants§

§

Reference(GcRef)

A live reference into the heap.

§

Scalar(ScalarValue)

A payload whose box the compiler elided (ADR-120).

§

Reclaimed

A reference that was here and whose object the collector has since reclaimed (ADR-106’s weak arm, RECLAIMED_WORD).

Carries nothing, deliberately: the object is gone, and this variant exists to say that rather than to say anything about it. It is the third thing a slot can be, and it is distinct from “never written”: one is a line that never ran, the other a line that ran and whose result is no longer around to show.

Reaching one is ordinary, not exceptional. ADR-044 decision 2 nulls a shadow slot the moment its local dies, so a binding stops being a root at its last use rather than at the end of its scope; any collection after that point is free to take it, while the debug slot goes on naming it. var b = "asdf" followed by an allocation big enough to collect is the whole recipe.

Implementations§

Source§

impl DebugValue

Source

pub fn reference(self) -> Option<GcRef>

The reference this value names, or None if it is a scalar.

The one door from a debug value back to the heap, so every consumer that roots, traces, poisons-checks or type-recovers a debug value goes through a single line that a scalar cannot pass. crash_snapshot’s push_roots, the collector’s post-sweep scan and the debugger’s p EXPR bindings are its three callers.

Source

pub fn is_live(self) -> bool

Whether this slot still holds something the debugger can render.

DebugLocalMeta::read answers Some for a reclaimed slot — a value was written — but there is nothing left to show, so a consumer branching on that Option alone has to say which of the two it means. This is the “renderable” half; fault_span’s question is the other one, and it wants is_some(): a temp whose expression finished is not where the frame faulted, whatever became of the result.

Source

pub fn as_int(&self) -> i64

Read this value as an Int, whether it is still boxed or was elided into a scalar slot.

§Panics

If it is neither — the same contract, and the same assertion, as GcRef::as_int, which this delegates to for a reference. A caller asking a Vec for its integer has a bug either way, and ADR-120 part 2 does not make that bug quieter.

Source

pub fn as_vec(&self) -> &[GcRef]

Read this value as a Vec’s elements.

§Panics

If it is a scalar. A Vec is never a scalar payload, so this arm is a caller bug and not a slot the compiler could have produced: ADR-120 forwards Int, Bool and Float boxes only.

Trait Implementations§

Source§

impl Clone for DebugValue

Source§

fn clone(&self) -> DebugValue

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 DebugValue

Source§

impl Debug for DebugValue

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for DebugValue

Source§

fn eq(&self, other: &DebugValue) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DebugValue

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.