Proposal: Move std::alloc::System into its own crate

(that is then re-exported from std like the backtrace crate / parts of libc)

This & stabilization of #[alloc_error_handler] would make it feasible to build portable no_std + alloc Rust libraries that expose a C API.

1 Like

std::alloc::System uses libc. Why would you want to avoid libstd, if you need libc anyway?

There can be many reasons. For example, on Windows, linking against a Rust staticlib requires me to additionally link against ws2_32 and userenv even without ever using the functionality these provide.

Another example is building for an embedded target for which a libc including an allocator implementation and Rust's core are available, but std isn't.