We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug
BitIterator panics when retrieving its length via ExactSizeIterator
To Reproduce
#[test] fn test123() { let b = BitIterator::new(&[0b00000010], 0, 2); dbg!(b.len()); }
Output:
arrow-rs$ cargo test -p arrow-buffer --lib util::bit_iterator::tests::test123 -- --nocapture Blocking waiting for file lock on build directory Compiling arrow-buffer v53.0.0 (/home/jeffrey/Code/arrow-rs/arrow-buffer) Finished `test` profile [unoptimized + debuginfo] target(s) in 9.48s Running unittests src/lib.rs (/media/jeffrey/1tb_860evo_ssd/.cargo_target_cache/debug/deps/arrow_buffer-9f4040912c29ccf9) running 1 test thread 'util::bit_iterator::tests::test123' panicked at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/iter/traits/exact_size.rs:122:9: assertion `left == right` failed left: None right: Some(0) note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace test util::bit_iterator::tests::test123 ... FAILED failures: failures: util::bit_iterator::tests::test123 test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 128 filtered out; finished in 0.00s error: test failed, to rerun pass `-p arrow-buffer --lib`
Expected behavior
Doesn't panic
Additional context
Panic is here: https://github.com/rust-lang/rust/blob/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/iter/traits/exact_size.rs#L122
Looks like BitIterator implements ExactSizeIterator:
arrow-rs/arrow-buffer/src/util/bit_iterator.rs
Line 71 in f41c258
But it does not override the default size_hint from Iterator:
Lines 56 to 69 in f41c258
According to docs: https://doc.rust-lang.org/std/iter/trait.ExactSizeIterator.html
When doing so, the implementation of [Iterator::size_hint] must return the exact size of the iterator.
Iterator::size_hint
The text was updated successfully, but these errors were encountered:
take
Sorry, something went wrong.
size_hint
BitIterator
label_issue.py automatically added labels {'arrow'} from #6495
label_issue.py
Beihao-Zhou
Successfully merging a pull request may close this issue.
Describe the bug
BitIterator panics when retrieving its length via ExactSizeIterator
To Reproduce
Output:
Expected behavior
Doesn't panic
Additional context
Panic is here: https://github.com/rust-lang/rust/blob/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/iter/traits/exact_size.rs#L122
Looks like BitIterator implements ExactSizeIterator:
arrow-rs/arrow-buffer/src/util/bit_iterator.rs
Line 71 in f41c258
But it does not override the default size_hint from Iterator:
arrow-rs/arrow-buffer/src/util/bit_iterator.rs
Lines 56 to 69 in f41c258
According to docs: https://doc.rust-lang.org/std/iter/trait.ExactSizeIterator.html
The text was updated successfully, but these errors were encountered: