mirror of
https://github.com/bspeice/qadapt
synced 2024-11-14 10:08:08 -05:00
21 lines
488 B
Rust
21 lines
488 B
Rust
extern crate env_logger;
|
|
extern crate qadapt;
|
|
|
|
use qadapt::allocate_panic;
|
|
|
|
// Note that we're missing the `#[global_allocator]` attribute
|
|
|
|
#[allocate_panic]
|
|
fn does_allocate() -> Box<u8> {
|
|
Box::new(0)
|
|
}
|
|
|
|
fn main() {
|
|
// This code will warn that QADAPT isn't being used, but won't trigger a panic.
|
|
// Run with `RUST_LOG=warn cargo run --example setup_warning`
|
|
env_logger::init();
|
|
does_allocate();
|
|
|
|
// The warning will only trigger once though
|
|
does_allocate();
|
|
} |