2018-12-06 22:12:21 -05:00
|
|
|
use env_logger;
|
|
|
|
|
2018-11-22 11:19:31 -05:00
|
|
|
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();
|
2018-12-02 23:20:14 -05:00
|
|
|
}
|