Isn't that pretty much what `#![no_std]` is for? You can still use an allocator with no_std, but you have to explicitly import it.
https://docs.rust-embedded.org/book/intro/no-std.html