Skip to content

Can't specify precise crate version if there are multiple versions #2773

@jethrogb

Description

@jethrogb
# depcrate/Cargo.toml 
[package]
name = "depcrate"
version = "0.1.0"

[dependencies]
spin = "0.3.5"
# maincrate/Cargo.toml
[package]
name = "maincrate"
version = "0.1.0"

[dependencies]
spin = "0.4.0"
depcrate = { path = "../depcrate" }

A cargo build will result in getting spin versions 0.3.5 and 0.4.2. Now, because of a bug, I'd like to downgrade 0.4.2 to 0.4.0. Let's try this:

$cargo update -p spin --precise 0.4.0
error: There are multiple `spin` packages in your project, and the specification `spin` is ambiguous.
Please re-run this command with `-p <spec>` where `<spec>` is one of the following:
  spin:0.4.2
  spin:0.3.5

Well ok, that makes sense. So let's specify spin:0.4.2:

$cargo update -p spin:0.4.2 --precise 0.4.0
    Updating registry `https://github.com/rust-lang/crates.io-index`
error: no matching package named `spin` found (required by `depcrate`)
location searched: registry https://github.com/rust-lang/crates.io-index
version required: = 0.3.5
versions found: 0.4.0

I thought I just said to only touch 0.4.2?

When I manually edit Cargo.lock and change all occurences of 0.4.2 to 0.4.0, it builds fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugE-easyExperience: Easy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions