Skip to content

Commit 3d84909

Browse files
JRRudy1davidhewitt
authored andcommitted
Replaced Clone with PyClone as a supertrait of Element.
This is necessary in order to continue supporting object arrays after the update to PyO3 0.22.0 since `Py<T>` no longer implements `Clone` unless the 'py-clone' feature is enabled (which would be problematic for `numpy` to enable). This is a breaking change for 2 main reasons: 1. Custom `Element` impls will now need to provide a `PyClone` impl as well, since providing a blanket impl for all `T: Clone` is not possible. 2. A type parameter `T: Element` will no longer have an implicit `Clone` bound, so code relying on it will need to update the bounds to `T: Element + Clone`.
1 parent d32f1c7 commit 3d84909

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/dtype.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ pub trait PyClone: Sized {
731731
///
732732
/// [enumerated-types]: https://numpy.org/doc/stable/reference/c-api/dtype.html#enumerated-types
733733
/// [data-models]: https://en.wikipedia.org/wiki/64-bit_computing#64-bit_data_models
734-
pub unsafe trait Element: Clone + Send {
734+
pub unsafe trait Element: PyClone + Send {
735735
/// Flag that indicates whether this type is trivially copyable.
736736
///
737737
/// It should be set to true for all trivially copyable types (like scalar types

0 commit comments

Comments
 (0)