Skip to content

Commit

Permalink
Use a transparent repr for PyReadonly/ReadwriteArray as this has beco…
Browse files Browse the repository at this point in the history
…me 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.
  • Loading branch information
adamreichold committed Jul 9, 2023
1 parent 08510a3 commit 3843fa9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/borrow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ use shared::{acquire, acquire_mut, release, release_mut};
/// i.e. that only shared references into the interior of the array can be created safely.
///
/// See the [module-level documentation](self) for more.
#[repr(C)]
#[repr(transparent)]
pub struct PyReadonlyArray<'py, T, D>
where
T: Element,
Expand Down Expand Up @@ -365,7 +365,7 @@ where
/// i.e. that only a single exclusive reference into the interior of the array can be created safely.
///
/// See the [module-level documentation](self) for more.
#[repr(C)]
#[repr(transparent)]
pub struct PyReadwriteArray<'py, T, D>
where
T: Element,
Expand Down

0 comments on commit 3843fa9

Please sign in to comment.