Skip to content

Commit

Permalink
'derive(Copy)' needs Clone now
Browse files Browse the repository at this point in the history
  • Loading branch information
fhartwig committed Apr 3, 2015
1 parent 7d48278 commit 628373f
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/fcntl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/sched.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
Expand Down
4 changes: 2 additions & 2 deletions src/sys/epoll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl fmt::Debug for EpollEventKind {
}
}

#[derive(Copy)]
#[derive(Clone, Copy)]
#[repr(C)]
pub enum EpollOp {
EpollCtlAdd = 1,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/sys/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/sys/ioctl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions src/sys/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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],
}
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -297,7 +297,7 @@ mod ffi {
}
}

#[derive(Copy)]
#[derive(Clone, Copy)]
pub struct SigSet {
sigset: sigset_t
}
Expand Down
2 changes: 1 addition & 1 deletion src/sys/socket/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ impl fmt::Display for Ipv4Addr {
*
*/

#[derive(Copy)]
#[derive(Clone, Copy)]
pub struct Ipv6Addr(pub libc::in6_addr);

impl Ipv6Addr {
Expand Down
4 changes: 2 additions & 2 deletions src/sys/socket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/sys/socket/multicast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/sys/socket/sockopt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
16 changes: 8 additions & 8 deletions src/sys/termios.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/sys/utsname.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
2 changes: 1 addition & 1 deletion src/sys/wait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ bitflags!(
}
);

#[derive(Copy)]
#[derive(Clone, Copy)]
pub enum WaitStatus {
Exited(pid_t),
StillAlive
Expand Down
2 changes: 1 addition & 1 deletion src/unistd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ mod ffi {
}
}

#[derive(Copy)]
#[derive(Clone, Copy)]
pub enum Fork {
Parent(pid_t),
Child
Expand Down
2 changes: 0 additions & 2 deletions test/test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(convert, io_ext)]

extern crate nix;
extern crate libc;
extern crate rand;
Expand Down

0 comments on commit 628373f

Please sign in to comment.