diff --git a/src/datetime/mod.rs b/src/datetime/mod.rs index bb157f836b..1834c1cc6b 100644 --- a/src/datetime/mod.rs +++ b/src/datetime/mod.rs @@ -49,7 +49,7 @@ mod tests; /// There are some constructors implemented here (the `from_*` methods), but /// the general-purpose constructors are all via the methods on the /// [`TimeZone`](./offset/trait.TimeZone.html) implementations. -#[derive(Clone)] +#[derive(Copy, Clone)] #[cfg_attr( any(feature = "rkyv", feature = "rkyv-16", feature = "rkyv-32", feature = "rkyv-64"), derive(Archive, Deserialize, Serialize), @@ -1386,10 +1386,6 @@ impl Timelike for DateTime { } } -// we need them as automatic impls cannot handle associated types -impl Copy for DateTime where ::Offset: Copy {} -unsafe impl Send for DateTime where ::Offset: Send {} - impl PartialEq> for DateTime { fn eq(&self, other: &DateTime) -> bool { self.datetime == other.datetime diff --git a/src/datetime/tests.rs b/src/datetime/tests.rs index 81e5c1bb59..4d81ce7a73 100644 --- a/src/datetime/tests.rs +++ b/src/datetime/tests.rs @@ -1866,3 +1866,12 @@ fn nano_roundrip() { assert_eq!(nanos, nanos2); } } + +#[test] +fn test_datetime_utc_is_copy_and_send() { + fn is_copy(_: T) {} + fn is_send(_: T) {} + + is_copy(DateTime::::MIN_UTC); + is_send(DateTime::::MIN_UTC); +}