diff options
| author | Marijn Schouten <hkBst@users.noreply.github.com> | 2022-04-06 09:54:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-06 09:54:43 +0200 |
| commit | 2b76da86ef940a54bac9aee77f54d0ae39e065f6 (patch) | |
| tree | 027627ce5f226f4d87f24630a8dc40c9e81c17c8 | |
| parent | 5da76eeaad7b57eaee81fc28067952f96abf8377 (diff) | |
| download | rust-2b76da86ef940a54bac9aee77f54d0ae39e065f6.tar.gz rust-2b76da86ef940a54bac9aee77f54d0ae39e065f6.zip | |
Message: Chunks cannot have a size of zero.
Add a message to the assertion that chunks cannot have a size of zero.
| -rw-r--r-- | library/core/src/slice/mod.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index 17f6373ecbf..4f0f51d1a4f 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -814,7 +814,7 @@ impl<T> [T] { #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn chunks(&self, chunk_size: usize) -> Chunks<'_, T> { - assert_ne!(chunk_size, 0); + assert_ne!(chunk_size, 0, "Chunks cannot have a size of zero!"); Chunks::new(self, chunk_size) } @@ -852,7 +852,7 @@ impl<T> [T] { #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut<'_, T> { - assert_ne!(chunk_size, 0); + assert_ne!(chunk_size, 0, "Chunks cannot have a size of zero!"); ChunksMut::new(self, chunk_size) } |
