Skip to content

Commit 628373f

Browse files
committed
'derive(Copy)' needs Clone now
1 parent 7d48278 commit 628373f

15 files changed

+29
-31
lines changed

src/fcntl.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ mod ffi {
1919
use libc::{c_int, c_short, off_t, pid_t};
2020

2121
#[repr(C)]
22-
#[derive(Copy)]
22+
#[derive(Clone, Copy)]
2323
pub struct flock {
2424
pub l_type: c_short,
2525
pub l_whence: c_short,
@@ -47,7 +47,7 @@ mod ffi {
4747
use libc::{c_int, c_short, off_t, pid_t};
4848

4949
#[repr(C)]
50-
#[derive(Copy)]
50+
#[derive(Clone, Copy)]
5151
pub struct flock {
5252
pub l_start: off_t,
5353
pub l_len: off_t,

src/sched.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub type CpuMask = c_ulong;
8989

9090
// Structure representing the CPU set to apply
9191
#[repr(C)]
92-
#[derive(Copy)]
92+
#[derive(Clone, Copy)]
9393
pub struct CpuSet {
9494
cpu_mask: [CpuMask; cpuset_attribs::CPU_SETSIZE/cpuset_attribs::CPU_MASK_BITS]
9595
}

src/sys/epoll.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl fmt::Debug for EpollEventKind {
7070
}
7171
}
7272

73-
#[derive(Copy)]
73+
#[derive(Clone, Copy)]
7474
#[repr(C)]
7575
pub enum EpollOp {
7676
EpollCtlAdd = 1,
@@ -94,7 +94,7 @@ fn test_epoll_event_size() {
9494
}
9595

9696
#[cfg(any(not(target_os = "android"), target_arch = "x86_64"))]
97-
#[derive(Copy)]
97+
#[derive(Clone, Copy)]
9898
#[repr(C, packed)]
9999
pub struct EpollEvent {
100100
pub events: EpollEventKind,

src/sys/event.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ mod ffi {
1313
pub use libc::{c_int, c_void, uintptr_t, intptr_t, timespec};
1414
use super::{EventFilter, EventFlag, FilterFlag};
1515

16-
#[derive(Copy)]
16+
#[derive(Clone, Copy)]
1717
#[repr(C)]
1818
pub struct kevent {
1919
pub ident: uintptr_t, // 8
@@ -40,7 +40,7 @@ mod ffi {
4040
}
4141

4242
#[repr(i16)]
43-
#[derive(Copy, Debug, PartialEq)]
43+
#[derive(Clone, Copy, Debug, PartialEq)]
4444
pub enum EventFilter {
4545
EVFILT_READ = -1,
4646
EVFILT_WRITE = -2,

src/sys/ioctl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub use self::IoctlArg::*;
88
mod ffi {
99
use libc::c_ushort;
1010

11-
#[derive(Copy, Debug)]
11+
#[derive(Clone, Copy, Debug)]
1212
pub struct Winsize {
1313
pub ws_row: c_ushort,
1414
pub ws_col: c_ushort,

src/sys/signal.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub mod signal {
9696
// actually a giant union. Currently we're only interested in these fields,
9797
// however.
9898
#[repr(C)]
99-
#[derive(Copy)]
99+
#[derive(Clone, Copy)]
100100
pub struct siginfo {
101101
si_signo: libc::c_int,
102102
si_errno: libc::c_int,
@@ -117,14 +117,14 @@ pub mod signal {
117117

118118
#[repr(C)]
119119
#[cfg(target_pointer_width = "32")]
120-
#[derive(Copy)]
120+
#[derive(Clone, Copy)]
121121
pub struct sigset_t {
122122
__val: [libc::c_ulong; 32],
123123
}
124124

125125
#[repr(C)]
126126
#[cfg(target_pointer_width = "64")]
127-
#[derive(Copy)]
127+
#[derive(Clone, Copy)]
128128
pub struct sigset_t {
129129
__val: [libc::c_ulong; 16],
130130
}
@@ -249,7 +249,7 @@ pub mod signal {
249249
// This structure has more fields, but we're not all that interested in
250250
// them.
251251
#[repr(C)]
252-
#[derive(Copy)]
252+
#[derive(Clone, Copy)]
253253
pub struct siginfo {
254254
pub si_signo: libc::c_int,
255255
pub si_errno: libc::c_int,
@@ -297,7 +297,7 @@ mod ffi {
297297
}
298298
}
299299

300-
#[derive(Copy)]
300+
#[derive(Clone, Copy)]
301301
pub struct SigSet {
302302
sigset: sigset_t
303303
}

src/sys/socket/addr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ impl fmt::Display for Ipv4Addr {
275275
*
276276
*/
277277

278-
#[derive(Copy)]
278+
#[derive(Clone, Copy)]
279279
pub struct Ipv6Addr(pub libc::in6_addr);
280280

281281
impl Ipv6Addr {

src/sys/socket/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub struct sockaddr_storage {
5757
pub __ss_pad2: [u8; 120],
5858
}
5959

60-
#[derive(Copy, PartialEq, Eq, Debug, FromPrimitive)]
60+
#[derive(Clone, Copy, PartialEq, Eq, Debug, FromPrimitive)]
6161
#[repr(i32)]
6262
pub enum SockType {
6363
Stream = consts::SOCK_STREAM,
@@ -248,7 +248,7 @@ pub fn sendto(fd: RawFd, buf: &[u8], addr: &SockAddr, flags: SockMessageFlags) -
248248
}
249249

250250
#[repr(C)]
251-
#[derive(Copy, Debug)]
251+
#[derive(Clone, Copy, Debug)]
252252
pub struct linger {
253253
pub l_onoff: c_int,
254254
pub l_linger: c_int

src/sys/socket/multicast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use libc::in_addr;
33
use std::fmt;
44

55
#[repr(C)]
6-
#[derive(Copy)]
6+
#[derive(Clone, Copy)]
77
pub struct ip_mreq {
88
pub imr_multiaddr: in_addr,
99
pub imr_interface: in_addr,

src/sys/socket/sockopt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ macro_rules! sockopt_impl {
2222
};
2323

2424
($name:ident, $flag:path, $get_ty:ty, $getter:ty, $set_ty:ty, $setter:ty) => {
25-
#[derive(Copy, Debug)]
25+
#[derive(Clone, Copy, Debug)]
2626
pub struct $name;
2727

2828
impl<'a> SockOpt for $name {

src/sys/termios.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ mod ffi {
9898
pub type speed_t = c_ulong;
9999

100100
#[repr(C)]
101-
#[derive(Copy)]
101+
#[derive(Clone, Copy)]
102102
pub struct Termios {
103103
pub c_iflag: InputFlags,
104104
pub c_oflag: OutputFlags,
@@ -224,7 +224,7 @@ mod ffi {
224224

225225
// XXX: We're using `repr(C)` because `c_int` doesn't work here.
226226
// See https://github.com/rust-lang/rust/issues/10374.
227-
#[derive(Copy)]
227+
#[derive(Clone, Copy)]
228228
#[repr(C)]
229229
pub enum SetArg {
230230
TCSANOW = 0,
@@ -235,7 +235,7 @@ mod ffi {
235235

236236
// XXX: We're using `repr(C)` because `c_int` doesn't work here.
237237
// See https://github.com/rust-lang/rust/issues/10374.
238-
#[derive(Copy)]
238+
#[derive(Clone, Copy)]
239239
#[repr(C)]
240240
pub enum FlushArg {
241241
TCIFLUSH = 1,
@@ -245,7 +245,7 @@ mod ffi {
245245

246246
// XXX: We're using `repr(C)` because `c_int` doesn't work here.
247247
// See https://github.com/rust-lang/rust/issues/10374.
248-
#[derive(Copy)]
248+
#[derive(Clone, Copy)]
249249
#[repr(C)]
250250
pub enum FlowArg {
251251
TCOOFF = 1,
@@ -264,7 +264,7 @@ mod ffi {
264264
pub type speed_t = c_uint;
265265

266266
#[repr(C)]
267-
#[derive(Copy)]
267+
#[derive(Clone, Copy)]
268268
pub struct Termios {
269269
pub c_iflag: InputFlags,
270270
pub c_oflag: OutputFlags,
@@ -378,7 +378,7 @@ mod ffi {
378378

379379
// XXX: We're using `repr(C)` because `c_int` doesn't work here.
380380
// See https://github.com/rust-lang/rust/issues/10374.
381-
#[derive(Copy)]
381+
#[derive(Clone, Copy)]
382382
#[repr(C)]
383383
pub enum SetArg {
384384
TCSANOW = 0,
@@ -388,7 +388,7 @@ mod ffi {
388388

389389
// XXX: We're using `repr(C)` because `c_int` doesn't work here.
390390
// See https://github.com/rust-lang/rust/issues/10374.
391-
#[derive(Copy)]
391+
#[derive(Clone, Copy)]
392392
#[repr(C)]
393393
pub enum FlushArg {
394394
TCIFLUSH = 0,
@@ -398,7 +398,7 @@ mod ffi {
398398

399399
// XXX: We're using `repr(C)` because `c_int` doesn't work here.
400400
// See https://github.com/rust-lang/rust/issues/10374.
401-
#[derive(Copy)]
401+
#[derive(Clone, Copy)]
402402
#[repr(C)]
403403
pub enum FlowArg {
404404
TCOOFF = 0,

src/sys/utsname.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ mod ffi {
1616
const UTSNAME_LEN: usize = 65;
1717

1818
#[repr(C)]
19-
#[derive(Copy)]
19+
#[derive(Clone, Copy)]
2020
pub struct UtsName {
2121
sysname: [c_char; UTSNAME_LEN],
2222
nodename: [c_char; UTSNAME_LEN],

src/sys/wait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ bitflags!(
1616
}
1717
);
1818

19-
#[derive(Copy)]
19+
#[derive(Clone, Copy)]
2020
pub enum WaitStatus {
2121
Exited(pid_t),
2222
StillAlive

src/unistd.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ mod ffi {
4444
}
4545
}
4646

47-
#[derive(Copy)]
47+
#[derive(Clone, Copy)]
4848
pub enum Fork {
4949
Parent(pid_t),
5050
Child

test/test.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(convert, io_ext)]
2-
31
extern crate nix;
42
extern crate libc;
53
extern crate rand;

0 commit comments

Comments
 (0)