Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cargo panics when building a proc-macro crate with build-std present in any parent .cargo/config.toml #8975

Open
rjb3977 opened this issue Dec 13, 2020 · 0 comments
Labels
C-bug Category: bug Z-build-std Nightly: build-std

Comments

@rjb3977
Copy link

rjb3977 commented Dec 13, 2020

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

  1. Clone this minimal repo.
  2. 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.

@rjb3977 rjb3977 added the C-bug Category: bug label Dec 13, 2020
@alexcrichton alexcrichton added the Z-build-std Nightly: build-std label Dec 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug Z-build-std Nightly: build-std
Projects
None yet
Development

No branches or pull requests

2 participants