killercup / killercup/cargo-edit

`cargo upgrade -i --recursive` doesn't upgrade everything

Open
#866 0 comments 0 reactions 0 assignees View on GitHub
cargo-upgrade
Dominant language
Rust
Stars
3.5k
Forks
166
PR merge metrics
No merged PRs in 30d

Description

When I used `cargo upgrade -i --recursive` on my project with lots of outdated dependencies, it upgraded only part of them. I needed to use `cargo update` afterwards to upgrade the rest. What is the reason for that behavior? Is it expected? If yes, should one use `cargo upgrade` followed by `cargo update` or the other way around?

I'm using cargo-edit-upgrade 0.12.0.

### Steps to reproduce:
1. Clone https://github.com/ArekPiekarz/rusty-git-gui
2. Checkout commit 9593857e291976f5d00ed42f833eff7d400b81fd
3. Run `cargo upgrade -i --recursive --verbose` to upgraded all dependencies recursively to the latest versions:
```
$ cargo upgrade -i --recursive --verbose
Updating 'https://github.com/rust-lang/crates.io-index' index
Checking rusty-git-gui's dependencies
name old req compatible latest new req
==== ======= ========== ====== =======
anyhow 1.0.71 1.0.72 1.0.72 1.0.72
git2 0.17.1 0.17.2 0.17.2 0.17.2
itertools 0.10.5 0.10.5 0.11.0 0.11.0
regex 1.8.1 1.9.1 1.9.1 1.9.1
serde 1.0.162 1.0.178 1.0.178 1.0.178
time 0.3.21 0.3.23 0.3.23 0.3.23
toml 0.7.3 0.7.6 0.7.6 0.7.6
pretty_assertions 1.3.0 1.4.0 1.4.0 1.4.0
tempfile 3.5.0 3.7.0 3.7.0 3.7.0
Upgrading recursive dependencies
Updating addr2line v0.19.0 -> v0.20.0
Updating aho-corasick v1.0.1 -> v1.0.2
Updating backtrace v0.3.67 -> v0.3.68
Updating either v1.8.1 -> v1.9.0
Updating form_urlencoded v1.1.0 -> v1.2.0
Updating gimli v0.27.2 -> v0.27.3
Updating idna v0.3.0 -> v0.4.0
Updating itoa v1.0.6 -> v1.0.9
Updating libz-sys v1.1.9 -> v1.1.12
Updating log v0.4.17 -> v0.4.19
Updating miniz_oxide v0.6.2 -> v0.7.1
Updating object v0.30.3 -> v0.31.1
Updating percent-encoding v2.2.0 -> v2.3.0
Updating unicode-ident v1.0.8 -> v1.0.11
Updating url v2.3.1 -> v2.4.0
Updating windows-targets v0.48.0 -> v0.48.1
note: Re-run with `--verbose` to show more dependencies
latest: 8 packages
```
(It's also strange that it printed a suggestion to rerun with `--verbose`, even though I already added it, but that's another bug to report.)

4. Run `cargo outdated -R` to check only direct dependencies:
```
$ cargo outdated -R
All dependencies are up to date, yay!
```
The direct dependencies were correctly upgraded.

