error[E0463]: can't find crate for `alloc`
--> src/main.rs:5:1
|
5 | extern crate alloc;
| ^^^^^^^^^^^^^^^^^^^ can't find crate
error: cannot find macro `format` in this scope
--> src/main.rs:16:16
|
16 | let text = format!("Hello {}", "world!");
| ^^^^^^
For more information about this error, try `rustc --explain E0463`.
error: could not compile `test01` (bin "test01") due to 2 previous errors
and here is the complete source code
#![no_std]
#![no_main]
#[macro_use]
extern crate alloc;
use esp_backtrace as _;
use esp_hal::{delay::Delay, prelude::*};
#[entry]
fn main() -> ! {
#[allow(unused)]
let peripherals = esp_hal::init(esp_hal::Config::default());
let delay = Delay::new();
let text = format!("Hello {}", "world!");
loop {
}
}
I compile it for esp32 by normal cargo build In fact I have that source code auto-generated from esp-rs/esp-template and just added lines for testing the alloc::format!.