#[global_allocator]
static A: zk_alloc::ZkAllocator = zk_alloc::ZkAllocator;
#[test]
fn panic_without_phase_guard_leaves_arena_active_and_trips_next_begin() {
use std::panic;
panic::set_hook(Box::new(|_| {}));
let _ = vec![0u8; 1024];
zk_alloc::begin_phase();
let r = panic::catch_unwind(panic::AssertUnwindSafe(|| panic!("simulated")));
assert!(r.is_err());
let next = panic::catch_unwind(panic::AssertUnwindSafe(zk_alloc::begin_phase));
let _ = panic::take_hook();
assert!(
next.is_err(),
"begin_phase after an orphaned phase must panic, but it returned normally"
);
zk_alloc::end_phase();
}