5. Run `cargo outdated` to check indirect dependencies:
```
$ cargo outdated
Name Project Compat Latest Kind Platform
---- ------- ------ ------ ---- --------
atk->glib 0.17.9 0.17.10 0.17.10 Normal ---
atk-sys->glib-sys 0.17.4 0.17.10 0.17.10 Normal ---
atk-sys->gobject-sys 0.17.4 0.17.10 0.17.10 Normal ---
atk-sys->system-deps 6.0.5 6.1.1 6.1.1 Build ---
cairo-rs->cairo-sys-rs 0.17.0 0.17.10 0.17.10 Normal ---
cairo-rs->glib 0.17.9 0.17.10 0.17.10 Normal ---
cairo-rs->once_cell 1.17.1 1.18.0 1.18.0 Normal ---
cairo-rs->thiserror 1.0.40 1.0.44 1.0.44 Normal ---
cairo-sys-rs->glib-sys 0.17.4 0.17.10 0.17.10 Normal ---
cairo-sys-rs->system-deps 6.0.5 6.1.1 6.1.1 Build ---
cfg-expr->smallvec 1.10.0 1.11.0 1.11.0 Normal ---
cfg-expr->target-lexicon 0.12.7 0.12.10 0.12.10 Normal ---
field-offset->memoffset 0.8.0 0.9.0 0.9.0 Normal ---
futures-util->pin-project-lite 0.2.9 0.2.10 0.2.10 Normal ---
gdk->cairo-rs 0.17.0 0.17.10 0.17.10 Normal ---
gdk->gdk-pixbuf 0.17.0 0.17.10 0.17.10 Normal ---
gdk->gio 0.17.9 0.17.10 0.17.10 Normal ---
gdk->glib 0.17.9 0.17.10 0.17.10 Normal ---
gdk->pango 0.17.4 0.17.10 0.17.10 Normal ---
gdk-pixbuf->gdk-pixbuf-sys 0.17.0 0.17.10 0.17.10 Normal ---
gdk-pixbuf->gio 0.17.9 0.17.10 0.17.10 Normal ---
gdk-pixbuf->glib 0.17.9 0.17.10 0.17.10 Normal ---
gdk-pixbuf->once_cell 1.17.1 1.18.0 1.18.0 Normal ---
gdk-pixbuf-sys->gio-sys 0.17.4 0.17.10 0.17.10 Normal ---
gdk-pixbuf-sys->glib-sys 0.17.4 0.17.10 0.17.10 Normal ---
gdk-pixbuf-sys->gobject-sys 0.17.4 0.17.10 0.17.10 Normal ---
gdk-pixbuf-sys->system-deps 6.0.5 6.1.1 6.1.1 Build ---
gdk-sys->cairo-sys-rs 0.17.0 0.17.10 0.17.10 Normal ---
gdk-sys->gdk-pixbuf-sys 0.17.0 0.17.10 0.17.10 Normal ---
gdk-sys->gio-sys 0.17.4 0.17.10 0.17.10 Normal ---
gdk-sys->glib-sys 0.17.4 0.17.10 0.17.10 Normal ---
gdk-sys->gobject-sys 0.17.4 0.17.10 0.17.10 Normal ---
gdk-sys->pango-sys 0.17.0 0.17.10 0.17.10 Normal ---
gdk-sys->system-deps 6.0.5 6.1.1 6.1.1 Build ---
gio->gio-sys 0.17.4 0.17.10 0.17.10 Normal ---
gio->glib 0.17.9 0.17.10 0.17.10 Normal ---
gio->once_cell 1.17.1 1.18.0 1.18.0 Normal ---
gio->pin-project-lite 0.2.9 0.2.10 0.2.10 Normal ---
gio->smallvec 1.10.0 1.11.0 1.11.0 Normal ---
gio->thiserror 1.0.40 1.0.44 1.0.44 Normal ---
gio-sys->glib-sys 0.17.4 0.17.10 0.17.10 Normal ---
gio-sys->gobject-sys 0.17.4 0.17.10 0.17.10 Normal ---
gio-sys->system-deps 6.0.5 6.1.1 6.1.1 Build ---
glib->gio-sys 0.17.4 0.17.10 0.17.10 Normal ---
glib->glib-macros 0.17.9 0.17.10 0.17.10 Normal ---
glib->glib-sys 0.17.4 0.17.10 0.17.10 Normal ---
glib->gobject-sys 0.17.4 0.17.10 0.17.10 Normal ---
glib->once_cell 1.17.1 1.18.0 1.18.0 Normal ---
glib->smallvec 1.10.0 1.11.0 1.11.0 Normal ---
glib->thiserror 1.0.40 1.0.44 1.0.44 Normal ---
glib-sys->system-deps 6.0.5 6.1.1 6.1.1 Build ---
gobject-sys->glib-sys 0.17.4 0.17.10 0.17.10 Normal ---
gobject-sys->system-deps 6.0.5 6.1.1 6.1.1 Build ---
gtk->cairo-rs 0.17.0 0.17.10 0.17.10 Normal ---
gtk->field-offset 0.3.5 0.3.6 0.3.6 Normal ---
gtk->gdk-pixbuf 0.17.0 0.17.10 0.17.10 Normal ---
gtk->gio 0.17.9 0.17.10 0.17.10 Normal ---
gtk->glib 0.17.9 0.17.10 0.17.10 Normal ---
gtk->once_cell 1.17.1 1.18.0 1.18.0 Normal ---
gtk->pango 0.17.4 0.17.10 0.17.10 Normal ---
gtk-sys->cairo-sys-rs 0.17.0 0.17.10 0.17.10 Normal ---
gtk-sys->gdk-pixbuf-sys 0.17.0 0.17.10 0.17.10 Normal ---
gtk-sys->gio-sys 0.17.4 0.17.10 0.17.10 Normal ---
gtk-sys->glib-sys 0.17.4 0.17.10 0.17.10 Normal ---
gtk-sys->gobject-sys 0.17.4 0.17.10 0.17.10 Normal ---
gtk-sys->pango-sys 0.17.0 0.17.10 0.17.10 Normal ---
gtk-sys->system-deps 6.0.5 6.1.1 6.1.1 Build ---
pango->gio 0.17.9 0.17.10 0.17.10 Normal ---
pango->glib 0.17.9 0.17.10 0.17.10 Normal ---
pango->once_cell 1.17.1 1.18.0 1.18.0 Normal ---
pango->pango-sys 0.17.0 0.17.10 0.17.10 Normal ---
pango-sys->glib-sys 0.17.4 0.17.10 0.17.10 Normal ---
pango-sys->gobject-sys 0.17.4 0.17.10 0.17.10 Normal ---
pango-sys->system-deps 6.0.5 6.1.1 6.1.1 Build ---
proc-macro-crate->once_cell 1.17.1 1.18.0 1.18.0 Normal ---
redox_users->getrandom 0.2.9 0.2.10 0.2.10 Normal ---
redox_users->thiserror 1.0.40 1.0.44 1.0.44 Normal ---
rustc_version->semver 1.0.17 1.0.18 1.0.18 Normal ---
system-deps->cfg-expr 0.15.1 0.15.4 0.15.4 Normal ---
thiserror->thiserror-impl 1.0.40 1.0.44 1.0.44 Normal ---
```
We can see that lots of indirect dependencies are still outdated, even though we used `--recursive` flag.

