mirror of
				https://github.com/bspeice/qadapt
				synced 2025-10-31 09:30:37 -04:00 
			
		
		
		
	Renaming and a new macro
This commit is contained in:
		| @ -1,10 +1,10 @@ | ||||
| use qadapt::allocate_panic; | ||||
| use qadapt::no_alloc; | ||||
| use qadapt::QADAPT; | ||||
|  | ||||
| #[global_allocator] | ||||
| static Q: QADAPT = QADAPT; | ||||
|  | ||||
| #[allocate_panic] | ||||
| #[no_alloc] | ||||
| fn does_allocate() -> Box<u8> { | ||||
|     Box::new(0) | ||||
| } | ||||
|  | ||||
| @ -1,20 +0,0 @@ | ||||
| use env_logger; | ||||
|  | ||||
| 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(); | ||||
| } | ||||
		Reference in New Issue
	
	Block a user