Code Room
Code reviewHard
Question
Review this Rust FFI shim that hands a boxed handle to C and reclaims it.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
#[no_mangle]pub extern "C" fn handle_new() -> *mut Conn { Box::into_raw(Box::new(Conn::open()))} #[no_mangle]pub extern "C" fn handle_free(p: *mut Conn) { if p.is_null() { return; } unsafe { let _ = Box::from_raw(p); // reconstruct & drop drop(Box::from_raw(p)); // ensure dropped }}Run or narrate your approach, then ask the coach.