Skip to content
This repository was archived by the owner on Jul 29, 2025. It is now read-only.

Commit f7a943f

Browse files
committed
fix the allocator example
importing alloc is a bit weird
1 parent 9c6b290 commit f7a943f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

examples/allocator.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@
1414
#![no_main]
1515
#![no_std]
1616

17+
extern crate alloc;
1718
extern crate panic_halt;
1819

20+
use self::alloc::vec;
1921
use core::alloc::Layout;
2022

21-
use alloc::vec;
2223
use alloc_cortex_m::CortexMHeap;
2324
use cortex_m::asm;
2425
use cortex_m_rt::entry;
@@ -40,6 +41,10 @@ fn main() -> ! {
4041

4142
hprintln!("{:?}", xs).unwrap();
4243

44+
// exit QEMU
45+
// NOTE do not run this on hardware; it can corrupt OpenOCD state
46+
debug::exit(debug::EXIT_SUCCESS);
47+
4348
loop {}
4449
}
4550

0 commit comments

Comments
 (0)