Skip to content

unused [patch] in $CARGO_HOME/config.toml failed loading sysroot metadata #19667

@weihanglo

Description

@weihanglo

How did it happen?

The cargo metadata invocation for querying libstd metadata fired with the --locked flag. However, when cargo attempted to write a lockfile because there were some unused [patch] entries under CARGO_HOME/config.toml, the command failed due to the presence of the --locked flag.

Code snippet to reproduce

export CARGO_HOME=/tmp/ra-bug/cargo-home

cargo new --lib /tmp/ra-bug/foo
cd /tmp/ra-bug/foo
cargo add empty-library
cat <<EOF > src/lib.rs
fn f() {
    let x = Some(1);
}
EOF

cargo new --lib /tmp/ra-bug/empty-library
cat <<EOF > /tmp/ra-bug/empty-library/Cargo.toml
[package]
name = "empty-library"
version = "1.0.0"
edition = "2015"
EOF

cat <<EOF > "$CARGO_HOME/config.toml"
[patch.crates-io]
empty-library = { path = "/tmp/ra-bug/empty-library" }
EOF

And the open any editor and hover on x
It'll show the following hint:

let x: {unknown}
───────────────────────────────────────────────────
Implements notable traits: Read, Write
───────────────────────────────────────────────────
does not contain types with destructors (drop glue)

Possible solutions

Maybe Cargo can have an option to stop writing unused patches? I am not sure if such an option is useful though.

We can perhaps leverage the unstable --lockfile-path flag. And write it to somewhere else so we won't modify the original one. Something like (though I don't like it):

