diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2014-12-05 17:01:33 -0800 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2014-12-08 13:47:44 -0500 |
| commit | 096a28607fb80c91e6e2ca64d9ef44c4e550e96c (patch) | |
| tree | 82c4ee8f20df133305959d507ec76adb4db5e324 /src/liblibc | |
| parent | c7a9b49d1b5d4e520f25355f26a93dfac4ffa146 (diff) | |
| download | rust-096a28607fb80c91e6e2ca64d9ef44c4e550e96c.tar.gz rust-096a28607fb80c91e6e2ca64d9ef44c4e550e96c.zip | |
librustc: Make `Copy` opt-in.
This change makes the compiler no longer infer whether types (structures
and enumerations) implement the `Copy` trait (and thus are implicitly
copyable). Rather, you must implement `Copy` yourself via `impl Copy for
MyType {}`.
A new warning has been added, `missing_copy_implementations`, to warn
you if a non-generic public type has been added that could have
implemented `Copy` but didn't.
For convenience, you may *temporarily* opt out of this behavior by using
`#![feature(opt_out_copy)]`. Note though that this feature gate will never be
accepted and will be removed by the time that 1.0 is released, so you should
transition your code away from using it.
This breaks code like:
#[deriving(Show)]
struct Point2D {
x: int,
y: int,
}
fn main() {
let mypoint = Point2D {
x: 1,
y: 1,
};
let otherpoint = mypoint;
println!("{}{}", mypoint, otherpoint);
}
Change this code to:
#[deriving(Show)]
struct Point2D {
x: int,
y: int,
}
impl Copy for Point2D {}
fn main() {
let mypoint = Point2D {
x: 1,
y: 1,
};
let otherpoint = mypoint;
println!("{}{}", mypoint, otherpoint);
}
This is the backwards-incompatible part of #13231.
Part of RFC #3.
[breaking-change]
Diffstat (limited to 'src/liblibc')
| -rw-r--r-- | src/liblibc/lib.rs | 248 |
1 files changed, 135 insertions, 113 deletions
diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index 18e9d832c00..8825099e36c 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -76,6 +76,7 @@ #![allow(non_upper_case_globals)] #![allow(missing_docs)] #![allow(non_snake_case)] +#![allow(raw_pointer_deriving)] extern crate core; @@ -340,12 +341,15 @@ pub mod types { /// variants, because the compiler complains about the repr attribute /// otherwise. #[repr(u8)] + #[allow(missing_copy_implementations)] pub enum c_void { __variant1, __variant2, } + #[allow(missing_copy_implementations)] pub enum FILE {} + #[allow(missing_copy_implementations)] pub enum fpos_t {} } pub mod c99 { @@ -359,7 +363,9 @@ pub mod types { pub type uint64_t = u64; } pub mod posix88 { + #[allow(missing_copy_implementations)] pub enum DIR {} + #[allow(missing_copy_implementations)] pub enum dirent_t {} } pub mod posix01 {} @@ -380,7 +386,7 @@ pub mod types { pub type pthread_t = c_ulong; #[repr(C)] - pub struct glob_t { + #[deriving(Copy)] pub struct glob_t { pub gl_pathc: size_t, pub gl_pathv: *mut *mut c_char, pub gl_offs: size_t, @@ -393,18 +399,18 @@ pub mod types { } #[repr(C)] - pub struct timeval { + #[deriving(Copy)] pub struct timeval { pub tv_sec: time_t, pub tv_usec: suseconds_t, } #[repr(C)] - pub struct timespec { + #[deriving(Copy)] pub struct timespec { pub tv_sec: time_t, pub tv_nsec: c_long, } - pub enum timezone {} + #[deriving(Copy)] pub enum timezone {} pub type sighandler_t = size_t; } @@ -417,29 +423,29 @@ pub mod types { pub type in_port_t = u16; pub type in_addr_t = u32; #[repr(C)] - pub struct sockaddr { + #[deriving(Copy)] pub struct sockaddr { pub sa_family: sa_family_t, pub sa_data: [u8, ..14], } #[repr(C)] - pub struct sockaddr_storage { + #[deriving(Copy)] pub struct sockaddr_storage { pub ss_family: sa_family_t, pub __ss_align: i64, pub __ss_pad2: [u8, ..112], } #[repr(C)] - pub struct sockaddr_in { + #[deriving(Copy)] pub struct sockaddr_in { pub sin_family: sa_family_t, pub sin_port: in_port_t, pub sin_addr: in_addr, pub sin_zero: [u8, ..8], } #[repr(C)] - pub struct in_addr { + #[deriving(Copy)] pub struct in_addr { pub s_addr: in_addr_t, } #[repr(C)] - pub struct sockaddr_in6 { + #[deriving(Copy)] pub struct sockaddr_in6 { pub sin6_family: sa_family_t, pub sin6_port: in_port_t, pub sin6_flowinfo: u32, @@ -447,21 +453,21 @@ pub mod types { pub sin6_scope_id: u32, } #[repr(C)] - pub struct in6_addr { + #[deriving(Copy)] pub struct in6_addr { pub s6_addr: [u16, ..8] } #[repr(C)] - pub struct ip_mreq { + #[deriving(Copy)] pub struct ip_mreq { pub imr_multiaddr: in_addr, pub imr_interface: in_addr, } #[repr(C)] - pub struct ip6_mreq { + #[deriving(Copy)] pub struct ip6_mreq { pub ipv6mr_multiaddr: in6_addr, pub ipv6mr_interface: c_uint, } #[repr(C)] - pub struct addrinfo { + #[deriving(Copy)] pub struct addrinfo { pub ai_flags: c_int, pub ai_family: c_int, pub ai_socktype: c_int, @@ -483,13 +489,13 @@ pub mod types { pub ai_next: *mut addrinfo, } #[repr(C)] - pub struct sockaddr_un { + #[deriving(Copy)] pub struct sockaddr_un { pub sun_family: sa_family_t, pub sun_path: [c_char, ..108] } #[repr(C)] - pub struct ifaddrs { + #[deriving(Copy)] pub struct ifaddrs { pub ifa_next: *mut ifaddrs, pub ifa_name: *mut c_char, pub ifa_flags: c_uint, @@ -572,7 +578,7 @@ pub mod types { pub type blkcnt_t = i32; #[repr(C)] - pub struct stat { + #[deriving(Copy)] pub struct stat { pub st_dev: dev_t, pub __pad1: c_short, pub st_ino: ino_t, @@ -596,13 +602,13 @@ pub mod types { } #[repr(C)] - pub struct utimbuf { + #[deriving(Copy)] pub struct utimbuf { pub actime: time_t, pub modtime: time_t, } #[repr(C)] - pub struct pthread_attr_t { + #[deriving(Copy)] pub struct pthread_attr_t { pub __size: [u32, ..9] } } @@ -617,7 +623,7 @@ pub mod types { pub type blkcnt_t = u32; #[repr(C)] - pub struct stat { + #[deriving(Copy)] pub struct stat { pub st_dev: c_ulonglong, pub __pad0: [c_uchar, ..4], pub __st_ino: ino_t, @@ -640,13 +646,13 @@ pub mod types { } #[repr(C)] - pub struct utimbuf { + #[deriving(Copy)] pub struct utimbuf { pub actime: time_t, pub modtime: time_t, } #[repr(C)] - pub struct pthread_attr_t { + #[deriving(Copy)] pub struct pthread_attr_t { pub __size: [u32, ..9] } } @@ -662,7 +668,7 @@ pub mod types { pub type blkcnt_t = i32; #[repr(C)] - pub struct stat { + #[deriving(Copy)] pub struct stat { pub st_dev: c_ulong, pub st_pad1: [c_long, ..3], pub st_ino: ino_t, @@ -686,13 +692,13 @@ pub mod types { } #[repr(C)] - pub struct utimbuf { + #[deriving(Copy)] pub struct utimbuf { pub actime: time_t, pub modtime: time_t, } #[repr(C)] - pub struct pthread_attr_t { + #[deriving(Copy)] pub struct pthread_attr_t { pub __size: [u32, ..9] } } @@ -701,7 +707,7 @@ pub mod types { pub mod extra { use types::os::arch::c95::{c_ushort, c_int, c_uchar}; #[repr(C)] - pub struct sockaddr_ll { + #[deriving(Copy)] pub struct sockaddr_ll { pub sll_family: c_ushort, pub sll_protocol: c_ushort, pub sll_ifindex: c_int, @@ -764,7 +770,7 @@ pub mod types { pub type blksize_t = i64; pub type blkcnt_t = i64; #[repr(C)] - pub struct stat { + #[deriving(Copy)] pub struct stat { pub st_dev: dev_t, pub st_ino: ino_t, pub st_nlink: nlink_t, @@ -786,13 +792,13 @@ pub mod types { } #[repr(C)] - pub struct utimbuf { + #[deriving(Copy)] pub struct utimbuf { pub actime: time_t, pub modtime: time_t, } #[repr(C)] - pub struct pthread_attr_t { + #[deriving(Copy)] pub struct pthread_attr_t { pub __size: [u64, ..7] } } @@ -802,7 +808,7 @@ pub mod types { } pub mod extra { use types::os::arch::c95::{c_ushort, c_int, c_uchar}; - pub struct sockaddr_ll { + #[deriving(Copy)] pub struct sockaddr_ll { pub sll_family: c_ushort, pub sll_protocol: c_ushort, pub sll_ifindex: c_int, @@ -828,7 +834,7 @@ pub mod types { pub type pthread_t = uintptr_t; #[repr(C)] - pub struct glob_t { + #[deriving(Copy)] pub struct glob_t { pub gl_pathc: size_t, pub __unused1: size_t, pub gl_offs: size_t, @@ -845,18 +851,18 @@ pub mod types { } #[repr(C)] - pub struct timeval { + #[deriving(Copy)] pub struct timeval { pub tv_sec: time_t, pub tv_usec: suseconds_t, } #[repr(C)] - pub struct timespec { + #[deriving(Copy)] pub struct timespec { pub tv_sec: time_t, pub tv_nsec: c_long, } - pub enum timezone {} + #[deriving(Copy)] pub enum timezone {} pub type sighandler_t = size_t; } @@ -869,13 +875,13 @@ pub mod types { pub type in_port_t = u16; pub type in_addr_t = u32; #[repr(C)] - pub struct sockaddr { + #[deriving(Copy)] pub struct sockaddr { pub sa_len: u8, pub sa_family: sa_family_t, pub sa_data: [u8, ..14], } #[repr(C)] - pub struct sockaddr_storage { + #[deriving(Copy)] pub struct sockaddr_storage { pub ss_len: u8, pub ss_family: sa_family_t, pub __ss_pad1: [u8, ..6], @@ -883,7 +889,7 @@ pub mod types { pub __ss_pad2: [u8, ..112], } #[repr(C)] - pub struct sockaddr_in { + #[deriving(Copy)] pub struct sockaddr_in { pub sin_len: u8, pub sin_family: sa_family_t, pub sin_port: in_port_t, @@ -891,11 +897,11 @@ pub mod types { pub sin_zero: [u8, ..8], } #[repr(C)] - pub struct in_addr { + #[deriving(Copy)] pub struct in_addr { pub s_addr: in_addr_t, } #[repr(C)] - pub struct sockaddr_in6 { + #[deriving(Copy)] pub struct sockaddr_in6 { pub sin6_len: u8, pub sin6_family: sa_family_t, pub sin6_port: in_port_t, @@ -904,21 +910,21 @@ pub mod types { pub sin6_scope_id: u32, } #[repr(C)] - pub struct in6_addr { + #[deriving(Copy)] pub struct in6_addr { pub s6_addr: [u16, ..8] } #[repr(C)] - pub struct ip_mreq { + #[deriving(Copy)] pub struct ip_mreq { pub imr_multiaddr: in_addr, pub imr_interface: in_addr, } #[repr(C)] - pub struct ip6_mreq { + #[deriving(Copy)] pub struct ip6_mreq { pub ipv6mr_multiaddr: in6_addr, pub ipv6mr_interface: c_uint, } #[repr(C)] - pub struct addrinfo { + #[deriving(Copy)] pub struct addrinfo { pub ai_flags: c_int, pub ai_family: c_int, pub ai_socktype: c_int, @@ -929,13 +935,13 @@ pub mod types { pub ai_next: *mut addrinfo, } #[repr(C)] - pub struct sockaddr_un { + #[deriving(Copy)] pub struct sockaddr_un { pub sun_len: u8, pub sun_family: sa_family_t, pub sun_path: [c_char, ..104] } #[repr(C)] - pub struct ifaddrs { + #[deriving(Copy)] pub struct ifaddrs { pub ifa_next: *mut ifaddrs, pub ifa_name: *mut c_char, pub ifa_flags: c_uint, @@ -1002,7 +1008,7 @@ pub mod types { pub type blkcnt_t = i64; pub type fflags_t = u32; #[repr(C)] - pub struct stat { + #[deriving(Copy)] pub struct stat { pub st_dev: dev_t, pub st_ino: ino_t, pub st_mode: mode_t, @@ -1028,7 +1034,7 @@ pub mod types { } #[repr(C)] - pub struct utimbuf { + #[deriving(Copy)] pub struct utimbuf { pub actime: time_t, pub modtime: time_t, } @@ -1056,7 +1062,7 @@ pub mod types { pub type pthread_t = uintptr_t; #[repr(C)] - pub struct glob_t { + #[deriving(Copy)] pub struct glob_t { pub gl_pathc: size_t, pub __unused1: size_t, pub gl_offs: size_t, @@ -1073,18 +1079,18 @@ pub mod types { } #[repr(C)] - pub struct timeval { + #[deriving(Copy)] pub struct timeval { pub tv_sec: time_t, pub tv_usec: suseconds_t, } #[repr(C)] - pub struct timespec { + #[deriving(Copy)] pub struct timespec { pub tv_sec: time_t, pub tv_nsec: c_long, } - pub enum timezone {} + #[deriving(Copy)] pub enum timezone {} pub type sighandler_t = size_t; } @@ -1096,13 +1102,13 @@ pub mod types { pub type in_port_t = u16; pub type in_addr_t = u32; #[repr(C)] - pub struct sockaddr { + #[deriving(Copy)] pub struct sockaddr { pub sa_len: u8, pub sa_family: sa_family_t, pub sa_data: [u8, ..14], } #[repr(C)] - pub struct sockaddr_storage { + #[deriving(Copy)] pub struct sockaddr_storage { pub ss_len: u8, pub ss_family: sa_family_t, pub __ss_pad1: [u8, ..6], @@ -1110,7 +1116,7 @@ pub mod types { pub __ss_pad2: [u8, ..112], } #[repr(C)] - pub struct sockaddr_in { + #[deriving(Copy)] pub struct sockaddr_in { pub sin_len: u8, pub sin_family: sa_family_t, pub sin_port: in_port_t, @@ -1118,11 +1124,11 @@ pub mod types { pub sin_zero: [u8, ..8], } #[repr(C)] - pub struct in_addr { + #[deriving(Copy)] pub struct in_addr { pub s_addr: in_addr_t, } #[repr(C)] - pub struct sockaddr_in6 { + #[deriving(Copy)] pub struct sockaddr_in6 { pub sin6_len: u8, pub sin6_family: sa_family_t, pub sin6_port: in_port_t, @@ -1131,21 +1137,21 @@ pub mod types { pub sin6_scope_id: u32, } #[repr(C)] - pub struct in6_addr { + #[deriving(Copy)] pub struct in6_addr { pub s6_addr: [u16, ..8] } #[repr(C)] - pub struct ip_mreq { + #[deriving(Copy)] pub struct ip_mreq { pub imr_multiaddr: in_addr, pub imr_interface: in_addr, } #[repr(C)] - pub struct ip6_mreq { + #[deriving(Copy)] pub struct ip6_mreq { pub ipv6mr_multiaddr: in6_addr, pub ipv6mr_interface: c_uint, } #[repr(C)] - pub struct addrinfo { + #[deriving(Copy)] pub struct addrinfo { pub ai_flags: c_int, pub ai_family: c_int, pub ai_socktype: c_int, @@ -1156,7 +1162,7 @@ pub mod types { pub ai_next: *mut addrinfo, } #[repr(C)] - pub struct sockaddr_un { + #[deriving(Copy)] pub struct sockaddr_un { pub sun_len: u8, pub sun_family: sa_family_t, pub sun_path: [c_char, ..104] @@ -1219,7 +1225,7 @@ pub mod types { pub type fflags_t = u32; #[repr(C)] - pub struct stat { + #[deriving(Copy)] pub struct stat { pub st_ino: ino_t, pub st_nlink: nlink_t, pub st_dev: dev_t, @@ -1244,7 +1250,7 @@ pub mod types { pub st_qspare2: int64_t, } #[repr(C)] - pub struct utimbuf { + #[deriving(Copy)] pub struct utimbuf { pub actime: time_t, pub modtime: time_t, } @@ -1271,7 +1277,7 @@ pub mod types { // pub Note: this is the struct called stat64 in Windows. Not stat, // nor stati64. #[repr(C)] - pub struct stat { + #[deriving(Copy)] pub struct stat { pub st_dev: dev_t, pub st_ino: ino_t, pub st_mode: u16, @@ -1287,24 +1293,24 @@ pub mod types { // note that this is called utimbuf64 in Windows #[repr(C)] - pub struct utimbuf { + #[deriving(Copy)] pub struct utimbuf { pub actime: time64_t, pub modtime: time64_t, } #[repr(C)] - pub struct timeval { + #[deriving(Copy)] pub struct timeval { pub tv_sec: c_long, pub tv_usec: c_long, } #[repr(C)] - pub struct timespec { + #[deriving(Copy)] pub struct timespec { pub tv_sec: time_t, pub tv_nsec: c_long, } - pub enum timezone {} + #[deriving(Copy)] pub enum timezone {} } pub mod bsd44 { @@ -1317,30 +1323,30 @@ pub mod types { pub type in_port_t = u16; pub type in_addr_t = u32; #[repr(C)] - pub struct sockaddr { + #[deriving(Copy)] pub struct sockaddr { pub sa_family: sa_family_t, pub sa_data: [u8, ..14], } #[repr(C)] - pub struct sockaddr_storage { + #[deriving(Copy)] pub struct sockaddr_storage { pub ss_family: sa_family_t, pub __ss_pad1: [u8, ..6], pub __ss_align: i64, pub __ss_pad2: [u8, ..112], } #[repr(C)] - pub struct sockaddr_in { + #[deriving(Copy)] pub struct sockaddr_in { pub sin_family: sa_family_t, pub sin_port: in_port_t, pub sin_addr: in_addr, pub sin_zero: [u8, ..8], } #[repr(C)] - pub struct in_addr { + #[deriving(Copy)] pub struct in_addr { pub s_addr: in_addr_t, } #[repr(C)] - pub struct sockaddr_in6 { + #[deriving(Copy)] pub struct sockaddr_in6 { pub sin6_family: sa_family_t, pub sin6_port: in_port_t, pub sin6_flowinfo: u32, @@ -1348,21 +1354,21 @@ pub mod types { pub sin6_scope_id: u32, } #[repr(C)] - pub struct in6_addr { + #[deriving(Copy)] pub struct in6_addr { pub s6_addr: [u16, ..8] } #[repr(C)] - pub struct ip_mreq { + #[deriving(Copy)] pub struct ip_mreq { pub imr_multiaddr: in_addr, pub imr_interface: in_addr, } #[repr(C)] - pub struct ip6_mreq { + #[deriving(Copy)] pub struct ip6_mreq { pub ipv6mr_multiaddr: in6_addr, pub ipv6mr_interface: c_uint, } #[repr(C)] - pub struct addrinfo { + #[deriving(Copy)] pub struct addrinfo { pub ai_flags: c_int, pub ai_family: c_int, pub ai_socktype: c_int, @@ -1373,7 +1379,7 @@ pub mod types { pub ai_next: *mut addrinfo, } #[repr(C)] - pub struct sockaddr_un { + #[deriving(Copy)] pub struct sockaddr_un { pub sun_family: sa_family_t, pub sun_path: [c_char, ..108] } @@ -1501,7 +1507,7 @@ pub mod types { pub type LPCH = *mut CHAR; #[repr(C)] - pub struct SECURITY_ATTRIBUTES { + #[deriving(Copy)] pub struct SECURITY_ATTRIBUTES { pub nLength: DWORD, pub lpSecurityDescriptor: LPVOID, pub bInheritHandle: BOOL, @@ -1525,7 +1531,7 @@ pub mod types { pub type int64 = i64; #[repr(C)] - pub struct STARTUPINFO { + #[deriving(Copy)] pub struct STARTUPINFO { pub cb: DWORD, pub lpReserved: LPWSTR, pub lpDesktop: LPWSTR, @@ -1548,7 +1554,7 @@ pub mod types { pub type LPSTARTUPINFO = *mut STARTUPINFO; #[repr(C)] - pub struct PROCESS_INFORMATION { + #[deriving(Copy)] pub struct PROCESS_INFORMATION { pub hProcess: HANDLE, pub hThread: HANDLE, pub dwProcessId: DWORD, @@ -1557,7 +1563,7 @@ pub mod types { pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION; #[repr(C)] - pub struct SYSTEM_INFO { + #[deriving(Copy)] pub struct SYSTEM_INFO { pub wProcessorArchitecture: WORD, pub wReserved: WORD, pub dwPageSize: DWORD, @@ -1573,7 +1579,7 @@ pub mod types { pub type LPSYSTEM_INFO = *mut SYSTEM_INFO; #[repr(C)] - pub struct MEMORY_BASIC_INFORMATION { + #[deriving(Copy)] pub struct MEMORY_BASIC_INFORMATION { pub BaseAddress: LPVOID, pub AllocationBase: LPVOID, pub AllocationProtect: DWORD, @@ -1585,7 +1591,7 @@ pub mod types { pub type LPMEMORY_BASIC_INFORMATION = *mut MEMORY_BASIC_INFORMATION; #[repr(C)] - pub struct OVERLAPPED { + #[deriving(Copy)] pub struct OVERLAPPED { pub Internal: *mut c_ulong, pub InternalHigh: *mut c_ulong, pub Offset: DWORD, @@ -1596,7 +1602,7 @@ pub mod types { pub type LPOVERLAPPED = *mut OVERLAPPED; #[repr(C)] - pub struct FILETIME { + #[deriving(Copy)] pub struct FILETIME { pub dwLowDateTime: DWORD, pub dwHighDateTime: DWORD, } @@ -1604,7 +1610,7 @@ pub mod types { pub type LPFILETIME = *mut FILETIME; #[repr(C)] - pub struct GUID { + #[deriving(Copy)] pub struct GUID { pub Data1: DWORD, pub Data2: WORD, pub Data3: WORD, @@ -1612,7 +1618,7 @@ pub mod types { } #[repr(C)] - pub struct WSAPROTOCOLCHAIN { + #[deriving(Copy)] pub struct WSAPROTOCOLCHAIN { pub ChainLen: c_int, pub ChainEntries: [DWORD, ..MAX_PROTOCOL_CHAIN as uint], } @@ -1620,7 +1626,7 @@ pub mod types { pub type LPWSAPROTOCOLCHAIN = *mut WSAPROTOCOLCHAIN; #[repr(C)] - pub struct WSAPROTOCOL_INFO { + #[deriving(Copy)] pub struct WSAPROTOCOL_INFO { pub dwServiceFlags1: DWORD, pub dwServiceFlags2: DWORD, pub dwServiceFlags3: DWORD, @@ -1648,7 +1654,7 @@ pub mod types { pub type GROUP = c_uint; #[repr(C)] - pub struct WIN32_FIND_DATAW { + #[deriving(Copy)] pub struct WIN32_FIND_DATAW { pub dwFileAttributes: DWORD, pub ftCreationTime: FILETIME, pub ftLastAccessTime: FILETIME, @@ -1671,14 +1677,14 @@ pub mod types { pub mod common { pub mod posix01 { use types::common::c95::c_void; - use types::os::arch::c95::{c_char, c_int, size_t, - time_t, suseconds_t, c_long}; + use types::os::arch::c95::{c_char, c_int, size_t, time_t}; + use types::os::arch::c95::{suseconds_t, c_long}; use types::os::arch::c99::{uintptr_t}; pub type pthread_t = uintptr_t; #[repr(C)] - pub struct glob_t { + #[deriving(Copy)] pub struct glob_t { pub gl_pathc: size_t, pub __unused1: c_int, pub gl_offs: size_t, @@ -1695,18 +1701,18 @@ pub mod types { } #[repr(C)] - pub struct timeval { + #[deriving(Copy)] pub struct timeval { pub tv_sec: time_t, pub tv_usec: suseconds_t, } #[repr(C)] - pub struct timespec { + #[deriving(Copy)] pub struct timespec { pub tv_sec: time_t, pub tv_nsec: c_long, } - pub enum timezone {} + #[deriving(Copy)] pub enum timezone {} pub type sighandler_t = size_t; } @@ -1720,33 +1726,37 @@ pub mod types { pub type in_port_t = u16; pub type in_addr_t = u32; #[repr(C)] - pub struct sockaddr { + #[deriving(Copy)] pub struct sockaddr { pub sa_len: u8, pub sa_family: sa_family_t, pub sa_data: [u8, ..14], } + #[repr(C)] - pub struct sockaddr_storage { + #[deriving(Copy)] pub struct sockaddr_storage { pub ss_len: u8, pub ss_family: sa_family_t, pub __ss_pad1: [u8, ..6], pub __ss_align: i64, pub __ss_pad2: [u8, ..112], } + #[repr(C)] - pub struct sockaddr_in { + #[deriving(Copy)] pub struct sockaddr_in { pub sin_len: u8, pub sin_family: sa_family_t, pub sin_port: in_port_t, pub sin_addr: in_addr, pub sin_zero: [u8, ..8], } + #[repr(C)] - pub struct in_addr { + #[deriving(Copy)] pub struct in_addr { pub s_addr: in_addr_t, } + #[repr(C)] - pub struct sockaddr_in6 { + #[deriving(Copy)] pub struct sockaddr_in6 { pub sin6_len: u8, pub sin6_family: sa_family_t, pub sin6_port: in_port_t, @@ -1754,22 +1764,26 @@ pub mod types { pub sin6_addr: in6_addr, pub sin6_scope_id: u32, } + #[repr(C)] - pub struct in6_addr { + #[deriving(Copy)] pub struct in6_addr { pub s6_addr: [u16, ..8] } + #[repr(C)] - pub struct ip_mreq { + #[deriving(Copy)] pub struct ip_mreq { pub imr_multiaddr: in_addr, pub imr_interface: in_addr, } + #[repr(C)] - pub struct ip6_mreq { + #[deriving(Copy)] pub struct ip6_mreq { pub ipv6mr_multiaddr: in6_addr, pub ipv6mr_interface: c_uint, } + #[repr(C)] - pub struct addrinfo { + #[deriving(Copy)] pub struct addrinfo { pub ai_flags: c_int, pub ai_family: c_int, pub ai_socktype: c_int, @@ -1779,14 +1793,16 @@ pub mod types { pub ai_addr: *mut sockaddr, pub ai_next: *mut addrinfo, } + #[repr(C)] - pub struct sockaddr_un { + #[deriving(Copy)] pub struct sockaddr_un { pub sun_len: u8, pub sun_family: sa_family_t, pub sun_path: [c_char, ..104] } + #[repr(C)] - pub struct ifaddrs { + #[deriving(Copy)] pub struct ifaddrs { pub ifa_next: *mut ifaddrs, pub ifa_name: *mut c_char, pub ifa_flags: c_uint, @@ -1849,7 +1865,7 @@ pub mod types { pub type blkcnt_t = i32; #[repr(C)] - pub struct stat { + #[deriving(Copy)] pub struct stat { pub st_dev: dev_t, pub st_mode: mode_t, pub st_nlink: nlink_t, @@ -1875,13 +1891,13 @@ pub mod types { } #[repr(C)] - pub struct utimbuf { + #[deriving(Copy)] pub struct utimbuf { pub actime: time_t, pub modtime: time_t, } #[repr(C)] - pub struct pthread_attr_t { + #[deriving(Copy)] pub struct pthread_attr_t { pub __sig: c_long, pub __opaque: [c_char, ..36] } @@ -1892,7 +1908,7 @@ pub mod types { } pub mod extra { #[repr(C)] - pub struct mach_timebase_info { + #[deriving(Copy)] pub struct mach_timebase_info { pub numer: u32, pub denom: u32, } @@ -1953,7 +1969,7 @@ pub mod types { pub type blkcnt_t = i32; #[repr(C)] - pub struct stat { + #[deriving(Copy)] pub struct stat { pub st_dev: dev_t, pub st_mode: mode_t, pub st_nlink: nlink_t, @@ -1979,13 +1995,13 @@ pub mod types { } #[repr(C)] - pub struct utimbuf { + #[deriving(Copy)] pub struct utimbuf { pub actime: time_t, pub modtime: time_t, } #[repr(C)] - pub struct pthread_attr_t { + #[deriving(Copy)] pub struct pthread_attr_t { pub __sig: c_long, pub __opaque: [c_char, ..56] } @@ -1996,7 +2012,7 @@ pub mod types { } pub mod extra { #[repr(C)] - pub struct mach_timebase_info { + #[deriving(Copy)] pub struct mach_timebase_info { pub numer: u32, pub denom: u32, } @@ -4990,3 +5006,9 @@ pub mod funcs { pub fn issue_14344_workaround() {} // FIXME #14344 force linkage to happen correctly #[test] fn work_on_windows() { } // FIXME #10872 needed for a happy windows + +#[doc(hidden)] +#[cfg(not(test))] +mod std { + pub use core::kinds; +} |
