Skip to content

Commit

Permalink
Verify bounds at compile time in test_datetime_is_send_and_copy
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Jul 18, 2023
1 parent 7e484fc commit 5255fc9
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions src/datetime/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1148,26 +1148,10 @@ fn test_datetime_format_with_local() {
}

#[test]
#[cfg(feature = "clock")]
fn test_datetime_is_copy() {
// UTC is known to be `Copy`.
let a = Utc::now();
let b = a;
assert_eq!(a, b);
}

#[test]
#[cfg(feature = "clock")]
fn test_datetime_is_send() {
use std::thread;

// UTC is known to be `Send`.
let a = Utc::now();
thread::spawn(move || {
let _ = a;
})
.join()
.unwrap();
fn test_datetime_is_send_and_copy() {
fn _assert_send_copy<T: Send + Copy>() {}
// UTC is known to be `Send + Copy`.
_assert_send_copy::<DateTime<Utc>>();
}

#[test]
Expand Down

0 comments on commit 5255fc9

Please sign in to comment.