[Solved] Cargo loads bincode-1.1.1 . I requested bincode-1.0.1


#1
  1. I pre-emptively apologize for not providing full picture – I’m not sure what info is relevant, and this is a proprietary codebase so I can’t just post a tar.bz2

  2. I have a workspace containing many crates. In all crates, if I request bincode, I request it as:

bincode = "1.0.1"
  1. Now, from a crate that requests bincode – when I try to build it, it decides to (1) load bincode 1.1.1 instead, and then give me an error about read_u128. In particular, the Cargo.toml looks like:

[dependencies]
bincode = "1.0.1"
serde = "1.0"
serde_json = "1.0"
serde_derive = "1.0"

Yet, when I build it, I get:

   Compiling bincode v1.1.1
error[E0599]: no method named `read_u128` found for type `R` in the current scope
...
    |
112 |     impl_nums!(u128, deserialize_u128, visit_u128, read_u128);
    | 
  1. so there’s two separate issues here: (1) why is bincode-1.1.1 not building fo rme and (2) why is Cargo directly ignoring my request for 1.0.1 and loading 1.1.1 ?

#2

I’m not sure what I originally did wrong, but manually editing Cargo.lock to change 1.1.1 to 1.0.1 appears to have fixed the issue.

No idea what was originally wrong.
No idea why this appears to work.


#3

You said "1.0.1" which is the same as "^1.0.1" which means “latest compatible version”, not “exactly this version”. If you want exactly 1.0.1 and nothing else, you need to use "=1.0.1".

As for the compile error, I would assume it’s because bincode doesn’t properly guard using the 128-bit integer types whilst byteorder does, combined with you using an older compiler. Or maybe it just doesn’t support your compiler version. Or maybe they’re in the “requiring newer compilers doesn’t count as breaking compatibility” camp. *shrug*


#4
  1. Thanks for the “1.0.1”, “^1.0.1”, “=1.0.1” clarification.

  2. Rust version:

cargo --version; rustc --version;
cargo 1.32.0-nightly (1fa308820 2018-10-31)
rustc 1.32.0-nightly (15d770400 2018-11-06)

Is this sufficiently up to date? If not, how do upgrade?


#5
 rustup update
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2019-02-10, rust version 1.34.0-nightly (3315728c0 2019-02-09)
error: component 'rls' for target 'x86_64-unknown-linux-gnu' is unavailable for download
info: checking for self-updates

  nightly-x86_64-unknown-linux-gnu update failed - rustc 1.32.0-nightly (15d770400 2018-11-06)


#6

Well, I dunno, then. I’d have to grab the source and go through it by hand.


#7

Actually, bincode-1.1.1 appears fine (when I build outside of my workspace).

There must be something really weird going on with this particular workspace I have built.


#8

From the error message I’d guess the 128-bit support is behind a feature flag, which is not enabled (or there’s a bug in the crate)