killercup / cargo-edit

A utility for managing cargo dependencies from the command line.
http://killercup.github.io/cargo-edit/
MIT License
3.06k stars 147 forks source link

cargo upgrade doesn't seem to see the latest crate #892

Closed ia0 closed 3 months ago

ia0 commented 5 months ago

I believe this is the reason behind #875. Here is a repro case:

git clone git@github.com:ia0/data-encoding.git
cd data-encoding/lib/macro/internal
cargo upgrade -p syn -i --verbose --verbose

Note how the latest syn crate is 1.0.109 although it should be 2.0.58 at the time of this writing:

name          old req   compatible latest  new req   note    
====          =======   ========== ======  =======   ====    
data-encoding 2.6.0-git -          -       2.6.0-git excluded
syn           1         1.0.109    1.0.109 1                 

Now let's repro #875 to really see that the latest version is wrong:

sed -i 's/"1"/"2"/' Cargo.toml
cargo upgrade -p syn -i --verbose --verbose

We actually get a downgrade from 2 to 1:

name          old req   compatible latest  new req   note    
====          =======   ========== ======  =======   ====    
data-encoding 2.6.0-git -          -       2.6.0-git excluded
syn           2         -          1.0.109 1                 

Note that this is not because the requirement is only the major version. We can also use a full version and get the same behavior:

sed -i 's/"1"/"2.0.58"/' Cargo.toml

We still get a downgrade with the same wrong latest version:

name          old req   compatible latest  new req   note    
====          =======   ========== ======  =======   ====    
data-encoding 2.6.0-git -          -       2.6.0-git excluded
syn           2.0.58    -          1.0.109 1.0.109           
epage commented 3 months ago

This is a duplicate of #857. data-encoding-macro-internals MSRV is 1.48 but syn v2's MSRV is 1.56+

[package]
name = "data-encoding-macro-internal"
# ...
rust-version = "1.48"

https://crates.io/crates/syn/versions

Closing as such. If there is something that I missed where this should be kept open, let us know!

ia0 commented 3 months ago

I see. Thanks a lot for the explanation! And I guess cargo upgrade won't use version ranges like >= 1, < 3 for this particular use case, such that the MSRV support is satisfied with the lowest bound and the upper bound is the most recent version.