Prohibit accidental alloc crate in no_std

I'm writing code for an embedded processor. It supports std and alloc, but I need to ban all use of both. I use no_std, which errors out if a crate I use pulls in std, but it's still possible for a no_std crate to extern crate alloc. Is there a way to automatically detect that?


For accidentally importing from alloc something that's also in core there's the clippy lint alloc_instead_of_core. There are also lints that allow one to deny use of individual types, functions, or macros, but apparently no wildcard support or anything that would work for an entire module or crate :confused:

Some prior discussion about adding a "no_alloc" attribute.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.