Skip to main content

Module trait_self_ref

Module trait_self_ref 

Source
Expand description

Shared pre-conversion alias checks and Self-reference lowering for trait shims.

Functions§

alias_checks 🔒
Reject overlapping Self arguments before any of their references exist. Shared/shared pairs are allowed. Reentrant access remains a separate concern.
argument 🔒
Convert one shim argument with the C wrapper’s structured error arm. Arity and native alias checks must run first. Self handles are borrowed later, after their address checks; rooted views retain a local scope until the method’s return has been converted.
borrow 🔒
Borrow a &Self argument’s value for the rest of the shim, exclusively for &mut Self, as a C wrapper borrows a &T / &mut T argument (#2106): a call still running on the object makes the borrow raise the miniextendr_borrow_conflict error. The handle argument made roots the pointer of a class-wrapped argument. Runs after alias_checks.
cell_address 🔒
A shim’s receiver address for alias_checks: the value inside the receiver’s RefCell, comparable with ExternalPtr::as_ptr of a &Self argument.
handle_ident 🔒
native_borrow_checks 🔒
Check native arguments before conversion can create references. Arity must already be checked, and the caller must be inside the shim’s R unwind boundary. &Self uses ExternalPtr handles and its separate address check.
receiver_borrow 🔒
Borrow a shim’s receiver from its RefCell for the rest of the shim: shared for &self, exclusive for &mut self. A call still running on the same object makes this raise the miniextendr_borrow_conflict error.