Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

byteorder = ">=1.3.0, < 1.4.0" restriction might be controversial #380

@mexus

Description

@mexus

Let's get a minimal library that got bincode and byteorder as the only dependencies:

[package]
name = "test-bincode-byteorder"
version = "0.1.0"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bincode = "1"
byteorder = "1.4" # Yes, I deliberately use "non-compatible" version of byteorder

Then cargo check it and see the contents of the generated Cargo.lock:

# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "bincode"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f30d3a39baa26f9651f17b375061f3233dde33424a8b72b0dbe93a68a0bc896d"
dependencies = [
 "byteorder",
 "serde",
]

[[package]]
name = "byteorder"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b"

[[package]]
name = "serde"
version = "1.0.123"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae"

[[package]]
name = "test-bincode-byteorder"
version = "0.1.0"
dependencies = [
 "bincode",
 "byteorder",
]

As you can see, the bincode's byteorder < 1.4.0 requirement is completely ignored.

If we assume it's simply a bug in cargo (I'm not quite sure about this to be honest) and it will get fixed sooner or later, then this restriction will prevent users from utilizing byteorder's features introduced in 1.4.0 (because there will be conflicting minor versions in the tree). Please correct me if I'm wrong, but isn't the only purpose of pinning the byteorder's minor version to make MSRV to be 1.18.0? But won't it be simpler for the end user to pin the crates not supporting rust-1.18 with their own hands? I mean, most probably they'll need to do that anyhow with other crates.

Also the restriction makes cargo outdated go crazy :))

$ cargo outdated
error: failed to select a version for `byteorder`.
    ... required by package `bincode v1.3.2`
    ... which is depended on by `test-bincode-byteorder v0.1.0 (/tmp/cargo-outdated1R5PzV)`
versions that meet the requirements `>=1.3.0, <1.4.0` are: 1.3.4, 1.3.3, 1.3.2, 1.3.1, 1.3.0

all possible versions conflict with previously selected packages.

  previously selected package `byteorder v1.4.2`
    ... which is depended on by `test-bincode-byteorder v0.1.0 (/tmp/cargo-outdated1R5PzV)`

failed to select a version for `byteorder` which could resolve this conflict

Could there be a chance to.. well.. eliminate the , < 1.4.0 part?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions