proptest-rs / proptest

Hypothesis-like property testing for Rust
Apache License 2.0
1.69k stars 158 forks source link

Compilation error with bit-set 0.5.0 #374

Closed frozenlib closed 1 year ago

frozenlib commented 1 year ago

Using proptest 1.3.0 and bit-set 0.5.0 with the following Cargo.toml results in a compilation error.

[dependencies]
proptest = "1.3.0"
bit-set = "=0.5.0"
   Compiling proptest v1.3.0
error[E0308]: mismatched types
   --> C:\Users\frozenlib\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proptest-1.3.0\src\bits.rs:463:39
    |
463 |             Self(BitSet::from_bit_vec(BitVec::from_elem(len, true)))
    |                  -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bit_vec::BitVec`, found a different `bit_vec::BitVec`
    |                  |
    |                  arguments to this function are incorrect
    |
    = note: `bit_vec::BitVec` and `bit_vec::BitVec` have similar names, but are actually distinct types
note: `bit_vec::BitVec` is defined in crate `bit_vec`
   --> C:\Users\frozenlib\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bit-vec-0.6.3\src\lib.rs:212:1
    |
212 | pub struct BitVec<B=u32> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^
note: `bit_vec::BitVec` is defined in crate `bit_vec`
   --> C:\Users\frozenlib\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bit-vec-0.5.1\src\lib.rs:215:1
    |
215 | pub struct BitVec<B=u32> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `bit_vec` are being used?
note: associated function defined here
   --> C:\Users\frozenlib\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bit-set-0.5.0\src\lib.rs:220:12
    |
220 |     pub fn from_bit_vec(bit_vec: BitVec) -> Self {
    |            ^^^^^^^^^^^^

bit-set was changed to use bit-vec 0.6 instead of 0.5 in bit-set version 0.5.2, so I believe proptest, which uses bit-vec 0.6, needs to depend on bit-set 0.5.2 or later, not 0.5.0.

Version

cargo 1.72.1 (103a7ff2e 2023-08-15) proptest 1.3.0

matthew-russo commented 1 year ago

Thanks for the report. Giving this a look

matthew-russo commented 1 year ago

v1.3.1 released which depends on v0.5.2 of bit-set