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 {

0 commit comments

Comments
 (0)