Problem
If you have a .cargo/config.toml file with build-std = ['std'] (and valid target), and you try to build a crate with proc-macro = true, Cargo panics. This is only really a problem if that .cargo/config.toml exists in some parent directory of the crate.
Steps
- Clone this minimal repo.
- Run
cargo build, or RUST_BACKTRACE=full cargo build if you so desire.
Possible Solution(s)
Notes
Output of cargo version: cargo 1.50.0-nightly (d274fcf86 2020-12-07)
Backtrace: hastebin
My actual use case
I have a crate that targets wasm32-unknown-unknown, and I'd like to have a small child crate so I can use procedural macros. Since I'm using atomics in the wasm32 crate, I need build-std. In this case, I will still most likely need something like #8687, so that I can reset the rustflags array. I'll probably just end up figuring out how to pull the proc-macro crate up a level to get around this whole issue, but I figure a panic is still undesirable and at the very least can be turned into a helpful error message.
Problem
If you have a
.cargo/config.tomlfile withbuild-std = ['std'](and validtarget), and you try to build a crate withproc-macro = true, Cargo panics. This is only really a problem if that.cargo/config.tomlexists in some parent directory of the crate.Steps
cargo build, orRUST_BACKTRACE=full cargo buildif you so desire.Possible Solution(s)
build-stdis not allowed forproc-macrocrates.build-stdforproc-macrocrates.build-stdforproc-macrocrates..cargo/configsettings through a newresetconfig key #8687.Notes
Output of
cargo version:cargo 1.50.0-nightly (d274fcf86 2020-12-07)Backtrace: hastebin
My actual use case
I have a crate that targets
wasm32-unknown-unknown, and I'd like to have a small child crate so I can use procedural macros. Since I'm using atomics in thewasm32crate, I needbuild-std. In this case, I will still most likely need something like #8687, so that I can reset therustflagsarray. I'll probably just end up figuring out how to pull theproc-macrocrate up a level to get around this whole issue, but I figure a panic is still undesirable and at the very least can be turned into a helpful error message.