diff --git a/src/fcntl.rs b/src/fcntl.rs index 785096e7fa..2e2d8aa212 100644 --- a/src/fcntl.rs +++ b/src/fcntl.rs @@ -19,7 +19,7 @@ mod ffi { use libc::{c_int, c_short, off_t, pid_t}; #[repr(C)] - #[derive(Copy)] + #[derive(Clone, Copy)] pub struct flock { pub l_type: c_short, pub l_whence: c_short, @@ -47,7 +47,7 @@ mod ffi { use libc::{c_int, c_short, off_t, pid_t}; #[repr(C)] - #[derive(Copy)] + #[derive(Clone, Copy)] pub struct flock { pub l_start: off_t, pub l_len: off_t, diff --git a/src/sched.rs b/src/sched.rs index 4b6c955f88..c1746f2e1b 100644 --- a/src/sched.rs +++ b/src/sched.rs @@ -89,7 +89,7 @@ pub type CpuMask = c_ulong; // Structure representing the CPU set to apply #[repr(C)] -#[derive(Copy)] +#[derive(Clone, Copy)] pub struct CpuSet { cpu_mask: [CpuMask; cpuset_attribs::CPU_SETSIZE/cpuset_attribs::CPU_MASK_BITS] } diff --git a/src/sys/epoll.rs b/src/sys/epoll.rs index a68a7b6f8f..1028af78f6 100644 --- a/src/sys/epoll.rs +++ b/src/sys/epoll.rs @@ -70,7 +70,7 @@ impl fmt::Debug for EpollEventKind { } } -#[derive(Copy)] +#[derive(Clone, Copy)] #[repr(C)] pub enum EpollOp { EpollCtlAdd = 1, @@ -94,7 +94,7 @@ fn test_epoll_event_size() { } #[cfg(any(not(target_os = "android"), target_arch = "x86_64"))] -#[derive(Copy)] +#[derive(Clone, Copy)] #[repr(C, packed)] pub struct EpollEvent { pub events: EpollEventKind, diff --git a/src/sys/event.rs b/src/sys/event.rs index 9a0ede1e0d..c2c65dad21 100644 --- a/src/sys/event.rs +++ b/src/sys/event.rs @@ -13,7 +13,7 @@ mod ffi { pub use libc::{c_int, c_void, uintptr_t, intptr_t, timespec}; use super::{EventFilter, EventFlag, FilterFlag}; - #[derive(Copy)] + #[derive(Clone, Copy)] #[repr(C)] pub struct kevent { pub ident: uintptr_t, // 8 @@ -40,7 +40,7 @@ mod ffi { } #[repr(i16)] -#[derive(Copy, Debug, PartialEq)] +#[derive(Clone, Copy, Debug, PartialEq)] pub enum EventFilter { EVFILT_READ = -1, EVFILT_WRITE = -2, diff --git a/src/sys/ioctl.rs b/src/sys/ioctl.rs index 5003a4f682..18b8b1abe4 100644 --- a/src/sys/ioctl.rs +++ b/src/sys/ioctl.rs @@ -8,7 +8,7 @@ pub use self::IoctlArg::*; mod ffi { use libc::c_ushort; - #[derive(Copy, Debug)] + #[derive(Clone, Copy, Debug)] pub struct Winsize { pub ws_row: c_ushort, pub ws_col: c_ushort, diff --git a/src/sys/signal.rs b/src/sys/signal.rs index 5dd974cc02..afeb9c6cb5 100644 --- a/src/sys/signal.rs +++ b/src/sys/signal.rs @@ -96,7 +96,7 @@ pub mod signal { // actually a giant union. Currently we're only interested in these fields, // however. #[repr(C)] - #[derive(Copy)] + #[derive(Clone, Copy)] pub struct siginfo { si_signo: libc::c_int, si_errno: libc::c_int, @@ -117,14 +117,14 @@ pub mod signal { #[repr(C)] #[cfg(target_pointer_width = "32")] - #[derive(Copy)] + #[derive(Clone, Copy)] pub struct sigset_t { __val: [libc::c_ulong; 32], } #[repr(C)] #[cfg(target_pointer_width = "64")] - #[derive(Copy)] + #[derive(Clone, Copy)] pub struct sigset_t { __val: [libc::c_ulong; 16], } @@ -249,7 +249,7 @@ pub mod signal { // This structure has more fields, but we're not all that interested in // them. #[repr(C)] - #[derive(Copy)] + #[derive(Clone, Copy)] pub struct siginfo { pub si_signo: libc::c_int, pub si_errno: libc::c_int, @@ -297,7 +297,7 @@ mod ffi { } } -#[derive(Copy)] +#[derive(Clone, Copy)] pub struct SigSet { sigset: sigset_t } diff --git a/src/sys/socket/addr.rs b/src/sys/socket/addr.rs index 34028246bd..1ae5a9c3e1 100644 --- a/src/sys/socket/addr.rs +++ b/src/sys/socket/addr.rs @@ -275,7 +275,7 @@ impl fmt::Display for Ipv4Addr { * */ -#[derive(Copy)] +#[derive(Clone, Copy)] pub struct Ipv6Addr(pub libc::in6_addr); impl Ipv6Addr { diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index 707a2a5999..ea5c99167f 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -57,7 +57,7 @@ pub struct sockaddr_storage { pub __ss_pad2: [u8; 120], } -#[derive(Copy, PartialEq, Eq, Debug, FromPrimitive)] +#[derive(Clone, Copy, PartialEq, Eq, Debug, FromPrimitive)] #[repr(i32)] pub enum SockType { Stream = consts::SOCK_STREAM, @@ -248,7 +248,7 @@ pub fn sendto(fd: RawFd, buf: &[u8], addr: &SockAddr, flags: SockMessageFlags) - } #[repr(C)] -#[derive(Copy, Debug)] +#[derive(Clone, Copy, Debug)] pub struct linger { pub l_onoff: c_int, pub l_linger: c_int diff --git a/src/sys/socket/multicast.rs b/src/sys/socket/multicast.rs index f40de76240..1efac40c11 100644 --- a/src/sys/socket/multicast.rs +++ b/src/sys/socket/multicast.rs @@ -3,7 +3,7 @@ use libc::in_addr; use std::fmt; #[repr(C)] -#[derive(Copy)] +#[derive(Clone, Copy)] pub struct ip_mreq { pub imr_multiaddr: in_addr, pub imr_interface: in_addr, diff --git a/src/sys/socket/sockopt.rs b/src/sys/socket/sockopt.rs index 0f6e5adcf5..dc93f08513 100644 --- a/src/sys/socket/sockopt.rs +++ b/src/sys/socket/sockopt.rs @@ -22,7 +22,7 @@ macro_rules! sockopt_impl { }; ($name:ident, $flag:path, $get_ty:ty, $getter:ty, $set_ty:ty, $setter:ty) => { - #[derive(Copy, Debug)] + #[derive(Clone, Copy, Debug)] pub struct $name; impl<'a> SockOpt for $name { diff --git a/src/sys/termios.rs b/src/sys/termios.rs index c5758fe090..57612f0bf6 100644 --- a/src/sys/termios.rs +++ b/src/sys/termios.rs @@ -98,7 +98,7 @@ mod ffi { pub type speed_t = c_ulong; #[repr(C)] - #[derive(Copy)] + #[derive(Clone, Copy)] pub struct Termios { pub c_iflag: InputFlags, pub c_oflag: OutputFlags, @@ -224,7 +224,7 @@ mod ffi { // XXX: We're using `repr(C)` because `c_int` doesn't work here. // See https://github.com/rust-lang/rust/issues/10374. - #[derive(Copy)] + #[derive(Clone, Copy)] #[repr(C)] pub enum SetArg { TCSANOW = 0, @@ -235,7 +235,7 @@ mod ffi { // XXX: We're using `repr(C)` because `c_int` doesn't work here. // See https://github.com/rust-lang/rust/issues/10374. - #[derive(Copy)] + #[derive(Clone, Copy)] #[repr(C)] pub enum FlushArg { TCIFLUSH = 1, @@ -245,7 +245,7 @@ mod ffi { // XXX: We're using `repr(C)` because `c_int` doesn't work here. // See https://github.com/rust-lang/rust/issues/10374. - #[derive(Copy)] + #[derive(Clone, Copy)] #[repr(C)] pub enum FlowArg { TCOOFF = 1, @@ -264,7 +264,7 @@ mod ffi { pub type speed_t = c_uint; #[repr(C)] - #[derive(Copy)] + #[derive(Clone, Copy)] pub struct Termios { pub c_iflag: InputFlags, pub c_oflag: OutputFlags, @@ -378,7 +378,7 @@ mod ffi { // XXX: We're using `repr(C)` because `c_int` doesn't work here. // See https://github.com/rust-lang/rust/issues/10374. - #[derive(Copy)] + #[derive(Clone, Copy)] #[repr(C)] pub enum SetArg { TCSANOW = 0, @@ -388,7 +388,7 @@ mod ffi { // XXX: We're using `repr(C)` because `c_int` doesn't work here. // See https://github.com/rust-lang/rust/issues/10374. - #[derive(Copy)] + #[derive(Clone, Copy)] #[repr(C)] pub enum FlushArg { TCIFLUSH = 0, @@ -398,7 +398,7 @@ mod ffi { // XXX: We're using `repr(C)` because `c_int` doesn't work here. // See https://github.com/rust-lang/rust/issues/10374. - #[derive(Copy)] + #[derive(Clone, Copy)] #[repr(C)] pub enum FlowArg { TCOOFF = 0, diff --git a/src/sys/utsname.rs b/src/sys/utsname.rs index 69683bf6e9..2eb820f305 100644 --- a/src/sys/utsname.rs +++ b/src/sys/utsname.rs @@ -16,7 +16,7 @@ mod ffi { const UTSNAME_LEN: usize = 65; #[repr(C)] -#[derive(Copy)] +#[derive(Clone, Copy)] pub struct UtsName { sysname: [c_char; UTSNAME_LEN], nodename: [c_char; UTSNAME_LEN], diff --git a/src/sys/wait.rs b/src/sys/wait.rs index 6772dd900b..a6bccd8a87 100644 --- a/src/sys/wait.rs +++ b/src/sys/wait.rs @@ -16,7 +16,7 @@ bitflags!( } ); -#[derive(Copy)] +#[derive(Clone, Copy)] pub enum WaitStatus { Exited(pid_t), StillAlive diff --git a/src/unistd.rs b/src/unistd.rs index 9df6cd766e..64203f0226 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -44,7 +44,7 @@ mod ffi { } } -#[derive(Copy)] +#[derive(Clone, Copy)] pub enum Fork { Parent(pid_t), Child diff --git a/test/test.rs b/test/test.rs index 7e30fb1931..be1e0ad883 100644 --- a/test/test.rs +++ b/test/test.rs @@ -1,5 +1,3 @@ -#![feature(convert, io_ext)] - extern crate nix; extern crate libc; extern crate rand;