Note that in Rust today we can only use standard collection with the global allocator. https://github.com/phil-opp/blog_os/blob/post-10/src/main.rs... in the blog post it is intialized, and there's nothing to prevent allocation earlier and that will fail.
But there is work in progress (first https://github.com/rust-lang/rust/pull/58457) that will allow using local allocators, removing the ambient authority that makes that failure possible. Note that this doesn't mean a runtime cost. One can pass around a zero-sized token that is completely erased.