Open
Description
Problem
The following panic happens when trying to check
a project with an artifact dependency that uses build-std
:
thread 'main' panicked at 'no entry found for key', src/tools/cargo/src/cargo/core/compiler/unit_dependencies.rs:169:25
stack backtrace:
0: rust_begin_unwind
at /rustc/4ce3749235fc31d15ebd444b038a9877e8c700d7/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at /rustc/4ce3749235fc31d15ebd444b038a9877e8c700d7/library/core/src/panicking.rs:143:14
2: core::panicking::panic_display
at /rustc/4ce3749235fc31d15ebd444b038a9877e8c700d7/library/core/src/panicking.rs:72:5
3: core::panicking::panic_str
at /rustc/4ce3749235fc31d15ebd444b038a9877e8c700d7/library/core/src/panicking.rs:56:5
4: core::option::expect_failed
at /rustc/4ce3749235fc31d15ebd444b038a9877e8c700d7/library/core/src/option.rs:1852:5
5: cargo::core::compiler::unit_dependencies::build_unit_dependencies
6: cargo::ops::cargo_compile::create_bcx
7: cargo::ops::cargo_compile::compile_ws
8: cargo::ops::cargo_compile::compile
9: cargo::commands::check::exec
10: cargo::cli::main
11: cargo::main
Steps
cargo new --lib artifact-dep-test
cd artifact-dep-test
cargo new --bin sub
- In the top-level
Cargo.toml
, add the following dependency:sub = { path = "sub", artifact = ["bin"], target = "x86_64-unknown-none" }
- Run:
Instead of
cargo +nightly check -Zbindeps -Zbuild-std --target x86_64-unknown-linux-gnu
x86_64-unknown-linux-gnu
, use your host architecture. (Specifying it explicitly is currently required forbuild-std
.)
Possible Solution(s)
No response
Notes
The issue also happens on the latest master
(commit 5f611af). The backtrace in debug mode is:
thread 'main' panicked at 'no entry found for key', src/cargo/core/compiler/unit_dependencies.rs:169:25
stack backtrace:
0: rust_begin_unwind
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/panicking.rs:498:5
1: core::panicking::panic_fmt
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/panicking.rs:116:14
2: core::panicking::panic_display
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/panicking.rs:72:5
3: core::panicking::panic_str
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/panicking.rs:56:5
4: core::option::expect_failed
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/option.rs:1817:5
5: core::option::Option<T>::expect
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/option.rs:692:21
6: <std::collections::hash::map::HashMap<K,V,S> as core::ops::index::Index<&Q>>::index
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/collections/hash/map.rs:1164:9
7: cargo::core::compiler::unit_dependencies::attach_std_deps
at ./src/cargo/core/compiler/unit_dependencies.rs:169:25
8: cargo::core::compiler::unit_dependencies::build_unit_dependencies
at ./src/cargo/core/compiler/unit_dependencies.rs:125:9
9: cargo::ops::cargo_compile::create_bcx
at ./src/cargo/ops/cargo_compile.rs:578:26
10: cargo::ops::cargo_compile::compile_ws
at ./src/cargo/ops/cargo_compile.rs:285:15
11: cargo::ops::cargo_compile::compile_with_exec
at ./src/cargo/ops/cargo_compile.rs:276:5
12: cargo::ops::cargo_compile::compile
at ./src/cargo/ops/cargo_compile.rs:265:5
13: cargo::commands::check::exec
at ./src/bin/cargo/commands/check.rs:51:5
14: cargo::cli::execute_subcommand
at ./src/bin/cargo/cli.rs:369:16
15: cargo::cli::main
at ./src/bin/cargo/cli.rs:176:5
16: cargo::main
at ./src/bin/cargo/main.rs:39:13
17: core::ops::function::FnOnce::call_once
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/ops/function.rs:227:5
Version
cargo 1.59.0 (49d8809dc 2022-02-10)
release: 1.59.0
commit-hash: 49d8809dc2d3e6e0d5ec634fcf26d8e2aab67130
commit-date: 2022-02-10
host: x86_64-unknown-linux-gnu
libgit2: 1.3.0 (sys:0.13.23 vendored)
libcurl: 7.80.0-DEV (sys:0.4.51+curl-7.80.0 vendored ssl:OpenSSL/1.1.1l)
os: Pop!_OS 21.10 (impish) [64-bit]