Cargo: Cargo.lock updates automatically on `cargo build` in 1.47.0-nightly

Created on 4 Aug 2020  路  7Comments  路  Source: rust-lang/cargo

Problem


I am currently using rustc 1.47.0-nightly (6c8927b0c 2020-07-26) to build a crate containing multiple git based dependencies. The Cargo.lock to these dependencies automatically updates as a result of change to HEAD without explicit use of cargo update -p. I expected it to not update the dependencies and use the revisions from Cargo.lock as 1.46.0 used to do.

Steps

  1. cargo build

Possible Solution(s)

Notes

Output of cargo version: cargo 1.47.0-nightly (aa6872140 2020-07-23)

This asciinema makes note of how the error comes to be while building the project. Checkout side-effects mentioned as latest commit to this branch:

C-bug

All 7 comments

Can you share a little more detail on a reproduction? If you are referring to a change like you mentioned at https://github.com/tikv/tikv/commit/b3f9c3325, then that is expected that when you change the URL, cargo will update the Cargo.lock for that dependency. If you need a specific git rev, you'll need to specify the rev field in the dependency.

Please note the updates to Cargo.lock that weren't made explicitly.

https://github.com/de-sh/tikv/commit/d4af57a5c43aa94f88551d137ee55f53aee24ef4#r41190758

The changes are clear from building on 1.46.0-nightly, which doesn't update to the HEAD of git dependencies unless explicitly told to, unlike which 1.47.0-nightly does inexplicably update to latest HEAD on merely cargo build.

Ah, I see, sorry I misunderstood. I think this is a duplicate of #8468. This should be fixed on the latest nightly. I would use at least 2020-08-02.

Can you guide me as to how I can do this?

$ rustup override set nightly-2020-08-05
info: syncing channel updates for 'nightly-2020-08-05-x86_64-unknown-linux-gnu'
info: latest update on 2020-08-05, rust version 1.47.0-nightly (f9d422ea7 2020-08-04)
error: component 'rustfmt' for target 'x86_64-unknown-linux-gnu' is unavailable for download for channel nightly-2020-08-05
Sometimes not all components are available in any given nightly.

I have emulated the same on travis:

Maybe this is not fixed for 1.47.0-nightly unlike 1.46.0-nightly as mentioned in #8468

Reopening issue

When a component is missing, there are several options for installing without that component:

rustup toolchain install nightly-2020-08-05 --force
or
rustup toolchain install nightly-2020-08-05 --profile=minimal

The rustup documentation is at https://github.com/rust-lang/rustup, and via --help on the command-line.

Seems to be fixed in:

  • cargo 1.47.0-nightly (2d5c2381e 2020-07-31)
  • rustc 1.47.0-nightly (f9d422ea7 2020-08-04)

Thank you so much for the guidance @ehuss 鉂わ笍

Was this page helpful?
0 / 5 - 0 ratings