Skip to content

Commit

Permalink
Check for Copy impls for all types
Browse files Browse the repository at this point in the history
  • Loading branch information
Susurrus committed Feb 2, 2019
1 parent d5dded9 commit cf28b68
Show file tree
Hide file tree
Showing 18 changed files with 124 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/cloudabi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,16 @@ pub const SOCK_STREAM: ::c_int = 130;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum FILE {}
impl ::dox::Copy for FILE {}
impl ::dox::Clone for FILE {
fn clone(&self) -> FILE { *self }
}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum fpos_t {} // TODO: fill this out with a struct
impl ::dox::Copy for fpos_t {}
impl ::dox::Clone for fpos_t {
fn clone(&self) -> fpos_t { *self }
}

extern {
pub fn isalnum(c: c_int) -> c_int;
Expand Down Expand Up @@ -315,6 +323,7 @@ cfg_if! {
// enable more optimization opportunities around it recognizing things
// like malloc/free.
#[repr(u8)]
#[allow(missing_copy_implementations)]
pub enum c_void {
// Two dummy variants so the #[repr] attribute can be used.
#[doc(hidden)]
Expand Down
25 changes: 25 additions & 0 deletions src/fuchsia/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,28 @@ pub type c_ulong = u64;
// Presumably these should be `()` or an `extern type` (when that stabilizes).
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
impl ::dox::Copy for timezone {}
impl ::dox::Clone for timezone {
fn clone(&self) -> timezone { *self }
}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum DIR {}
impl ::dox::Copy for DIR {}
impl ::dox::Clone for DIR {
fn clone(&self) -> DIR { *self }
}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum locale_t {}
impl ::dox::Copy for locale_t {}
impl ::dox::Clone for locale_t {
fn clone(&self) -> locale_t { *self }
}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum fpos64_t {} // TODO: fill this out with a struct
impl ::dox::Copy for fpos64_t {}
impl ::dox::Clone for fpos64_t {
fn clone(&self) -> fpos64_t { *self }
}

// PUB_STRUCT

Expand Down Expand Up @@ -3048,8 +3064,16 @@ extern {}

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum FILE {}
impl ::dox::Copy for FILE {}
impl ::dox::Clone for FILE {
fn clone(&self) -> FILE { *self }
}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum fpos_t {} // TODO: fill this out with a struct
impl ::dox::Copy for fpos_t {}
impl ::dox::Clone for fpos_t {
fn clone(&self) -> fpos_t { *self }
}

extern {
pub fn isalnum(c: c_int) -> c_int;
Expand Down Expand Up @@ -4103,6 +4127,7 @@ cfg_if! {
// enable more optimization opportunities around it recognizing things
// like malloc/free.
#[repr(u8)]
#[allow(missing_copy_implementations)]
pub enum c_void {
// Two dummy variants so the #[repr] attribute can be used.
#[doc(hidden)]
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
#![cfg_attr(not(any(feature = "use_std", feature = "rustc-dep-of-std")), no_std)]
// Enable lints
#![cfg_attr(feature = "extra_traits", deny(missing_debug_implementations))]
#![deny(missing_copy_implementations)]

#[cfg(all(not(cross_platform_docs), feature = "use_std"))]
extern crate std as core;
Expand Down
9 changes: 9 additions & 0 deletions src/redox/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,16 @@ pub const SIGSYS: ::c_int = 31;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum FILE {}
impl ::dox::Copy for FILE {}
impl ::dox::Clone for FILE {
fn clone(&self) -> FILE { *self }
}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum fpos_t {} // TODO: fill this out with a struct
impl ::dox::Copy for fpos_t {}
impl ::dox::Clone for fpos_t {
fn clone(&self) -> fpos_t { *self }
}

// intentionally not public, only used for fd_set
cfg_if! {
Expand Down Expand Up @@ -385,6 +393,7 @@ cfg_if! {
// enable more optimization opportunities around it recognizing things
// like malloc/free.
#[repr(u8)]
#[allow(missing_copy_implementations)]
pub enum c_void {
// Two dummy variants so the #[repr] attribute can be used.
#[doc(hidden)]
Expand Down
1 change: 1 addition & 0 deletions src/sgx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ cfg_if! {
// enable more optimization opportunities around it recognizing things
// like malloc/free.
#[repr(u8)]
#[allow(missing_copy_implementations)]
pub enum c_void {
// Two dummy variants so the #[repr] attribute can be used.
#[doc(hidden)]
Expand Down
1 change: 1 addition & 0 deletions src/switch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ cfg_if! {
// enable more optimization opportunities around it recognizing things
// like malloc/free.
#[repr(u8)]
#[allow(missing_copy_implementations)]
pub enum c_void {
// Two dummy variants so the #[repr] attribute can be used.
#[doc(hidden)]
Expand Down
4 changes: 4 additions & 0 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ pub type shmatt_t = ::c_ushort;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
impl ::dox::Copy for timezone {}
impl ::dox::Clone for timezone {
fn clone(&self) -> timezone { *self }
}

s! {
pub struct aiocb {
Expand Down
4 changes: 4 additions & 0 deletions src/unix/bsd/freebsdlike/dragonfly/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ pub type sem_t = *mut sem;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum sem {}
impl ::dox::Copy for sem {}
impl ::dox::Clone for sem {
fn clone(&self) -> sem { *self }
}

s! {

Expand Down
4 changes: 4 additions & 0 deletions src/unix/bsd/freebsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ pub type id_t = i64;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
impl ::dox::Copy for timezone {}
impl ::dox::Clone for timezone {
fn clone(&self) -> timezone { *self }
}

s! {
pub struct glob_t {
Expand Down
8 changes: 8 additions & 0 deletions src/unix/bsd/netbsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,16 @@ pub type sem_t = *mut sem;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
impl ::dox::Copy for timezone {}
impl ::dox::Clone for timezone {
fn clone(&self) -> timezone { *self }
}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum sem {}
impl ::dox::Copy for sem {}
impl ::dox::Clone for sem {
fn clone(&self) -> sem { *self }
}

s! {
pub struct sigaction {
Expand Down
4 changes: 4 additions & 0 deletions src/unix/haiku/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ pub type idtype_t = ::c_uint;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
impl ::dox::Copy for timezone {}
impl ::dox::Clone for timezone {
fn clone(&self) -> timezone { *self }
}

s! {
pub struct sockaddr {
Expand Down
17 changes: 17 additions & 0 deletions src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,16 @@ pub type cc_t = ::c_uchar;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum DIR {}
impl ::dox::Copy for DIR {}
impl ::dox::Clone for DIR {
fn clone(&self) -> DIR { *self }
}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum locale_t {}
impl ::dox::Copy for locale_t {}
impl ::dox::Clone for locale_t {
fn clone(&self) -> locale_t { *self }
}

s! {
pub struct group {
Expand Down Expand Up @@ -369,8 +377,16 @@ cfg_if! {

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum FILE {}
impl ::dox::Copy for FILE {}
impl ::dox::Clone for FILE {
fn clone(&self) -> FILE { *self }
}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum fpos_t {} // TODO: fill this out with a struct
impl ::dox::Copy for fpos_t {}
impl ::dox::Clone for fpos_t {
fn clone(&self) -> fpos_t { *self }
}

extern {
pub fn isalnum(c: c_int) -> c_int;
Expand Down Expand Up @@ -1160,6 +1176,7 @@ cfg_if! {
// enable more optimization opportunities around it recognizing things
// like malloc/free.
#[repr(u8)]
#[allow(missing_copy_implementations)]
pub enum c_void {
// Two dummy variants so the #[repr] attribute can be used.
#[doc(hidden)]
Expand Down
4 changes: 4 additions & 0 deletions src/unix/notbsd/emscripten.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ pub type nlink_t = u32;

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

s! {
pub struct dirent {
Expand Down
4 changes: 4 additions & 0 deletions src/unix/notbsd/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ pub type Elf64_Section = u16;

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

s! {
pub struct rlimit64 {
Expand Down
4 changes: 4 additions & 0 deletions src/unix/notbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ pub type id_t = ::c_uint;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
impl ::dox::Copy for timezone {}
impl ::dox::Clone for timezone {
fn clone(&self) -> timezone { *self }
}

s! {
pub struct sockaddr {
Expand Down
4 changes: 4 additions & 0 deletions src/unix/solaris/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ pub type idtype_t = ::c_uint;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
impl ::dox::Copy for timezone {}
impl ::dox::Clone for timezone {
fn clone(&self) -> timezone { *self }
}

s! {
pub struct sockaddr {
Expand Down
8 changes: 8 additions & 0 deletions src/unix/uclibc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,17 @@ pub type idtype_t = ::c_uint;

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

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
impl ::dox::Copy for timezone {}
impl ::dox::Clone for timezone {
fn clone(&self) -> timezone { *self }
}

s! {
pub struct sockaddr {
Expand Down
13 changes: 13 additions & 0 deletions src/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ pub type dev_t = u32;
pub type ino_t = u16;
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
impl ::dox::Copy for timezone {}
impl ::dox::Clone for timezone {
fn clone(&self) -> timezone { *self }
}
pub type time64_t = i64;

pub type SOCKET = ::uintptr_t;
Expand Down Expand Up @@ -204,8 +208,16 @@ extern {}

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum FILE {}
impl ::dox::Copy for FILE {}
impl ::dox::Clone for FILE {
fn clone(&self) -> FILE { *self }
}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum fpos_t {} // TODO: fill this out with a struct
impl ::dox::Copy for fpos_t {}
impl ::dox::Clone for fpos_t {
fn clone(&self) -> fpos_t { *self }
}

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

0 comments on commit cf28b68

Please sign in to comment.