Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
mzabaluev opened this issue Feb 11, 2025 · 3 comments · May be fixed by #4478
Closed
3 tasks done

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

mzabaluev opened this issue Feb 11, 2025 · 3 comments · May be fixed by #4478
Labels

Comments

@mzabaluev
Copy link

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
@mzabaluev mzabaluev added the bug label Feb 11, 2025
@mzabaluev mzabaluev changed the title Loose dependency ranges on bigint crates create issues in consumer projects Loose dependency ranges on bigint crates may result in a version mismatch Feb 11, 2025
mzabaluev added a commit to movementlabsxyz/aptos-core that referenced this issue Feb 11, 2025
A temporary fix to get movement CLI to compile,
until diesel-rs/diesel#4477 is fixed.
@weiznich
Copy link
Member

I acknowledge that this can be an issue in certain cases, but I do not consider that to be a bug in diesel as there is no better way for us to handle this while not issuing a new major diesel release. We need to keep support for older versions of the num-bigint and bigdecimal crate for compatibility reasons and at the same time users want to have support to newer versions as well. Using a version range is the only known way to accomplish that goal without large code duplication.

Closed as won't fix

@weiznich weiznich closed this as not planned Won't fix, can't repro, duplicate, stale Feb 11, 2025
@mzabaluev
Copy link
Author

Yes, it would require a new major release to fix, but the current cargo manifest of diesel is buggy as it claims support for any combination of those crates' versions in the full Cartesian product of the given ranges, which is not true.

@weiznich
Copy link
Member

As written several times before: We currently don't accept any kind of changes that would require a major version bump. That's something that is not up to discussion, at least not without clear evidence that this is a wide spread problem that impacts the majority of diesel users.
So I really do not see any reason to continue discussing this if you don't have any other proposals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants