zakarumych / alkahest

Fantastic serialization library
Other
157 stars 9 forks source link

Bincoded unit tests failing to compile on main #14

Closed vlovich closed 1 year ago

vlovich commented 1 year ago
$ cargo test -F bincoded
   Compiling alkahest v0.3.0
error[E0277]: the type `[u8]` cannot be indexed by `RangeTo<(usize, usize)>`
   --> src/tests/mod.rs:469:57
    |
469 |     let (de, _) = deserialize::<Bincode, Value>(&buffer[..size]).unwrap();
    |                                                         ^^^^^^ slice indices are of type `usize` or ranges of `usize`
    |
    = help: the trait `SliceIndex<[u8]>` is not implemented for `RangeTo<(usize, usize)>`
    = help: the following other types implement trait `SliceIndex<T>`:
              <RangeTo<usize> as SliceIndex<str>>
              <RangeTo<usize> as SliceIndex<[T]>>
    = note: required for `[u8]` to implement `Index<RangeTo<(usize, usize)>>`

error[E0308]: mismatched types
   --> src/tests/mod.rs:469:9
    |
469 |     let (de, _) = deserialize::<Bincode, Value>(&buffer[..size]).unwrap();
    |         ^^^^^^^   ------------------------------------------------------- this expression has type `Value`
    |         |
    |         expected `Value`, found `(_, _)`
    |
    = note: expected struct `Value`
                found tuple `(_, _)`

Some errors have detailed explanations: E0277, E0308.
zakarumych commented 1 year ago

I tried to remember which of the two usizes is which. I'll make a structure for it.