6. Run `cargo update` to update indirect dependencies:
```
$ cargo update
Updating crates.io index
Updating cairo-rs v0.17.0 -> v0.17.10
Updating cairo-sys-rs v0.17.0 -> v0.17.10
Updating cfg-expr v0.15.1 -> v0.15.4
Updating field-offset v0.3.5 -> v0.3.6
Updating gdk-pixbuf v0.17.0 -> v0.17.10
Updating gdk-pixbuf-sys v0.17.0 -> v0.17.10
Updating getrandom v0.2.9 -> v0.2.10
Updating gio v0.17.9 -> v0.17.10
Updating gio-sys v0.17.4 -> v0.17.10
Updating glib v0.17.9 -> v0.17.10
Updating glib-macros v0.17.9 -> v0.17.10
Updating glib-sys v0.17.4 -> v0.17.10
Updating gobject-sys v0.17.4 -> v0.17.10
Updating memoffset v0.8.0 -> v0.9.0
Updating once_cell v1.17.1 -> v1.18.0
Updating pango v0.17.4 -> v0.17.10
Updating pango-sys v0.17.0 -> v0.17.10
Updating pin-project-lite v0.2.9 -> v0.2.10
Updating semver v1.0.17 -> v1.0.18
Updating smallvec v1.10.0 -> v1.11.0
Updating system-deps v6.0.5 -> v6.1.1
Updating target-lexicon v0.12.7 -> v0.12.10
Updating thiserror v1.0.40 -> v1.0.44
Updating thiserror-impl v1.0.40 -> v1.0.44
```

7. Run `cargo outdated` again:
```
$ cargo outdated
All dependencies are up to date, yay!
```
Only now all dependencies are upgraded.

Contributor guide

Open the contributing guide

Research direction

Reproduce from rusty-git-gui at commit 9593857e291976f5d00ed42f833eff7d400b81fd using cargo upgrade -i --recursive --verbose, then compare cargo outdated with cargo update. Read the command output and dependency versions to determine why indirect dependencies remain outdated; done means the expected upgrade behavior and command order are established or the discrepancy is corrected.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.