Skip to content

Commit 2b76da8

Browse files
authored
Message: Chunks cannot have a size of zero.
Add a message to the assertion that chunks cannot have a size of zero.
1 parent 5da76ee commit 2b76da8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/core/src/slice/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ impl<T> [T] {
814814
#[stable(feature = "rust1", since = "1.0.0")]
815815
#[inline]
816816
pub fn chunks(&self, chunk_size: usize) -> Chunks<'_, T> {
817-
assert_ne!(chunk_size, 0);
817+
assert_ne!(chunk_size, 0, "Chunks cannot have a size of zero!");
818818
Chunks::new(self, chunk_size)
819819
}
820820

@@ -852,7 +852,7 @@ impl<T> [T] {
852852
#[stable(feature = "rust1", since = "1.0.0")]
853853
#[inline]
854854
pub fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut<'_, T> {
855-
assert_ne!(chunk_size, 0);
855+
assert_ne!(chunk_size, 0, "Chunks cannot have a size of zero!");
856856
ChunksMut::new(self, chunk_size)
857857
}
858858

0 commit comments

Comments
 (0)