Skip to content

Commit f368458

Browse files
committed
Check for Copy impls for all types
1 parent fa9cb78 commit f368458

File tree

18 files changed

+124
-0
lines changed

18 files changed

+124
-0
lines changed

src/cloudabi/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,16 @@ pub const SOCK_STREAM: ::c_int = 130;
124124

125125
#[cfg_attr(feature = "extra_traits", derive(Debug))]
126126
pub enum FILE {}
127+
impl ::dox::Copy for FILE {}
128+
impl ::dox::Clone for FILE {
129+
fn clone(&self) -> FILE { *self }
130+
}
127131
#[cfg_attr(feature = "extra_traits", derive(Debug))]
128132
pub enum fpos_t {} // TODO: fill this out with a struct
133+
impl ::dox::Copy for fpos_t {}
134+
impl ::dox::Clone for fpos_t {
135+
fn clone(&self) -> fpos_t { *self }
136+
}
129137

130138
extern {
131139
pub fn isalnum(c: c_int) -> c_int;
@@ -315,6 +323,7 @@ cfg_if! {
315323
// enable more optimization opportunities around it recognizing things
316324
// like malloc/free.
317325
#[repr(u8)]
326+
#[allow(missing_copy_implementations)]
318327
pub enum c_void {
319328
// Two dummy variants so the #[repr] attribute can be used.
320329
#[doc(hidden)]

src/fuchsia/mod.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,28 @@ pub type c_ulong = u64;
102102
// Presumably these should be `()` or an `extern type` (when that stabilizes).
103103
#[cfg_attr(feature = "extra_traits", derive(Debug))]
104104
pub enum timezone {}
105+
impl ::dox::Copy for timezone {}
106+
impl ::dox::Clone for timezone {
107+
fn clone(&self) -> timezone { *self }
108+
}
105109
#[cfg_attr(feature = "extra_traits", derive(Debug))]
106110
pub enum DIR {}
111+
impl ::dox::Copy for DIR {}
112+
impl ::dox::Clone for DIR {
113+
fn clone(&self) -> DIR { *self }
114+
}
107115
#[cfg_attr(feature = "extra_traits", derive(Debug))]
108116
pub enum locale_t {}
117+
impl ::dox::Copy for locale_t {}
118+
impl ::dox::Clone for locale_t {
119+
fn clone(&self) -> locale_t { *self }
120+
}
109121
#[cfg_attr(feature = "extra_traits", derive(Debug))]
110122
pub enum fpos64_t {} // TODO: fill this out with a struct
123+
impl ::dox::Copy for fpos64_t {}
124+
impl ::dox::Clone for fpos64_t {
125+
fn clone(&self) -> fpos64_t { *self }
126+
}
111127

112128
// PUB_STRUCT
113129

@@ -3048,8 +3064,16 @@ extern {}
30483064

30493065
#[cfg_attr(feature = "extra_traits", derive(Debug))]
30503066
pub enum FILE {}
3067+
impl ::dox::Copy for FILE {}
3068+
impl ::dox::Clone for FILE {
3069+
fn clone(&self) -> FILE { *self }
3070+
}
30513071
#[cfg_attr(feature = "extra_traits", derive(Debug))]
30523072
pub enum fpos_t {} // TODO: fill this out with a struct
3073+
impl ::dox::Copy for fpos_t {}
3074+
impl ::dox::Clone for fpos_t {
3075+
fn clone(&self) -> fpos_t { *self }
3076+
}
30533077

30543078
extern {
30553079
pub fn isalnum(c: c_int) -> c_int;
@@ -4103,6 +4127,7 @@ cfg_if! {
41034127
// enable more optimization opportunities around it recognizing things
41044128
// like malloc/free.
41054129
#[repr(u8)]
4130+
#[allow(missing_copy_implementations)]
41064131
pub enum c_void {
41074132
// Two dummy variants so the #[repr] attribute can be used.
41084133
#[doc(hidden)]

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@
158158
#![cfg_attr(not(any(feature = "use_std", feature = "rustc-dep-of-std")), no_std)]
159159
// Enable lints
160160
#![cfg_attr(feature = "extra_traits", deny(missing_debug_implementations))]
161+
#![deny(missing_copy_implementations)]
161162

162163
#[cfg(all(not(cross_platform_docs), feature = "use_std"))]
163164
extern crate std as core;

src/redox/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,16 @@ pub const SIGSYS: ::c_int = 31;
221221

222222
#[cfg_attr(feature = "extra_traits", derive(Debug))]
223223
pub enum FILE {}
224+
impl ::dox::Copy for FILE {}
225+
impl ::dox::Clone for FILE {
226+
fn clone(&self) -> FILE { *self }
227+
}
224228
#[cfg_attr(feature = "extra_traits", derive(Debug))]
225229
pub enum fpos_t {} // TODO: fill this out with a struct
230+
impl ::dox::Copy for fpos_t {}
231+
impl ::dox::Clone for fpos_t {
232+
fn clone(&self) -> fpos_t { *self }
233+
}
226234

227235
// intentionally not public, only used for fd_set
228236
cfg_if! {
@@ -385,6 +393,7 @@ cfg_if! {
385393
// enable more optimization opportunities around it recognizing things
386394
// like malloc/free.
387395
#[repr(u8)]
396+
#[allow(missing_copy_implementations)]
388397
pub enum c_void {
389398
// Two dummy variants so the #[repr] attribute can be used.
390399
#[doc(hidden)]

src/sgx.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ cfg_if! {
4343
// enable more optimization opportunities around it recognizing things
4444
// like malloc/free.
4545
#[repr(u8)]
46+
#[allow(missing_copy_implementations)]
4647
pub enum c_void {
4748
// Two dummy variants so the #[repr] attribute can be used.
4849
#[doc(hidden)]

src/switch.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ cfg_if! {
4545
// enable more optimization opportunities around it recognizing things
4646
// like malloc/free.
4747
#[repr(u8)]
48+
#[allow(missing_copy_implementations)]
4849
pub enum c_void {
4950
// Two dummy variants so the #[repr] attribute can be used.
5051
#[doc(hidden)]

src/unix/bsd/apple/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ pub type shmatt_t = ::c_ushort;
3636

3737
#[cfg_attr(feature = "extra_traits", derive(Debug))]
3838
pub enum timezone {}
39+
impl ::dox::Copy for timezone {}
40+
impl ::dox::Clone for timezone {
41+
fn clone(&self) -> timezone { *self }
42+
}
3943

4044
s! {
4145
pub struct aiocb {

src/unix/bsd/freebsdlike/dragonfly/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ pub type sem_t = *mut sem;
1919

2020
#[cfg_attr(feature = "extra_traits", derive(Debug))]
2121
pub enum sem {}
22+
impl ::dox::Copy for sem {}
23+
impl ::dox::Clone for sem {
24+
fn clone(&self) -> sem { *self }
25+
}
2226

2327
s! {
2428

src/unix/bsd/freebsdlike/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ pub type id_t = i64;
1818

1919
#[cfg_attr(feature = "extra_traits", derive(Debug))]
2020
pub enum timezone {}
21+
impl ::dox::Copy for timezone {}
22+
impl ::dox::Clone for timezone {
23+
fn clone(&self) -> timezone { *self }
24+
}
2125

2226
s! {
2327
pub struct glob_t {

src/unix/bsd/netbsdlike/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,16 @@ pub type sem_t = *mut sem;
1515

1616
#[cfg_attr(feature = "extra_traits", derive(Debug))]
1717
pub enum timezone {}
18+
impl ::dox::Copy for timezone {}
19+
impl ::dox::Clone for timezone {
20+
fn clone(&self) -> timezone { *self }
21+
}
1822
#[cfg_attr(feature = "extra_traits", derive(Debug))]
1923
pub enum sem {}
24+
impl ::dox::Copy for sem {}
25+
impl ::dox::Clone for sem {
26+
fn clone(&self) -> sem { *self }
27+
}
2028

2129
s! {
2230
pub struct sigaction {

src/unix/haiku/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ pub type idtype_t = ::c_uint;
3333

3434
#[cfg_attr(feature = "extra_traits", derive(Debug))]
3535
pub enum timezone {}
36+
impl ::dox::Copy for timezone {}
37+
impl ::dox::Clone for timezone {
38+
fn clone(&self) -> timezone { *self }
39+
}
3640

3741
s! {
3842
pub struct sockaddr {

src/unix/mod.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,16 @@ pub type cc_t = ::c_uchar;
4343

4444
#[cfg_attr(feature = "extra_traits", derive(Debug))]
4545
pub enum DIR {}
46+
impl ::dox::Copy for DIR {}
47+
impl ::dox::Clone for DIR {
48+
fn clone(&self) -> DIR { *self }
49+
}
4650
#[cfg_attr(feature = "extra_traits", derive(Debug))]
4751
pub enum locale_t {}
52+
impl ::dox::Copy for locale_t {}
53+
impl ::dox::Clone for locale_t {
54+
fn clone(&self) -> locale_t { *self }
55+
}
4856

4957
s! {
5058
pub struct group {
@@ -369,8 +377,16 @@ cfg_if! {
369377

370378
#[cfg_attr(feature = "extra_traits", derive(Debug))]
371379
pub enum FILE {}
380+
impl ::dox::Copy for FILE {}
381+
impl ::dox::Clone for FILE {
382+
fn clone(&self) -> FILE { *self }
383+
}
372384
#[cfg_attr(feature = "extra_traits", derive(Debug))]
373385
pub enum fpos_t {} // TODO: fill this out with a struct
386+
impl ::dox::Copy for fpos_t {}
387+
impl ::dox::Clone for fpos_t {
388+
fn clone(&self) -> fpos_t { *self }
389+
}
374390

375391
extern {
376392
pub fn isalnum(c: c_int) -> c_int;
@@ -1160,6 +1176,7 @@ cfg_if! {
11601176
// enable more optimization opportunities around it recognizing things
11611177
// like malloc/free.
11621178
#[repr(u8)]
1179+
#[allow(missing_copy_implementations)]
11631180
pub enum c_void {
11641181
// Two dummy variants so the #[repr] attribute can be used.
11651182
#[doc(hidden)]

src/unix/notbsd/emscripten.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ pub type nlink_t = u32;
3737

3838
#[cfg_attr(feature = "extra_traits", derive(Debug))]
3939
pub enum fpos64_t {} // TODO: fill this out with a struct
40+
impl ::dox::Copy for fpos64_t {}
41+
impl ::dox::Clone for fpos64_t {
42+
fn clone(&self) -> fpos64_t { *self }
43+
}
4044

4145
s! {
4246
pub struct dirent {

src/unix/notbsd/linux/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ pub type Elf64_Section = u16;
4040

4141
#[cfg_attr(feature = "extra_traits", derive(Debug))]
4242
pub enum fpos64_t {} // TODO: fill this out with a struct
43+
impl ::dox::Copy for fpos64_t {}
44+
impl ::dox::Clone for fpos64_t {
45+
fn clone(&self) -> fpos64_t { *self }
46+
}
4347

4448
s! {
4549
pub struct rlimit64 {

src/unix/notbsd/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ pub type id_t = ::c_uint;
1010

1111
#[cfg_attr(feature = "extra_traits", derive(Debug))]
1212
pub enum timezone {}
13+
impl ::dox::Copy for timezone {}
14+
impl ::dox::Clone for timezone {
15+
fn clone(&self) -> timezone { *self }
16+
}
1317

1418
s! {
1519
pub struct sockaddr {

src/unix/solaris/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ pub type idtype_t = ::c_uint;
3838

3939
#[cfg_attr(feature = "extra_traits", derive(Debug))]
4040
pub enum timezone {}
41+
impl ::dox::Copy for timezone {}
42+
impl ::dox::Clone for timezone {
43+
fn clone(&self) -> timezone { *self }
44+
}
4145

4246
s! {
4347
pub struct sockaddr {

src/unix/uclibc/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,17 @@ pub type idtype_t = ::c_uint;
2626

2727
#[cfg_attr(feature = "extra_traits", derive(Debug))]
2828
pub enum fpos64_t {} // TODO: fill this out with a struct
29+
impl ::dox::Copy for fpos64_t {}
30+
impl ::dox::Clone for fpos64_t {
31+
fn clone(&self) -> fpos64_t { *self }
32+
}
2933

3034
#[cfg_attr(feature = "extra_traits", derive(Debug))]
3135
pub enum timezone {}
36+
impl ::dox::Copy for timezone {}
37+
impl ::dox::Clone for timezone {
38+
fn clone(&self) -> timezone { *self }
39+
}
3240

3341
s! {
3442
pub struct sockaddr {

src/windows/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ pub type dev_t = u32;
4949
pub type ino_t = u16;
5050
#[cfg_attr(feature = "extra_traits", derive(Debug))]
5151
pub enum timezone {}
52+
impl ::dox::Copy for timezone {}
53+
impl ::dox::Clone for timezone {
54+
fn clone(&self) -> timezone { *self }
55+
}
5256
pub type time64_t = i64;
5357

5458
pub type SOCKET = ::uintptr_t;
@@ -204,8 +208,16 @@ extern {}
204208

205209
#[cfg_attr(feature = "extra_traits", derive(Debug))]
206210
pub enum FILE {}
211+
impl ::dox::Copy for FILE {}
212+
impl ::dox::Clone for FILE {
213+
fn clone(&self) -> FILE { *self }
214+
}
207215
#[cfg_attr(feature = "extra_traits", derive(Debug))]
208216
pub enum fpos_t {} // TODO: fill this out with a struct
217+
impl ::dox::Copy for fpos_t {}
218+
impl ::dox::Clone for fpos_t {
219+
fn clone(&self) -> fpos_t { *self }
220+
}
209221

210222
extern {
211223
pub fn isalnum(c: c_int) -> c_int;
@@ -429,6 +441,7 @@ cfg_if! {
429441
// enable more optimization opportunities around it recognizing things
430442
// like malloc/free.
431443
#[repr(u8)]
444+
#[allow(missing_copy_implementations)]
432445
pub enum c_void {
433446
// Two dummy variants so the #[repr] attribute can be used.
434447
#[doc(hidden)]

0 commit comments

Comments
 (0)