Skip to content

Commit 666e09a

Browse files
committed
Refine safety comments on aliasing of reference-based views into NumPy arrays.
1 parent 9379893 commit 666e09a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/array.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ impl<T: Element, D: Dimension> PyArray<T, D> {
991991
///
992992
/// # Safety
993993
///
994-
/// The existence of an exclusive reference to the internal data, e.g. `&mut [T]` or `ArrayViewMut`, implies undefined behavior.
994+
/// Calling this method invalidates all exclusive references to the internal data, e.g. `&mut [T]` or `ArrayViewMut`.
995995
pub unsafe fn as_array(&self) -> ArrayView<'_, T, D> {
996996
self.as_view(|shape, ptr| ArrayView::from_shape_ptr(shape, ptr))
997997
}
@@ -1002,7 +1002,7 @@ impl<T: Element, D: Dimension> PyArray<T, D> {
10021002
///
10031003
/// # Safety
10041004
///
1005-
/// The existence of another reference to the internal data, e.g. `&[T]` or `ArrayView`, implies undefined behavior.
1005+
/// Calling this method invalidates all other references to the internal data, e.g. `ArrayView` or `ArrayViewMut`.
10061006
pub unsafe fn as_array_mut(&self) -> ArrayViewMut<'_, T, D> {
10071007
self.as_view(|shape, ptr| ArrayViewMut::from_shape_ptr(shape, ptr))
10081008
}
@@ -1105,7 +1105,7 @@ where
11051105
///
11061106
/// # Safety
11071107
///
1108-
/// The existence of an exclusive reference to the internal data, e.g. `&mut [T]` or `ArrayViewMut`, implies undefined behavior.
1108+
/// Calling this method invalidates all exclusive references to the internal data, e.g. `ArrayViewMut` or `MatrixSliceMut`.
11091109
#[doc(alias = "nalgebra")]
11101110
pub unsafe fn try_as_matrix<R, C, RStride, CStride>(
11111111
&self,
@@ -1127,7 +1127,7 @@ where
11271127
///
11281128
/// # Safety
11291129
///
1130-
/// The existence of another reference to the internal data, e.g. `&[T]` or `ArrayView`, implies undefined behavior.
1130+
/// Calling this method invalidates all other references to the internal data, e.g. `ArrayView`, `MatrixSlice`, `ArrayViewMut` or `MatrixSliceMut`.
11311131
#[doc(alias = "nalgebra")]
11321132
pub unsafe fn try_as_matrix_mut<R, C, RStride, CStride>(
11331133
&self,

0 commit comments

Comments
 (0)