dnsl48 / fraction

[Rust] Lossless fractions and decimals; drop-in float replacement
Apache License 2.0
83 stars 25 forks source link

Specify minimal versions for dependencies #107

Closed jonasbb closed 5 months ago

jonasbb commented 5 months ago

fraction is a transitive dependency in one of my projects and an upgrade to 0.15.2 broke the CI build due to wrongly specified minimal versions.

   Compiling fraction v0.15.2
error[E0432]: unresolved imports `num::traits::ConstOne`, `num::traits::ConstZero`
Error:    --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fraction-0.15.2/src/lib.rs:227:14
    |
227 |     traits::{ConstOne, ConstZero},
    |              ^^^^^^^^  ^^^^^^^^^ no `ConstZero` in `traits`
    |              |
    |              no `ConstOne` in `traits`

For more information about this error, try `rustc --explain E0432`.
error: could not compile `fraction` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
Error: Process completed with exit code 101.

fraction 0.15.2 makes use of traits that are only available in num 0.4.2+ but itself specifies support with num 0.4.0. https://github.com/dnsl48/fraction/blob/338d056ef6ae4c4785d1f39b4810bb0d07f73fb6/Cargo.toml#L30

I added a minor version component to all dependencies in Cargo.toml. for serde and related crates the patch version is important.

dnsl48 commented 5 months ago

Hi @jonasbb, Thanks for reporting the issue. I don't believe we can pin all dependencies for the same reason to not lock out people locked with older versions of serde or lazy_static. However, the num crate is definitely the crate we should be more precise with. The version 0.15.2 is now yanked and 0.15.3 is now dependant on num "0.4.2". I'm closing this as resolved, but if 0.15.3 still gives you some dependency breakages, please reopen.