From 1554c0114e4bfdbcae24ab6bed6e22252b9be424 Mon Sep 17 00:00:00 2001 From: Cryptjar Date: Fri, 18 Jun 2021 13:18:33 +0200 Subject: [PATCH] Fix unsoundness in `into_slice` by adding `ContiguousStorage` bound. --- src/base/matrix_slice.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/base/matrix_slice.rs b/src/base/matrix_slice.rs index 2b287f33..b275fa7f 100644 --- a/src/base/matrix_slice.rs +++ b/src/base/matrix_slice.rs @@ -80,6 +80,8 @@ macro_rules! slice_storage_impl( impl <'a, T: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim> $T<'a, T, R, C, RStride, CStride> + where + Self: ContiguousStorage { /// Extracts the original slice from this storage pub fn into_slice(self) -> &'a [T] { @@ -125,6 +127,8 @@ impl<'a, T: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim> Clone impl<'a, T: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim> SliceStorageMut<'a, T, R, C, RStride, CStride> +where + Self: ContiguousStorageMut, { /// Extracts the original slice from this storage pub fn into_slice_mut(self) -> &'a mut [T] {