// SAFETY: This is safe because we're going to uphold all the invariants.
let foo = unsafe { // ← still doesn’t directly allow unsafe operations
let x = safe_preparation_operation(MAGIC_SAFEWORD);
x.prepare_even_more_safely();
// SAFETY: This is safe because x has been prepared so safely.
let result1 = x.unsafe this_is_where_the_unsafe_magic_happens();
// ↖ still required despite the outer `unsafe` block
gimme_that_result(result1);
// SAFETY: Our ffi is all good.
let final_result = x.unsafe this_is_where_the_unsafe_ffi_happens();
// (admitted, you only know that this is about FFI, when looking at the docs
// of `this_is_where_the_unsafe_ffi_happens`, but at least it’s very
// clear where exactly you have to look)
final_result
};
Shouldn't you split this into two unsafe blocks, since the FFI is all good and doesn't depend on the previous operations to be sound?