Open Manishearth opened 3 years ago
Do you have any thoughts on how that could be accomplished? It seems like it would be quite difficult without some compiler magic. This is very much in the experimental phase, so it is somewhat expected that you'll need to patch things to try it out.
For serde specifically, you can build without default features if there isn't anything in particular you need from std.
@ehuss I feel like another -Z
flag would work? -Zunstable_restricted_std
? It's super weird that std becomes unstable this way.
I ran into the same problem like use of unstable library feature 'restricted_std'
, is there any compiler magic instead of patching each of the dependencies? I am using rustup-nightly-2021-08-01.
Any fixes for this issue?
This is causing problems with miri, as well:
$ cargo miri test --target riscv64gc-unknown-none-elf
Compiling compiler_builtins v0.1.70
Checking core v0.0.0 (/home/bjc/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
Compiling libc v0.2.116
[snip]
Checking getopts v0.2.21
Checking test v0.0.0 (/home/bjc/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test)
error[E0658]: use of unstable library feature 'restricted_std'
|
= help: add `#![feature(restricted_std)]` to the crate attributes to enable
For more information about this error, try `rustc --explain E0658`.
warning: `test` (lib) generated 1 warning (1 duplicate)
error: could not compile `test` due to previous error; 1 warning emitted
error: `"/home/bjc/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo" "check" "--release" "--manifest-path" "/tmp/xargo.BtaXXCUpYvdM/Cargo.toml" "--target" "riscv64gc-unknown-none-elf" "-p" "test"` failed with exit code: Some(101)
note: run with `RUST_BACKTRACE=1` for a backtrace
fatal error: failed to run xargo
I'm trying to build code with dependencies for
thumbv7m-none-eabi
, and crates like serde fail due to the lack ofrestricted_std
.This makes sense, but there doesn't seem to be a way to globally disable it, so either I have to edit and patch each of my dependencies, or I have to edit the requirement out of
std
. Neither is good. It would be nice if there were a way to globally opt in to this.