Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/bun_core/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,12 @@ pub const unsafe fn container_of<P, F>(field: *const F, offset: usize) -> *mut P
/// threaded event loop: the callback is the unique re-entry point for `*ctx`
/// while it runs. **Do not** use this for arbitrary pointer reinterpretation
/// (struct-layout punning, lifetime laundering) — that is not the contract.
/// - Not for a callback that consumes `*ctx` (a completion that frees the
/// request): every method called on the returned reference receives it as
/// a protected argument, and freeing the allocation inside such a call is
/// UB even if the reference is never used again. Such a callback dispatches
/// on the raw `*mut T` instead, as the c-ares thunks in
/// `bun_cares_sys::c_ares` do.
Comment thread
robobun marked this conversation as resolved.
Outdated
#[inline(always)]
#[track_caller]
pub unsafe fn callback_ctx<'a, T>(ctx: *mut core::ffi::c_void) -> &'a mut T {
Expand Down
Loading