@@ -1541,6 +1541,10 @@ impl<T> [T] {
15411541 /// let src = [1, 2, 3, 4];
15421542 /// let mut dst = [0, 0];
15431543 ///
1544+ /// // Note: the slices must be the same length, so
1545+ /// // you can slice the source to be the same size.
1546+ /// // Here we slice the source, four elements, to two, the same size
1547+ /// // as the destination slice. It *will* panic if we don't do this.
15441548 /// dst.clone_from_slice(&src[2..]);
15451549 ///
15461550 /// assert_eq!(src, [1, 2, 3, 4]);
@@ -1607,6 +1611,10 @@ impl<T> [T] {
16071611 /// let src = [1, 2, 3, 4];
16081612 /// let mut dst = [0, 0];
16091613 ///
1614+ /// // Note: the slices must be the same length, so
1615+ /// // you can slice the source to be the same size.
1616+ /// // Here we slice the source, four elements, to two, the same size
1617+ /// // as the destination slice. It *will* panic if we don't do this.
16101618 /// dst.copy_from_slice(&src[2..]);
16111619 ///
16121620 /// assert_eq!(src, [1, 2, 3, 4]);
0 commit comments