Skip to main content

RefTarget

Enum RefTarget 

Source
pub enum RefTarget {
    Local {
        frame_index: u32,
        slot_index: u32,
        kind: NativeKind,
    },
    ModuleBinding {
        binding_idx: u32,
        kind: NativeKind,
    },
    TypedField {
        receiver: TypedObjectPtr,
        field_offset: u32,
        kind: NativeKind,
    },
}
Expand description

Kinded reference target.

Each variant carries the NativeKind of the projected slot — what you get when you deref the reference, not what you reference into. Threaded from the producing-opcode emit at MakeRef / MakeFieldRef / MakeIndexRef time per ADR-006 §2.7.13.

Variants§

§

Local

Reference to a local stack slot.

frame_index is the index into VirtualMachine.call_stack at MakeRef time; slot_index is the offset from that frame’s base_pointer (i.e. the local-slot ordinal). kind is the NativeKind of the slot at construction time, sourced from the stack’s §2.7.7 parallel-kind track.

Local-shaped refs do NOT escape their originating frame — the MIR ref-escape analysis (mir/lowering/mod.rs, ADR-006 §3.1) rejects closure capture / function return of a Local ref at compile time.

Fields

§frame_index: u32
§slot_index: u32
§

ModuleBinding

Reference to a module binding.

binding_idx is the position in VirtualMachine.module_bindings; kind is sourced from the module-binding §2.7.8 parallel-kind track at construction time.

Fields

§binding_idx: u32
§

TypedField

Projected reference into a typed-object field.

receiver keeps the projected object alive via the v2-raw TypedObjectPtr carrier (ADR-006 §2.3 typed-Arc carrier — one HeapHeader-at-offset-0 refcount share, retained/released through v2_retain / TypedObjectStorage::release_elem). Production TypedObjectStorage is allocated via the v2-raw _new path (op_new_typed_object), so the receiver slot bits are the raw struct pointer (HeapHeader at offset 0); the wrapper matches that allocation provenance. field_offset is the slot index inside TypedObjectStorage.slots (the schema-resolved field_idx from Operand::TypedField); kind is the projected slot’s NativeKind, sourced from the emitter’s field_type_tag.

Fields

§field_offset: u32

Implementations§

Source§

impl RefTarget

Source

pub fn projected_kind(&self) -> NativeKind

The NativeKind of the projected slot — what op_deref_load will push, and what op_deref_store expects.

Trait Implementations§

Source§

impl Debug for RefTarget

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> 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, 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.
Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,