diff --git a/src/lib.rs b/src/lib.rs index 35a09877d3..3ce8db0051 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5701,20 +5701,25 @@ pub unsafe trait SplitByteSlice: ByteSlice { } } - /// Splits the slice at the midpoint, with minimal runtime checks. + /// Splits the slice at the midpoint, possibly omitting bounds checks. /// /// `x.split_at_unchecked(mid)` returns `x[..mid]` and `x[mid..]`. /// /// # Safety /// - /// `mid` must not be greater than `x.deref().len()` + /// `mid` must not be greater than `x.deref().len()`. + /// + /// # Panics + /// + /// Some implementations may panic instead of exhibiting undefined + /// behavior when `mid` is greater than `x.deref().len()`. #[must_use] unsafe fn split_at_unchecked(self, mid: usize) -> (Self, Self); /// Attempts to split the slice at the midpoint. /// - /// `x.try_split_at(mid)` returns `Some((x[..mid], x[mid..]))`, if `mid <= - /// x.deref().len()`; otherwise `None`. + /// `x.try_split_at(mid)` returns `Some((x[..mid], x[mid..]))` if `mid <= + /// x.deref().len()` and otherwise returns `None`. #[must_use] #[inline] fn try_split_at(self, mid: usize) -> Option<(Self, Self)> {