bitvec
bitvec copied to clipboard
Bug: as_raw_slice() returns wrong value
Hello. I have found problem with method BitSlice::as_raw_slice(), it returns wrong value is some scenarios
System: 6.1.1-arch1-1 GNU/Linux rustc -V: rustc 1.66.0 (69f9c33d7 2022-12-12)
[dependencies]
bitvec = "1.0.1"
let bv = bitvec![u8, Lsb0; 1, 1, 1, 0, 1];
let s2 = &bv[2..5];
assert_eq!(s2, bitvec![u8, Lsb0; 1, 0, 1]);
let sbv2 = s2.to_bitvec();
assert_eq!(sbv2, bitvec![u8, Lsb0; 1, 0, 1]);
// panic here
// but left must be 5 [1, 0, 1]
assert_eq!(sbv2.as_raw_slice(), &[5u8]); // <-- left: `[20]`, right: `[5]`'