diff --git a/src/backend/libc/time/types.rs b/src/backend/libc/time/types.rs index 080f64431..2d17e480c 100644 --- a/src/backend/libc/time/types.rs +++ b/src/backend/libc/time/types.rs @@ -16,7 +16,7 @@ pub type Timespec = c::timespec; any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), target_env = "gnu", ))] -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Copy)] #[repr(C)] pub struct Timespec { /// Seconds. diff --git a/tests/time/timespec.rs b/tests/time/timespec.rs index 6d892dcfe..f889204a8 100644 --- a/tests/time/timespec.rs +++ b/tests/time/timespec.rs @@ -6,7 +6,12 @@ fn test_timespec_layout() { let tv_sec: Secs = 0; let tv_nsec: Nsecs = 0; - let _ = Timespec { tv_sec, tv_nsec }; + let x = Timespec { tv_sec, tv_nsec }; + + // Test that `Timespec` implements `Copy` and `Debug`. + let _y = Timespec { tv_sec, tv_nsec }; + let _z = Timespec { tv_sec, tv_nsec }; + dbg!(&x); #[cfg(not(target_os = "redox"))] let _ = Timespec {