Fix the custom definition of Timespec to implement Copy. (#484)

This commit is contained in:
Dan Gohman
2022-12-13 10:25:25 -08:00
committed by GitHub
parent df796361cf
commit 52fc789fbc
2 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -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.
+6 -1
View File
@@ -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 {