diff --git a/crates/project-model/src/cargo_workspace.rs b/crates/project-model/src/cargo_workspace.rs
index 6e730b1aea..148b2a4c2d 100644
--- a/crates/project-model/src/cargo_workspace.rs
+++ b/crates/project-model/src/cargo_workspace.rs
@@ -389,7 +389,9 @@ impl CargoWorkspace {
             other_options.push("-Zscript".to_owned());
         }
         if locked {
-            other_options.push("--locked".to_owned());
+            other_options.push("-Zunstable-options".into());
+            other_options.push("--lockfile-path".into());
+            other_options.push("/tmp/rust-analyzer-hack/Cargo.lock".into());
         }
         if no_deps {
             other_options.push("--no-deps".to_owned());

Version information

rust-analyzer version: 4e4aee4

rustc version: 1.86.0

relevant settings: all defaults

Logs

The fallback to cargo metadata --no-deps succeeded, but didn't really help. See the log

Logs of env RA_LOG=project_model::sysroot=debug nvim

[START]LSP logging initiated
DEBUG Discovering sysroot by cd "/home/user/foo" && "/home/user/.nix-profile/bin/rustc" "--print" "sysroot"\n'
DEBUG checking sysroot library: /home/user/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library\n2025-04-23T05:44:46.798914-04:00  INFO Using sysroot workspace=/home/user/foo/Cargo.toml src_root=Some(AbsPath("/home/user/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library")) root=Some(AbsPath("/home/user/.rustup/toolchains/stable-aarch64-apple-darwin"))\n'
DEBUG Loading library metadata: /home/user/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/Cargo.toml\n"
DEBUG Discovering cargo config env by cd "/home/user/foo" && RUSTC_BOOTSTRAP="1" RUSTUP_TOOLCHAIN="/home/user/.rustup/toolchains/stable-aarch64-apple-darwin" "/home/user/.cargo/bin/cargo" "-Z" "unstable-options" "config" "get" "env"\n'
 WARN rustc_cfg::get: failed to run `cd "/home/user/foo" && RUSTUP_TOOLCHAIN="/home/user/.rustup/toolchains/stable-aarch64-apple-darwin" "/home/user/.cargo/bin/cargo" "rustc" "-Z" "unstable-options" "--print" "cfg" "--target" "aarch64-apple-darwin" "--" "-O"`, falling back to invoking rustc directly e=cd "/home/user/foo" && RUSTUP_TOOLCHAIN="/home/user/.rustup/toolchains/stable-aarch64-apple-darwin" "/home/user/.cargo/bin/cargo" "rustc" "-Z" "unstable-options" "--print" "cfg" "--target" "aarch64-apple-darwin" "--" "-O" failed, exit status: 101\nstderr:\nerror: the `-Z` flag is only accepted on the nightly channel of Cargo, but this is the `stable` channel\nSee https://doc.rust-lang.org/book/appendix-07-nightly-rust.html for more information about Rust release channels.\n\n'
DEBUG rustc_cfg::get: rustc cfgs found rustc_cfgs=[KeyValue { key: "panic", value: "unwind" }, KeyValue { key: "target_abi", value: "" }, KeyValue { key: "target_arch", value: "aarch64" }, KeyValue { key: "target_endian", value: "little" }, KeyValue { key: "target_env", value: "" }, KeyValue { key: "target_family", value: "unix" }, KeyValue { key: "target_feature", value: "aes" }, KeyValue { key: "target_feature", value: "crc" }, KeyValue { key: "target_feature", value: "dit" }, KeyValue { key: "target_feature", value: "dotprod" }, KeyValue { key: "target_feature", value: "dpb" }, KeyValue { key: "target_feature", value: "dpb2" }, KeyValue { key: "target_feature", value: "fcma" }, KeyValue { key: "target_feature", value: "fhm" }, KeyValue { key: "target_feature", value: "flagm" }, KeyValue { key: "target_feature", value: "fp16" }, KeyValue { key: "target_feature", value: "frintts" }, KeyValue { key: "target_feature", value: "jsconv" }, KeyValue { key: "target_feature", value: "lor" }, KeyValue { key: "target_feature", value: "lse" }, KeyValue { key: "target_feature", value: "neon" }, KeyValue { key: "target_feature", value: "paca" }, KeyValue { key: "target_feature", value: "pacg" }, KeyValue { key: "target_feature", value: "pan" }, KeyValue { key: "target_feature", value: "pmuv3" }, KeyValue { key: "target_feature", value: "ras" }, KeyValue { key: "target_feature", value: "rcpc" }, KeyValue { key: "target_feature", value: "rcpc2" }, KeyValue { key: "target_feature", value: "rdm" }, KeyValue { key: "target_feature", value: "sb" }, KeyValue { key: "target_feature", value: "sha2" }, KeyValue { key: "target_feature", value: "sha3" }, KeyValue { key: "target_feature", value: "ssbs" }, KeyValue { key: "target_feature", value: "vh" }, KeyValue { key: "target_has_atomic", value: "128" }, KeyValue { key: "target_has_atomic", value: "16" }, KeyValue { key: "target_has_atomic", value: "32" }, KeyValue { key: "target_has_atomic", value: "64" }, KeyValue { key: "target_has_atomic", value: "8" }, KeyValue { key: "target_has_atomic", value: "ptr" }, KeyValue { key: "target_os", value: "macos" }, KeyValue { key: "target_pointer_width", value: "64" }, KeyValue { key: "target_vendor", value: "apple" }, Flag("unix"), KeyValue { key: "target_has_atomic_equal_alignment", value: "8" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "16" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "32" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "64" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "128" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "ptr" }, Flag("target_has_atomic_load_store"), KeyValue { key: "target_has_atomic_load_store", value: "8" }, KeyValue { key: "target_has_atomic_load_store", value: "16" }, KeyValue { key: "target_has_atomic_load_store", value: "32" }, KeyValue { key: "target_has_atomic_load_store", value: "64" }, KeyValue { key: "target_has_atomic_load_store", value: "128" }, KeyValue { key: "target_has_atomic_load_store", value: "ptr" }, Flag("target_thread_local"), Flag("target_has_atomic")]\n'
DEBUG Failed to discover cargo config env: cd "/home/user/foo" && RUSTC_BOOTSTRAP="1" RUSTUP_TOOLCHAIN="/home/user/.rustup/toolchains/stable-aarch64-apple-darwin" "/home/user/.cargo/bin/cargo" "-Z" "unstable-options" "config" "get" "env" failed, exit status: 101\nstderr:\nerror: config value `env` is not set\n\n\nStack backtrace:\n   0: std::backtrace::Backtrace::create\n   1: anyhow::error::<impl anyhow::Error>::msg\n   2: project_model::utf8_stdout\n   3: project_model::env::cargo_config_env\n   4: std::sys::backtrace::__rust_begin_short_backtrace\n   5: core::ops::function::FnOnce::call_once{{vtable.shim}}\n   6: std::sys::pal::unix::thread::Thread::new::thread_start\n   7: __pthread_deallocate\n'
 WARN `cargo metadata` failed, but retry with `--no-deps` succeeded cargo_toml=/home/user/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/Cargo.toml e=Failed to run `cd "/home/user/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library" && RUSTUP_TOOLCHAIN="/home/user/.rustup/toolchains/stable-aarch64-apple-darwin" __CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS="nightly" "/home/user/.cargo/bin/cargo" "metadata" "--format-version" "1" "--manifest-path" "/home/user/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/Cargo.toml" "--filter-platform" "aarch64-apple-darwin" "--locked"`\n\nCaused by:\n    `cargo metadata` exited with an error: warning: Patch `empty-library v1.0.0 (/tmp/empty-library)` was not used in the crate graph.\n    Check that the patched package version and available features are compatible\n    with the dependency requirements. If the patch has a different version from\n    what is locked in the Cargo.lock file, run `cargo update` to use the new\n    version. This may also occur with an optional dependency that is not enabled.\n    error: the lock file /home/user/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/Cargo.lock needs to be updated but --locked was passed to prevent this\n    If you want to try to generate the lock file without accessing the network, remove the --locked flag and use --offline instead.\n    \n\nStack backtrace:\n   0: std::backtrace::Backtrace::create\n   1: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from\n   2: project_model::cargo_workspace::CargoWorkspace::fetch_metadata_\n   3: project_model::cargo_workspace::CargoWorkspace::fetch_metadata\n   4: project_model::sysroot::Sysroot::load_workspace\n   5: std::sys::backtrace::__rust_begin_short_backtrace\n   6: core::ops::function::FnOnce::call_once{{vtable.shim}}\n   7: std::sys::pal::unix::thread::Thread::new::thread_start\n   8: __pthread_deallocate\n'
DEBUG Discovering sysroot by cd "/home/user/foo" && "/home/user/.nix-profile/bin/rustc" "--print" "sysroot"\n'
DEBUG checking sysroot library: /home/user/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library\n2025-04-23T05:44:47.147551-04:00  INFO Using sysroot workspace=/home/user/foo/Cargo.toml src_root=Some(AbsPath("/home/user/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library")) root=Some(AbsPath("/home/user/.rustup/toolchains/stable-aarch64-apple-darwin"))\n'
DEBUG Loading library metadata: /home/user/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/Cargo.toml\n2025-04-23T05:44:47.192894-04:00 DEBUG Discovering cargo config env by cd "/home/user/foo" && RUSTC_BOOTSTRAP="1" RUSTUP_TOOLCHAIN="/home/user/.rustup/toolchains/stable-aarch64-apple-darwin" "/home/user/.cargo/bin/cargo" "-Z" "unstable-options" "config" "get" "env"\n'
DEBUG Failed to discover cargo config env: cd "/home/user/foo" && RUSTC_BOOTSTRAP="1" RUSTUP_TOOLCHAIN="/home/user/.rustup/toolchains/stable-aarch64-apple-darwin" "/home/user/.cargo/bin/cargo" "-Z" "unstable-options" "config" "get" "env" failed, exit status: 101\nstderr:\nerror: config value `env` is not set\n\n\nStack backtrace:\n   0: std::backtrace::Backtrace::create\n   1: anyhow::error::<impl anyhow::Error>::msg\n   2: project_model::utf8_stdout\n   3: project_model::env::cargo_config_env\n   4: std::sys::backtrace::__rust_begin_short_backtrace\n   5: core::ops::function::FnOnce::call_once{{vtable.shim}}\n   6: std::sys::pal::unix::thread::Thread::new::thread_start\n   7: __pthread_deallocate\n'
 WARN rustc_cfg::get: failed to run `cd "/home/user/foo" && RUSTUP_TOOLCHAIN="/home/user/.rustup/toolchains/stable-aarch64-apple-darwin" "/home/user/.cargo/bin/cargo" "rustc" "-Z" "unstable-options" "--print" "cfg" "--target" "aarch64-apple-darwin" "--" "-O"`, falling back to invoking rustc directly e=cd "/home/user/foo" && RUSTUP_TOOLCHAIN="/home/user/.rustup/toolchains/stable-aarch64-apple-darwin" "/home/user/.cargo/bin/cargo" "rustc" "-Z" "unstable-options" "--print" "cfg" "--target" "aarch64-apple-darwin" "--" "-O" failed, exit status: 101\nstderr:\nerror: the `-Z` flag is only accepted on the nightly channel of Cargo, but this is the `stable` channel\nSee https://doc.rust-lang.org/book/appendix-07-nightly-rust.html for more information about Rust release channels.\n\n'
DEBUG rustc_cfg::get: rustc cfgs found rustc_cfgs=[KeyValue { key: "panic", value: "unwind" }, KeyValue { key: "target_abi", value: "" }, KeyValue { key: "target_arch", value: "aarch64" }, KeyValue { key: "target_endian", value: "little" }, KeyValue { key: "target_env", value: "" }, KeyValue { key: "target_family", value: "unix" }, KeyValue { key: "target_feature", value: "aes" }, KeyValue { key: "target_feature", value: "crc" }, KeyValue { key: "target_feature", value: "dit" }, KeyValue { key: "target_feature", value: "dotprod" }, KeyValue { key: "target_feature", value: "dpb" }, KeyValue { key: "target_feature", value: "dpb2" }, KeyValue { key: "target_feature", value: "fcma" }, KeyValue { key: "target_feature", value: "fhm" }, KeyValue { key: "target_feature", value: "flagm" }, KeyValue { key: "target_feature", value: "fp16" }, KeyValue { key: "target_feature", value: "frintts" }, KeyValue { key: "target_feature", value: "jsconv" }, KeyValue { key: "target_feature", value: "lor" }, KeyValue { key: "target_feature", value: "lse" }, KeyValue { key: "target_feature", value: "neon" }, KeyValue { key: "target_feature", value: "paca" }, KeyValue { key: "target_feature", value: "pacg" }, KeyValue { key: "target_feature", value: "pan" }, KeyValue { key: "target_feature", value: "pmuv3" }, KeyValue { key: "target_feature", value: "ras" }, KeyValue { key: "target_feature", value: "rcpc" }, KeyValue { key: "target_feature", value: "rcpc2" }, KeyValue { key: "target_feature", value: "rdm" }, KeyValue { key: "target_feature", value: "sb" }, KeyValue { key: "target_feature", value: "sha2" }, KeyValue { key: "target_feature", value: "sha3" }, KeyValue { key: "target_feature", value: "ssbs" }, KeyValue { key: "target_feature", value: "vh" }, KeyValue { key: "target_has_atomic", value: "128" }, KeyValue { key: "target_has_atomic", value: "16" }, KeyValue { key: "target_has_atomic", value: "32" }, KeyValue { key: "target_has_atomic", value: "64" }, KeyValue { key: "target_has_atomic", value: "8" }, KeyValue { key: "target_has_atomic", value: "ptr" }, KeyValue { key: "target_os", value: "macos" }, KeyValue { key: "target_pointer_width", value: "64" }, KeyValue { key: "target_vendor", value: "apple" }, Flag("unix"), KeyValue { key: "target_has_atomic_equal_alignment", value: "8" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "16" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "32" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "64" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "128" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "ptr" }, Flag("target_has_atomic_load_store"), KeyValue { key: "target_has_atomic_load_store", value: "8" }, KeyValue { key: "target_has_atomic_load_store", value: "16" }, KeyValue { key: "target_has_atomic_load_store", value: "32" }, KeyValue { key: "target_has_atomic_load_store", value: "64" }, KeyValue { key: "target_has_atomic_load_store", value: "128" }, KeyValue { key: "target_has_atomic_load_store", value: "ptr" }, Flag("target_thread_local"), Flag("target_has_atomic")]\n'
 WARN `cargo metadata` failed, but retry with `--no-deps` succeeded cargo_toml=/home/user/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/Cargo.toml e=Failed to run `cd "/home/user/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library" && RUSTUP_TOOLCHAIN="/home/user/.rustup/toolchains/stable-aarch64-apple-darwin" __CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS="nightly" "/home/user/.cargo/bin/cargo" "metadata" "--format-version" "1" "--manifest-path" "/home/user/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/Cargo.toml" "--filter-platform" "aarch64-apple-darwin" "--locked"`\n\nCaused by:\n    `cargo metadata` exited with an error: warning: Patch `empty-library v1.0.0 (/tmp/empty-library)` was not used in the crate graph.\n    Check that the patched package version and available features are compatible\n    with the dependency requirements. If the patch has a different version from\n    what is locked in the Cargo.lock file, run `cargo update` to use the new\n    version. This may also occur with an optional dependency that is not enabled.\n    error: the lock file /home/user/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/Cargo.lock needs to be updated but --locked was passed to prevent this\n    If you want to try to generate the lock file without accessing the network, remove the --locked flag and use --offline instead.\n    \n\nStack backtrace:\n   0: std::backtrace::Backtrace::create\n   1: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from\n   2: project_model::cargo_workspace::CargoWorkspace::fetch_metadata_\n   3: project_model::cargo_workspace::CargoWorkspace::fetch_metadata\n   4: project_model::sysroot::Sysroot::load_workspace\n   5: std::sys::backtrace::__rust_begin_short_backtrace\n   6: core::ops::function::FnOnce::call_once{{vtable.shim}}\n   7: std::sys::pal::unix::thread::Thread::new::thread_start\n   8: __pthread_deallocate\n'
DEBUG Discovering sysroot by cd "/home/user/foo" && "/home/user/.nix-profile/bin/rustc" "--print" "sysroot"\n'
DEBUG checking sysroot library: /home/user/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library\n"
 INFO Using sysroot workspace=/home/user/foo/Cargo.toml src_root=Some(AbsPath("/home/user/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library")) root=Some(AbsPath("/home/user/.rustup/toolchains/stable-aarch64-apple-darwin"))\n'
DEBUG Loading library metadata: /home/user/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/Cargo.toml\n2025-04-23T05:44:47.501683-04:00 DEBUG Discovering cargo config env by cd "/home/user/foo" && RUSTC_BOOTSTRAP="1" RUSTUP_TOOLCHAIN="/home/user/.rustup/toolchains/stable-aarch64-apple-darwin" "/home/user/.cargo/bin/cargo" "-Z" "unstable-options" "config" "get" "env"\n'
 WARN rustc_cfg::get: failed to run `cd "/home/user/foo" && RUSTUP_TOOLCHAIN="/home/user/.rustup/toolchains/stable-aarch64-apple-darwin" "/home/user/.cargo/bin/cargo" "rustc" "-Z" "unstable-options" "--print" "cfg" "--target" "aarch64-apple-darwin" "--" "-O"`, falling back to invoking rustc directly e=cd "/home/user/foo" && RUSTUP_TOOLCHAIN="/home/user/.rustup/toolchains/stable-aarch64-apple-darwin" "/home/user/.cargo/bin/cargo" "rustc" "-Z" "unstable-options" "--print" "cfg" "--target" "aarch64-apple-darwin" "--" "-O" failed, exit status: 101\nstderr:\nerror: the `-Z` flag is only accepted on the nightly channel of Cargo, but this is the `stable` channel\nSee https://doc.rust-lang.org/book/appendix-07-nightly-rust.html for more information about Rust release channels.\n\n'
DEBUG Failed to discover cargo config env: cd "/home/user/foo" && RUSTC_BOOTSTRAP="1" RUSTUP_TOOLCHAIN="/home/user/.rustup/toolchains/stable-aarch64-apple-darwin" "/home/user/.cargo/bin/cargo" "-Z" "unstable-options" "config" "get" "env" failed, exit status: 101\nstderr:\nerror: config value `env` is not set\n\n\nStack backtrace:\n   0: std::backtrace::Backtrace::create\n   1: anyhow::error::<impl anyhow::Error>::msg\n   2: project_model::utf8_stdout\n   3: project_model::env::cargo_config_env\n   4: std::sys::backtrace::__rust_begin_short_backtrace\n   5: core::ops::function::FnOnce::call_once{{vtable.shim}}\n   6: std::sys::pal::unix::thread::Thread::new::thread_start\n   7: __pthread_deallocate\n'
DEBUG rustc_cfg::get: rustc cfgs found rustc_cfgs=[KeyValue { key: "panic", value: "unwind" }, KeyValue { key: "target_abi", value: "" }, KeyValue { key: "target_arch", value: "aarch64" }, KeyValue { key: "target_endian", value: "little" }, KeyValue { key: "target_env", value: "" }, KeyValue { key: "target_family", value: "unix" }, KeyValue { key: "target_feature", value: "aes" }, KeyValue { key: "target_feature", value: "crc" }, KeyValue { key: "target_feature", value: "dit" }, KeyValue { key: "target_feature", value: "dotprod" }, KeyValue { key: "target_feature", value: "dpb" }, KeyValue { key: "target_feature", value: "dpb2" }, KeyValue { key: "target_feature", value: "fcma" }, KeyValue { key: "target_feature", value: "fhm" }, KeyValue { key: "target_feature", value: "flagm" }, KeyValue { key: "target_feature", value: "fp16" }, KeyValue { key: "target_feature", value: "frintts" }, KeyValue { key: "target_feature", value: "jsconv" }, KeyValue { key: "target_feature", value: "lor" }, KeyValue { key: "target_feature", value: "lse" }, KeyValue { key: "target_feature", value: "neon" }, KeyValue { key: "target_feature", value: "paca" }, KeyValue { key: "target_feature", value: "pacg" }, KeyValue { key: "target_feature", value: "pan" }, KeyValue { key: "target_feature", value: "pmuv3" }, KeyValue { key: "target_feature", value: "ras" }, KeyValue { key: "target_feature", value: "rcpc" }, KeyValue { key: "target_feature", value: "rcpc2" }, KeyValue { key: "target_feature", value: "rdm" }, KeyValue { key: "target_feature", value: "sb" }, KeyValue { key: "target_feature", value: "sha2" }, KeyValue { key: "target_feature", value: "sha3" }, KeyValue { key: "target_feature", value: "ssbs" }, KeyValue { key: "target_feature", value: "vh" }, KeyValue { key: "target_has_atomic", value: "128" }, KeyValue { key: "target_has_atomic", value: "16" }, KeyValue { key: "target_has_atomic", value: "32" }, KeyValue { key: "target_has_atomic", value: "64" }, KeyValue { key: "target_has_atomic", value: "8" }, KeyValue { key: "target_has_atomic", value: "ptr" }, KeyValue { key: "target_os", value: "macos" }, KeyValue { key: "target_pointer_width", value: "64" }, KeyValue { key: "target_vendor", value: "apple" }, Flag("unix"), KeyValue { key: "target_has_atomic_equal_alignment", value: "8" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "16" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "32" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "64" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "128" }, KeyValue { key: "target_has_atomic_equal_alignment", value: "ptr" }, Flag("target_has_atomic_load_store"), KeyValue { key: "target_has_atomic_load_store", value: "8" }, KeyValue { key: "target_has_atomic_load_store", value: "16" }, KeyValue { key: "target_has_atomic_load_store", value: "32" }, KeyValue { key: "target_has_atomic_load_store", value: "64" }, KeyValue { key: "target_has_atomic_load_store", value: "128" }, KeyValue { key: "target_has_atomic_load_store", value: "ptr" }, Flag("target_thread_local"), Flag("target_has_atomic")]\n'
 WARN `cargo metadata` failed, but retry with `--no-deps` succeeded cargo_toml=/home/user/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/Cargo.toml e=Failed to run `cd "/home/user/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library" && RUSTUP_TOOLCHAIN="/home/user/.rustup/toolchains/stable-aarch64-apple-darwin" __CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS="nightly" "/home/user/.cargo/bin/cargo" "metadata" "--format-version" "1" "--manifest-path" "/home/user/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/Cargo.toml" "--filter-platform" "aarch64-apple-darwin" "--locked"`\n\nCaused by:\n    `cargo metadata` exited with an error: warning: Patch `empty-library v1.0.0 (/tmp/empty-library)` was not used in the crate graph.\n    Check that the patched package version and available features are compatible\n    with the dependency requirements. If the patch has a different version from\n    what is locked in the Cargo.lock file, run `cargo update` to use the new\n    version. This may also occur with an optional dependency that is not enabled.\n    error: the lock file /home/user/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/Cargo.lock needs to be updated but --locked was passed to prevent this\n    If you want to try to generate the lock file without accessing the network, remove the --locked flag and use --offline instead.\n    \n\nStack backtrace:\n   0: std::backtrace::Backtrace::create\n   1: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from\n   2: project_model::cargo_workspace::CargoWorkspace::fetch_metadata_\n   3: project_model::cargo_workspace::CargoWorkspace::fetch_metadata\n   4: project_model::sysroot::Sysroot::load_workspace\n   5: std::sys::backtrace::__rust_begin_short_backtrace\n   6: core::ops::function::FnOnce::call_once{{vtable.shim}}\n   7: std::sys::pal::unix::thread::Thread::new::thread_start\n   8: __pthread_deallocate\n'
 INFO Running build scripts: cd "/home/user/foo" && RA_RUSTC_WRAPPER="1" RUSTC_WRAPPER="/home/user/rust-analyzer/target/release/rust-analyzer" RUSTUP_TOOLCHAIN="/home/user/.rustup/toolchains/stable-aarch64-apple-darwin" "/home/user/.cargo/bin/cargo" "check" "--quiet" "--workspace" "--message-format=json" "--manifest-path" "/home/user/foo/Cargo.toml" "--all-targets" "--keep-going"\n'

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cargocargo related issuesC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions