diff --git a/src/cloudabi/mod.rs b/src/cloudabi/mod.rs index 520ed8deee437..51859cb40b127 100644 --- a/src/cloudabi/mod.rs +++ b/src/cloudabi/mod.rs @@ -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; @@ -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)] diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index 351ec7e37d801..ba20979a748a3 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -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 @@ -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; @@ -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)] diff --git a/src/lib.rs b/src/lib.rs index 86ab9b1368ace..2300e823e9672 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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; diff --git a/src/redox/mod.rs b/src/redox/mod.rs index cfe7fd613b027..82782bc16404e 100644 --- a/src/redox/mod.rs +++ b/src/redox/mod.rs @@ -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! { @@ -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)] diff --git a/src/sgx.rs b/src/sgx.rs index 045133399b94e..1d5ca21292e9f 100644 --- a/src/sgx.rs +++ b/src/sgx.rs @@ -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)] diff --git a/src/switch.rs b/src/switch.rs index e2d9b491cb762..89e259ea27ca2 100644 --- a/src/switch.rs +++ b/src/switch.rs @@ -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)] diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index bb48d22709f91..59394c6bcaf1b 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -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 { diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs index 75afeb28fd57b..ebbebc457c779 100644 --- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -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! { diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index a402269a4785f..304bdeb5435ae 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -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 { diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs index dfe20518363ec..764174d18ab7b 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -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 { diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs index a7fdffdc42daf..94d8039006d2a 100644 --- a/src/unix/haiku/mod.rs +++ b/src/unix/haiku/mod.rs @@ -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 { diff --git a/src/unix/mod.rs b/src/unix/mod.rs index bcd16f83ef608..409f2835fd04d 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -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 { @@ -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; @@ -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)] diff --git a/src/unix/notbsd/emscripten.rs b/src/unix/notbsd/emscripten.rs index 069631c1ff883..9bf2026b22e4d 100644 --- a/src/unix/notbsd/emscripten.rs +++ b/src/unix/notbsd/emscripten.rs @@ -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 { diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs index 3150887ab0dad..443e7d5ccdddb 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -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 { diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs index 7913508455523..51414e688d73d 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -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 { diff --git a/src/unix/solaris/mod.rs b/src/unix/solaris/mod.rs index c10f4c1844669..c9a53e1f57737 100644 --- a/src/unix/solaris/mod.rs +++ b/src/unix/solaris/mod.rs @@ -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 { diff --git a/src/unix/uclibc/mod.rs b/src/unix/uclibc/mod.rs index e0620048dca63..bb314196af608 100644 --- a/src/unix/uclibc/mod.rs +++ b/src/unix/uclibc/mod.rs @@ -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 { diff --git a/src/windows/mod.rs b/src/windows/mod.rs index 9deaf9b995293..25a381ae72d27 100644 --- a/src/windows/mod.rs +++ b/src/windows/mod.rs @@ -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; @@ -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; @@ -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)]