pub unsafe fn drop_shared_capture(
layout: &ClosureLayout,
base: *mut u8,
i: usize,
)Expand description
Release a Shared capture: read the cell pointer at the slot, decode
the interior FieldKind, drop any heap refcount share carried by a
Ptr payload, and finally Arc::from_raw + drop the cell to release
its strong-count share.
This is the per-capture handler invoked by release_typed_closure’s
dispatch on capture_storage_kind(i). The contract pairs with
drop_owned_mutable_capture (defined by the parallel-track migration of
owned-mutable storage) — both are reached only when the closure
refcount has hit zero, and each handler is responsible for fully
reclaiming its slot’s resources.
§Safety
basemust point to a liveTypedClosureHeaderblock whose layout matcheslayout, and captureimust beCaptureKind::Shared(mask bitshared_capture_mask & (1 << i)set).- The slot at
base.add(layout.heap_capture_offset(i))must contain a non-null*const SharedCellproduced byArc::into_rawon a freshly-allocatedArc<SharedCell>(or null, in which case the release is a no-op). - For
Ptrinterior kind the payload bits must be a validValueWordbit pattern for whichrelease_raw_value_bitssemantics apply. - After this call the slot must not be read again (the
Arc::from_rawmay have freed the underlyingSharedCell).