-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels

Description
Discovered in rust-lang/miri#1661 (comment) by @RalfJung.
Steps
- Setup a workspace like this:
cargo new --lib cargo-bug --vcs none
cd cargo-bug/
echo 'proc-macro-crate = { path = "proc-macro-crate" }
[lib]
doctest = false
[workspace]' >> Cargo.toml
cargo new --lib proc-macro-crate --vcs none
cd proc-macro-crate/
echo '[lib]
proc-macro = true
[dev-dependencies]
cargo-bug = { path = ".." }' >> Cargo.toml
cd ..
echo 'fn main() { println!("cargo:rustc-env=CRATE_TARGET={}", std::env::var("TARGET").unwrap()) }' > build.rs
echo '#[test]
fn target() {
assert_eq!(env!("CRATE_TARGET"), "i686-unknown-linux-musl");
assert_eq!(std::env::var_os("CRATE_TARGET"), None);
}' > src/lib.rs
- Run
cargo clean && cargo test --workspace --target i686-unknown-linux-musl -vv
(with--jobs 1
optionally). - The test always fails with (the random) one of the following messages (on
x86_64-unknown-linux-gnu
):
thread 'target' panicked at 'assertion failed: `(left == right)`
left: `Some("i686-unknown-linux-musl")`,
right: `None`', src/lib.rs:4:5
thread 'target' panicked at 'assertion failed: `(left == right)`
left: `Some("x86_64-unknown-linux-gnu")`,
right: `None`', src/lib.rs:4:5
Version info
cargo 1.51.0-nightly (783bc43c6 2021-01-20)
release: 1.51.0
commit-hash: 783bc43c660bf39c1e562c8c429b32078ad3099b
commit-date: 2021-01-20
cc @ehuss