rust-lang / cargo

The Rust package manager
https://doc.rust-lang.org/cargo
Apache License 2.0
12.86k stars 2.43k forks source link

cargo update silently doesn't update tokio-threadpool without --precise #7671

Open glandium opened 4 years ago

glandium commented 4 years ago

Problem I was trying to update tokio-threadpool in Firefox, and had a hard time with it, especially because cargo update would say absolutely nothing.

Reduced Steps

  1. cargo new foo
  2. Edit foo/Cargo.toml to add:
    [dependencies]
    hyper = "=0.12.19"
    tokio-threadpool = "=0.1.14"
    tokio-executor = "=0.1.7"
  3. Enter the foo directory and run cargo update. This gives us the initial state for Cargo.lock.
  4. Remove the tokio-threadpool and thread-executor dependencies in Cargo.toml
  5. Run cargo update -p tokio-threadpool

Nothing happens, and the output is desperately empty.

Possible Solution(s)

cargo update -p tokio-threadpool --precise 0.1.17 (0.1.17 being the last version as of writing) works, and updates both tokio-threadpool and tokio-executor. I think cargo update -p tokio-threadpool should work just as well.

If not, then at least, cargo should say something about the fact that there is a newer version, but it can't be used because $reason, similar to what happens after upgrading both tokio-threadpool and tokio-executor, and trying to downgrade tokio-executor with cargo update -p tokio-executor --precise 0.1.7:

error: failed to select a version for the requirement `tokio-executor = "^0.1.8"`
  candidate versions found which didn't match: 0.1.7
  location searched: crates.io index
required by package `tokio-threadpool v0.1.17`
    ... which is depended on by `hyper v0.12.19`
    ... which is depended on by `foo v0.1.0 (/tmp/foo)`
epage commented 1 year ago

When you use --package, cargo tries to only update that one package and locks down all dependent packages. I'm surprised --precise works.

As for letting people know why an upgrade didn't happen, #7167 something similar.