How do I use clap 4.0.0-rc.3?

https://crates.io/crates/clap/versions lists 4.0.0.-rc.3 as the latest version of clap, but when I add clap = "4.0.0-rc.3" to the [dependencies] section of Cargo.toml and run cargo build, it says:

$ cargo build
    Updating crates.io index
error: failed to select a version for the requirement `clap = "^4.0.0-rc.3"`
candidate versions found which didn't match: 3.2.22, 3.2.21, 3.2.20, ...
location searched: crates.io index

How can I use this version?

You must update Rust to 1.60 or later. Run rustup update. If you got your Rust from a Linux distribution, uninstall it, and install from https://rustup.rs.

Older versions of Rust won't "see" versions of crates that use new dependency syntax added in 1.60.

4 Likes

I am using

clap = { version = "4.0.0-rc.1", features = ["derive"] }

Weird. I copied and pasted that in my Cargo.toml, but I still see a similar error:

$ cargo build
    Updating crates.io index
error: failed to select a version for the requirement `clap = "^4.0.0-rc.1"`
candidate versions found which didn't match: 3.2.22, 3.2.21, 3.2.20, ...
location searched: crates.io index

I'm using cargo 1.57.0. Which version are you using?

Ah, thank you both for your help. I'll try to upgrade Rust.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.