Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnessary Copy and Send impls #1492

Merged
merged 1 commit into from
Mar 7, 2024
Merged

Conversation

erickt
Copy link
Contributor

@erickt erickt commented Mar 7, 2024

Fuchsia is doing an audit of chrono 0.4.34, and we noticed an unncessary unsafe of Send for DateTime. While it's valid since Tz::Offset is Send, and NaiveDateTime only has u32 fields, there's a potential hazard if NaiveDateTime ever grows unsendable fields (unlikely as that is).

This (and the Copy impl) were added 9 years ago to fix #25, which stemmed from early versions of associate traits not working properly with auto-traits. This has since been fixed, and is no longer necessary with the MSRV 1.61.0.

To make sure this stays working, it includes a test that makes sure that DateTime<Utc> is Send and Copy just to be safe.

Copy link

codecov bot commented Mar 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.80%. Comparing base (3114597) to head (ee48d16).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1492   +/-   ##
=======================================
  Coverage   91.80%   91.80%           
=======================================
  Files          40       40           
  Lines       18329    18336    +7     
=======================================
+ Hits        16827    16834    +7     
  Misses       1502     1502           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Fuchsia is doing an audit of chrono 0.4.34, and we noticed an unncessary
unsafe of `Send` for `DateTime`. While it's valid since `Tz::Offset` is
`Send`, and `NaiveDateTime` only has `u32` fields, there's a potential
hazard if `NaiveDateTime` ever grows unsendable fields (unlikely as that
is).

This (and the `Copy` impl) were added 9 years ago to fix chronotope#25, which
stemmed from early versions of associate traits not working properly
with auto-traits. This has since been fixed, and is no longer necessary
with the MSRV 1.61.0.
Copy link
Contributor

@djc djc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks!

@djc djc merged commit e79fe21 into chronotope:main Mar 7, 2024
35 checks passed
@@ -1866,3 +1866,12 @@ fn nano_roundrip() {
assert_eq!(nanos, nanos2);
}
}

#[test]
fn test_datetime_utc_is_copy_and_send() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have the same test ca. 600 lines above.

@djc djc mentioned this pull request Mar 7, 2024
@djc
Copy link
Contributor

djc commented Mar 7, 2024

Removing the duplicate test in #1494.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UTC Offset is not Send (cannot send DateTime across mps::channel)
3 participants