mirror of
https://github.com/openharmony/third_party_rust_rustix.git
synced 2026-07-21 02:05:28 -04:00
Fix the custom definition of Timespec to implement Copy. (#484)
This commit is contained in:
@@ -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,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 {
|
||||
|
||||
Reference in New Issue
Block a user