Unable to use std::heap::{Alloc, Heap, Layout}; | ^^^^ Could not find `heap` in `std`

I’ve trying to build a crate in my local machine (authored by someone)
It has mentioned

#![feature(extern_types, allocator_api)]

but when I’m trying to build, It still shows
^^^^ Could not find heap in std

Because that module is no longer there. That’s the price you pay for using unstable features.

If you check the std::heap docs for 1.27, you’ll see a deprecation notice that says the module is now called alloc. You’ll have to either fork the crate, or wait for the author to update it.

2 Likes

Thank you!