#[cfg(not(feature = "panic_on_next_alloc"))]
use alloc_tracker::Allocator;
#[cfg(feature = "panic_on_next_alloc")]
use alloc_tracker::{Allocator, panic_on_next_alloc};
#[global_allocator]
static ALLOCATOR: Allocator<std::alloc::System> = Allocator::system();
#[cfg(feature = "panic_on_next_alloc")]
fn main() {
println!("About to enable panic-on-next-allocation and then allocate...");
panic_on_next_alloc(true);
println!("This allocation will panic:");
#[expect(clippy::useless_vec, reason = "example needs to show allocation")]
let _vec = vec![1, 2, 3]; println!("This line should never be reached!");
}
#[cfg(not(feature = "panic_on_next_alloc"))]
fn main() {
println!("This example requires the 'panic_on_next_alloc' feature to be enabled.");
println!("Run with: cargo run --example panic_on_alloc_demo --features panic_on_next_alloc");
}