Open
Description
Problem
I am trying to test a crate that has a windows-only dependency using the --frozen
flag. The windows-only dependency in question is ipconfig
, locked to 0.3.0. However, cargo gives me this unexpected error instead of running tests, which is problematic (a) because it is not a dependency on my platform, and (b) ignores the version lock:
thread 'main' panicked at src/tools/cargo/src/cargo/ops/cargo_compile/mod.rs:950:14:
packages downloaded: failed to download `ipconfig v0.3.2`
Caused by:
attempting to make an HTTP request, but --frozen was specified
Stack backtrace:
0: <anyhow::Error>::msg::<&str>
1: cargo::util::network::http::http_handle_and_timeout
2: <cargo::core::package::Downloads>::start_inner
3: <cargo::core::package::Downloads>::start
4: <cargo::core::package::PackageSet>::get_one
5: cargo::ops::cargo_compile::resolve_all_features
6: <cargo::ops::cargo_compile::unit_generator::UnitGenerator>::proposals_to_units
7: <cargo::ops::cargo_compile::unit_generator::UnitGenerator>::generate_root_units
8: cargo::ops::cargo_compile::create_bcx
9: cargo::ops::cargo_compile::compile_ws
10: cargo::ops::cargo_compile::compile_with_exec
11: cargo::ops::cargo_compile::compile
12: cargo::ops::cargo_test::compile_tests
13: cargo::ops::cargo_test::run_tests
14: cargo::commands::test::exec
15: <cargo::cli::Exec>::exec
16: cargo::main
17: std::sys::backtrace::__rust_begin_short_backtrace::<fn(), ()>
18: std::rt::lang_start::<()>::{closure#0}
19: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/core/src/ops/function.rs:284:13
20: std::panicking::try::do_call
at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/std/src/panicking.rs:584:40
21: std::panicking::try
at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/std/src/panicking.rs:547:19
22: std::panic::catch_unwind
at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/std/src/panic.rs:358:14
23: std::rt::lang_start_internal::{{closure}}
at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/std/src/rt.rs:174:48
24: std::panicking::try::do_call
at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/std/src/panicking.rs:584:40
25: std::panicking::try
at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/std/src/panicking.rs:547:19
26: std::panic::catch_unwind
at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/std/src/panic.rs:358:14
27: std::rt::lang_start_internal
at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/std/src/rt.rs:174:20
28: main
29: <unknown>
30: __libc_start_main
31: <unknown>
stack backtrace:
0: rust_begin_unwind
at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/std/src/panicking.rs:692:5
1: core::panicking::panic_fmt
at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/core/src/panicking.rs:75:14
2: core::result::unwrap_failed
at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library/core/src/result.rs:1704:5
3: cargo::ops::cargo_compile::resolve_all_features
4: <cargo::ops::cargo_compile::unit_generator::UnitGenerator>::proposals_to_units
5: <cargo::ops::cargo_compile::unit_generator::UnitGenerator>::generate_root_units
6: cargo::ops::cargo_compile::create_bcx
7: cargo::ops::cargo_compile::compile_ws
8: cargo::ops::cargo_compile::compile_with_exec
9: cargo::ops::cargo_compile::compile
10: cargo::ops::cargo_test::compile_tests
11: cargo::ops::cargo_test::run_tests
12: cargo::commands::test::exec
13: <cargo::cli::Exec>::exec
14: cargo::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Steps
On a linux computer, run
git clone https://github.com/hickory-dns/hickory-dns
cd hickory-dns
git checkout v0.25.1
mkdir .cargo_home
CARGO_HOME=.cargo_home cargo fetch --locked --target=x86_64-unknown-linux-gnu
CARGO_HOME=.cargo_home cargo test --frozen -p hickory-resolver
Possible Solution(s)
- Don't download unnecessary dependencies
- As a workaround, make
cargo fetch
download the dependency
Version
On ArchLinux: cargo 1.85.0 (d73d2caf9 2024-12-31)
from rustup
On AlpineLinux: cargo 1.85.1 (d73d2caf9 2024-12-31)
from their repositories
On ArchLinux: cargo 1.86.0 (adf9b6ad1 2025-02-28)
from rustup