rust-lang / rust-lang/rust-analyzer
Custom target incorrectly passed to cargo metadata on stdlib
@ShoyuVanilla is already working on this.
Since Jan 31, 2026.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Sorry, couldn't think of a good title
rust-analyzer version: rust-analyzer 0.3.2769-standalone
rustc version: rustc 1.95.0-nightly (842bd5be2 2026-01-29)
editor or extension: VSCode
relevant settings: see repro.tar.gz
Mostly #20932 but with rustflags = ["-Z", "unstable-options"] added and rust updated. Analysis starts with
2026-01-30T21:43:41.170877394Z WARN `cargo metadata` failed and returning succeeded result with `--no-deps` error=`cargo metadata` exited with an error: warning: the `--lockfile-path` flag is deprecated and will be removed in a future release, use `resolver.lockfile-path` config instead
error: failed to run `rustc` to learn about target-specific information
Caused by:
process didn't exit successfully: `rustc - --crate-name ___ --print=file-names --target my-spec --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg -Wwarnings` (exit status: 1)
--- stderr
error: error loading target specification: could not find specification for target "my-spec"
|
= help: run `rustc --print target-list` for a list of built-in targets
Stack backtrace:
0: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
1: project_model::cargo_workspace::FetchMetadata::exec
2: project_model::sysroot::Sysroot::load_workspace
3: std::sys::backtrace::__rust_begin_short_backtrace
4: core::ops::function::FnOnce::call_once{{vtable.shim}}
5: std::sys::thread::unix::Thread::new::thread_start
6: <unknown>
7: clone
From the verbose log, the command looks like cd "/home/ubuntu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library" && RUSTUP_AUTO_INSTALL="0" RUSTUP_TOOLCHAIN="/home/ubuntu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu" __CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS="nightly" "/home/ubuntu/.cargo/bin/cargo" "metadata" "--format-version" "1" "--manifest-path" "/home/ubuntu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/Cargo.toml" "--filter-platform" "my-spec" "-Zunstable-options" but obviously my-spec isn't a normal spec and should be something like aarch64-unknown-none
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.