Skip to content

Loose dependency ranges on bigint crates may result in a version mismatch #4477

@mzabaluev

Description

@mzabaluev

Setup

Versions

  • Diesel: 2.2.7

Feature Flags

  • diesel: numeric

Problem Description

The bigint crate dependencies are given as loose ranges:

num-bigint = { version = ">=0.2.0, <0.5.0", optional = true }
bigdecimal = { version = ">=0.0.13, < 0.5.0", optional = true }

bigdecimal in turn depends on bigint, but with a more rigid range as is customary for 0.x dependencies in cargo (e.g. bigdecimal 0.4.7 depends on num-bigint ^0.4). Usually there is no problem as there is a single num-bigint version to settle on.

However, in a large workspace that has diesel in the dependency tree, multiple versions of num-bigint or bigdecimal may be pulled by different crates. This can lead to a different version of num-bigint being selected for diesel than the one selected for bigdecimal, resulting in a compilation failure due to missing num-bigint trait implementations for the version required by diesel.

Here's an example: movementlabsxyz/aptos-core#132

Checklist

  • I have already looked over the issue tracker and the discussion forum for similar possible closed issues.
  • This issue can be reproduced on Rust's stable channel. (Your issue will be
    closed if this is not the case)
  • This issue can be reproduced without requiring a third party crate

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions