Skip to content

Commit 3843fa9

Browse files
committed
Use a transparent repr for PyReadonly/ReadwriteArray as this has become as single field struct.
Using `#[repr(C)]` was necessary when it had multiple fields so that the `Deref` implementation from `PyReadwriteArray` to `PyReadonlyArray` is sound.
1 parent 08510a3 commit 3843fa9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/borrow/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ use shared::{acquire, acquire_mut, release, release_mut};
184184
/// i.e. that only shared references into the interior of the array can be created safely.
185185
///
186186
/// See the [module-level documentation](self) for more.
187-
#[repr(C)]
187+
#[repr(transparent)]
188188
pub struct PyReadonlyArray<'py, T, D>
189189
where
190190
T: Element,
@@ -365,7 +365,7 @@ where
365365
/// i.e. that only a single exclusive reference into the interior of the array can be created safely.
366366
///
367367
/// See the [module-level documentation](self) for more.
368-
#[repr(C)]
368+
#[repr(transparent)]
369369
pub struct PyReadwriteArray<'py, T, D>
370370
where
371371
T: Element,

0 commit comments

Comments
 (0)