Unstable feature for adding restricted_std to all crates?

Since a lot of data structure crates actually do not need std and just need core/alloc (for example, rope data structure), and it is so annoying to manually port them to core/alloc and then get the PR rejected because the author said the library should not be used in no_std so we don't intend to support no_std.

Although I can fork the crate if it is open-source, but I have to keep track of the upstream changes all the time and then replace it with no-std equivalent, which takes a lot of energy. If we can just strap #![feature(restricted_std)] to all the crates, that would make porting to no_std platforms so much more easier,

Passing -Zcrate-attr=feature(restricted_std) to rustc may work.

1 Like

What is this restricted std even? The unstable book has no info on it (and there is no tracking issue): restricted_std - The Rust Unstable Book

1 Like

I believe the intention is the following: On target where libstd is not officially supported, all items in libstd are gated behind the restricted_std feature to prevent usage of them on stable even once -Zbuild-std gets stabilized.