diff --git a/Cargo.toml b/Cargo.toml index 2bc16881..c0d56191 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ keywords = [ license = "MIT" readme = "README.md" repository = "https://github.com/ferrilab/bitvec" -rust-version = "1.56" +rust-version = "1.81" [features] alloc = [ diff --git a/src/vec/iter.rs b/src/vec/iter.rs index afa3848a..ff891920 100644 --- a/src/vec/iter.rs +++ b/src/vec/iter.rs @@ -540,8 +540,9 @@ where #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] enum FillStatus { /// The drain span is completely filled. + /// Note in this case, the replacement source may or may not be exhausted. FullSpan = 0, - /// The replacement source is completely exhausted. + /// The replacement source is completely exhausted, but the drain span is not filled yet. EmptyInput = 1, } @@ -682,7 +683,7 @@ where self.drain.move_tail(len); } let filled = self.drain.fill(collected.by_ref()); - debug_assert_eq!(filled, FillStatus::EmptyInput); + debug_assert_eq!(filled, FillStatus::FullSpan); debug_assert_eq!(collected.len(), 0); } } diff --git a/src/vec/tests/iter.rs b/src/vec/tests/iter.rs index 217f5337..0eaabafe 100644 --- a/src/vec/tests/iter.rs +++ b/src/vec/tests/iter.rs @@ -38,4 +38,13 @@ fn splice() { let mut bv = bitvec![0, 1, 0, 0, 1]; drop(bv.splice(2 .. 2, Some(true))); assert_eq!(bv, bits![0, 1, 1, 0, 0, 1]); + + let mut bv = bitvec![0, 1, 0, 0, 1]; + drop(bv.splice( + 2 .. 2, + (0usize .. 2).flat_map(|index| { + let array = BitArray::<_, Lsb0>::from(index); + array.into_iter().take(2) + }), + )); }