Cargo from `rustup which` is broken
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 22h 40m
- Merged PRs (30d)
- 46
Description
I have hit a strange issue where using cargo reported by rustup which doesn't work. When building dashmap crate it downloads rust 1.65 and tries to build with that but it fails. Even if it succeeded how would it be possible to link crate built with 1.65 with all the other crates built with the latest version?
I'm not sure if this is a rustup or cargo issue.
Here are the exact steps:
Create new crate:
PS D:\test> cargo new project
Creating binary (application) `project` package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
PS D:\test> cd project
Add dashmap v6.1.0 as a dependency:
PS D:\test\project> cargo add dashmap@6.1.0
Updating crates.io index
Adding dashmap v6.1.0 to dependencies
Features:
- arbitrary
- inline
- raw-api
- rayon
- serde
- typesize
Updating crates.io index
Locking 13 packages to latest Rust 1.92.0-nightly compatible versions
Find out cargo location:
PS D:\test\project> rustup which cargo
C:\Users\user\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\bin\cargo.exe
Build with the provided cargo:
PS D:\test\project> C:\Users\user\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\bin\cargo.exe build
Compiling crossbeam-utils v0.8.21
Compiling parking_lot_core v0.9.12
Compiling scopeguard v1.2.0
Compiling windows-link v0.2.1
Compiling smallvec v1.15.1
Compiling cfg-if v1.0.4
Compiling once_cell v1.21.3
Compiling hashbrown v0.14.5
Compiling lock_api v0.4.14
Compiling dashmap v6.1.0
info: syncing channel updates for '1.65-x86_64-pc-windows-msvc'
info: latest update on 2022-11-03, rust version 1.65.0 (897e37553 2022-11-02)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'
error: the `-Z unstable-options` flag must also be passed to enable the flag `check-cfg`
error: could not compile `dashmap` (lib)
Caused by:
process didn't exit successfully: `rustc --crate-name dashmap --edition=2018 C:\Users\user\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\dashmap-6.1.0\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=119 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --check-cfg cfg(docsrs,test) --check-cfg "cfg(feature, values(\"arbitrary\", \"inline\", \"raw-api\", \"rayon\", \"serde\", \"typesize\"))" -C metadata=7088beb6e94b1ca5 -C extra-filename=-e6076f9687df7ba4 --out-dir D:\test\project\target\debug\deps -L dependency=D:\test\project\target\debug\deps --extern cfg_if=D:\test\project\target\debug\deps\libcfg_if-c6c59aeea06f958d.rmeta --extern crossbeam_utils=D:\test\project\target\debug\deps\libcrossbeam_utils-96db4feb57c79985.rmeta --extern hashbrown=D:\test\project\target\debug\deps\libhashbrown-aeca10d661ea0b2e.rmeta --extern lock_api=D:\test\project\target\debug\deps\liblock_api-04e31afff8092457.rmeta --extern once_cell=D:\test\project\target\debug\deps\libonce_cell-ecc86b59685e8d56.rmeta --extern parking_lot_core=D:\test\project\target\debug\deps\libparking_lot_core-e8be9b060a8eb8f9.rmeta --cap-lints allow` (exit code: 1)
Building with the default cargo (C:\Users\user\.cargo\bin\cargo.exe) does work. I was executing cargo from rustup which because this is what evcxr does. If this cargo is not meant to be executed directly than it should be documented somewhere.
dashmap contains rust-toolchain.toml with channel = "1.65", that's probably why rustup downloads rust 1.65.
rustup 1.28.2 (e4f3ad6f8 2025-04-28)
rustc 1.92.0-nightly (844264add 2025-10-14)
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.
Research direction
Reproduce the behavior using rustup which cargo and the direct Cargo command shown, then compare it with the default Cargo invocation. Read the rust-toolchain.toml behavior in the dashmap dependency and the evcxr usage cited in the report. Done means the supported status of executing that path directly is clear and documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100