Skip to content

Commit 939f84a

Browse files
authored
Rollup merge of rust-lang#95725 - hkBst:patch-1, r=Dylan-DPC
Message: Chunks cannot have a size of zero. Add a message to the assertion that chunks cannot have a size of zero.
2 parents 2e4964e + c331a92 commit 939f84a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/core/src/slice/mod.rs

+2-2
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)