diff --git a/RELEASES.md b/RELEASES.md index 4068d2ef9f24c..7da73afb4111f 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -34,7 +34,7 @@ Version 1.0.0-beta (April 2015) downcasting via the `Any` trait is effectively limited to concrete types. This helps retain the potentially-important "parametricity" property: generic code cannot behave differently - for different type arguments. + for different type arguments except in minor ways. * The `unsafe_destructor` feature is now deprecated in favor of the [new `dropck`][dropck]. This change is a major reduction in unsafe code. @@ -78,7 +78,7 @@ Version 1.0.0-beta (April 2015) [scoped]: http://static.rust-lang.org/doc/master/std/thread/fn.scoped.html [moar-ufcs]: https://github.com/rust-lang/rust/pull/22172 [prim-inherent]: https://github.com/rust-lang/rust/pull/23104 -[overflow]: https://github.com/rust-lang/rust/pull/22532 +[overflow]: https://github.com/rust-lang/rfcs/blob/master/text/0560-integer-overflow.md [metadata-shrink]: https://github.com/rust-lang/rust/pull/22971 [self-sized]: https://github.com/rust-lang/rust/pull/22301 [assoc-where]: https://github.com/rust-lang/rust/pull/22512 diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index a3a7edac230a0..44d689059d1cf 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -291,7 +291,6 @@ pub mod types { } pub mod bsd44 { - use core::clone::Clone; use types::common::c95::{c_void}; use types::os::arch::c95::{c_char, c_int, c_uint}; @@ -313,7 +312,7 @@ pub mod types { #[cfg(target_pointer_width = "64")] pub __ss_pad2: [u8; 128 - 2 * 8], } - impl Clone for sockaddr_storage { + impl ::core::clone::Clone for sockaddr_storage { fn clone(&self) -> sockaddr_storage { *self } } #[repr(C)] @@ -376,7 +375,7 @@ pub mod types { pub sun_family: sa_family_t, pub sun_path: [c_char; 108] } - impl Clone for sockaddr_un { + impl ::core::clone::Clone for sockaddr_un { fn clone(&self) -> sockaddr_un { *self } } @@ -1634,12 +1633,15 @@ pub mod types { pub sa_data: [u8; 14], } #[repr(C)] - #[derive(Copy, Clone)] pub struct sockaddr_storage { + #[derive(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], } + impl ::core::clone::Clone for sockaddr_storage { + fn clone(&self) -> sockaddr_storage { *self } + } #[repr(C)] #[derive(Copy, Clone)] pub struct sockaddr_in { pub sin_family: sa_family_t, @@ -1685,10 +1687,13 @@ pub mod types { pub ai_next: *mut addrinfo, } #[repr(C)] - #[derive(Copy, Clone)] pub struct sockaddr_un { + #[derive(Copy)] pub struct sockaddr_un { pub sun_family: sa_family_t, pub sun_path: [c_char; 108] } + impl ::core::clone::Clone for sockaddr_un { + fn clone(&self) -> sockaddr_un { *self } + } } } @@ -1933,7 +1938,7 @@ pub mod types { pub type LPWSAPROTOCOLCHAIN = *mut WSAPROTOCOLCHAIN; #[repr(C)] - #[derive(Copy, Clone)] pub struct WSAPROTOCOL_INFO { + #[derive(Copy)] pub struct WSAPROTOCOL_INFO { pub dwServiceFlags1: DWORD, pub dwServiceFlags2: DWORD, pub dwServiceFlags3: DWORD, @@ -1955,13 +1960,16 @@ pub mod types { pub dwProviderReserved: DWORD, pub szProtocol: [u8; WSAPROTOCOL_LEN as usize + 1], } + impl ::core::clone::Clone for WSAPROTOCOL_INFO { + fn clone(&self) -> WSAPROTOCOL_INFO { *self } + } pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO; pub type GROUP = c_uint; #[repr(C)] - #[derive(Copy, Clone)] pub struct WIN32_FIND_DATAW { + #[derive(Copy)] pub struct WIN32_FIND_DATAW { pub dwFileAttributes: DWORD, pub ftCreationTime: FILETIME, pub ftLastAccessTime: FILETIME, @@ -1973,6 +1981,9 @@ pub mod types { pub cFileName: [wchar_t; 260], // #define MAX_PATH 260 pub cAlternateFileName: [wchar_t; 14], } + impl ::core::clone::Clone for WIN32_FIND_DATAW { + fn clone(&self) -> WIN32_FIND_DATAW { *self } + } pub type LPWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW; } @@ -2073,13 +2084,16 @@ pub mod types { } #[repr(C)] - #[derive(Copy, Clone)] pub struct sockaddr_storage { + #[derive(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], } + impl ::core::clone::Clone for sockaddr_storage { + fn clone(&self) -> sockaddr_storage { *self } + } #[repr(C)] #[derive(Copy, Clone)] pub struct sockaddr_in { @@ -2135,11 +2149,14 @@ pub mod types { } #[repr(C)] - #[derive(Copy, Clone)] pub struct sockaddr_un { + #[derive(Copy)] pub struct sockaddr_un { pub sun_len: u8, pub sun_family: sa_family_t, pub sun_path: [c_char; 104] } + impl ::core::clone::Clone for sockaddr_un { + fn clone(&self) -> sockaddr_un { *self } + } #[repr(C)] #[derive(Copy, Clone)] pub struct ifaddrs { @@ -2239,10 +2256,13 @@ pub mod types { } #[repr(C)] - #[derive(Copy, Clone)] pub struct pthread_attr_t { + #[derive(Copy)] pub struct pthread_attr_t { pub __sig: c_long, pub __opaque: [c_char; 36] } + impl ::core::clone::Clone for pthread_attr_t { + fn clone(&self) -> pthread_attr_t { *self } + } } pub mod posix08 { } @@ -2345,10 +2365,13 @@ pub mod types { } #[repr(C)] - #[derive(Copy, Clone)] pub struct pthread_attr_t { + #[derive(Copy)] pub struct pthread_attr_t { pub __sig: c_long, pub __opaque: [c_char; 56] } + impl ::core::clone::Clone for pthread_attr_t { + fn clone(&self) -> pthread_attr_t { *self } + } } pub mod posix08 { } diff --git a/src/librustc/middle/traits/coherence.rs b/src/librustc/middle/traits/coherence.rs index 411be28b89695..2f2db8f38bd87 100644 --- a/src/librustc/middle/traits/coherence.rs +++ b/src/librustc/middle/traits/coherence.rs @@ -25,7 +25,7 @@ use syntax::ast; use syntax::codemap::{DUMMY_SP, Span}; use util::ppaux::Repr; -#[derive(Copy)] +#[derive(Copy, Clone)] struct ParamIsLocal(bool); /// True if there exist types that satisfy both of the two given impls. diff --git a/src/libstd/rt/unwind.rs b/src/libstd/rt/unwind.rs index e4927bbd3d274..f71811b1eadf6 100644 --- a/src/libstd/rt/unwind.rs +++ b/src/libstd/rt/unwind.rs @@ -398,7 +398,7 @@ pub mod eabi { pub struct DISPATCHER_CONTEXT; #[repr(C)] - #[derive(Copy)] + #[derive(Copy, Clone)] pub enum EXCEPTION_DISPOSITION { ExceptionContinueExecution, ExceptionContinueSearch, diff --git a/src/libstd/sys/common/net.rs b/src/libstd/sys/common/net.rs index 1a0ee17904a24..fc21effb45a8d 100644 --- a/src/libstd/sys/common/net.rs +++ b/src/libstd/sys/common/net.rs @@ -115,9 +115,9 @@ pub fn socket(addr: SocketAddr, ty: libc::c_int) -> IoResult { Ipv4Addr(..) => libc::AF_INET, Ipv6Addr(..) => libc::AF_INET6, }; - match libc::socket(fam, ty, 0) { + match libc::socket(fam, ty, 0) as i32 { -1 => Err(last_net_error()), - fd => Ok(fd), + fd => Ok(fd as sock_t), } } } diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs index 99abe10c8a499..4804f6504419c 100644 --- a/src/libstd/sys/windows/c.rs +++ b/src/libstd/sys/windows/c.rs @@ -89,7 +89,6 @@ pub type LPWSANETWORKEVENTS = *mut WSANETWORKEVENTS; pub type WSAEVENT = libc::HANDLE; #[repr(C)] -#[derive(Copy)] pub struct WSAPROTOCOL_INFO { pub dwServiceFlags1: libc::DWORD, pub dwServiceFlags2: libc::DWORD, diff --git a/src/libstd/sys/windows/tcp.rs b/src/libstd/sys/windows/tcp.rs index 2ac8ac10aa9ae..41e97dc847502 100644 --- a/src/libstd/sys/windows/tcp.rs +++ b/src/libstd/sys/windows/tcp.rs @@ -15,6 +15,7 @@ use prelude::v1::*; use old_io::net::ip; use old_io::IoResult; use libc; +use libc::consts::os::extra::INVALID_SOCKET; use mem; use ptr; use super::{last_error, last_net_error, sock_t}; @@ -183,8 +184,8 @@ impl TcpAcceptor { match unsafe { libc::accept(self.socket(), ptr::null_mut(), ptr::null_mut()) } { - -1 if wouldblock() => {} - -1 => return Err(last_net_error()), + INVALID_SOCKET if wouldblock() => {} + INVALID_SOCKET => return Err(last_net_error()), // Accepted sockets inherit the same properties as the caller, // so we need to deregister our event and switch the socket back diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index c4690b9716c99..f35cc8c8d2399 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -371,7 +371,7 @@ fn stderr_isatty() -> bool { } #[cfg(windows)] fn stderr_isatty() -> bool { - const STD_ERROR_HANDLE: libc::DWORD = -12; + const STD_ERROR_HANDLE: libc::DWORD = -12i32 as libc::DWORD; extern "system" { fn GetStdHandle(which: libc::DWORD) -> libc::HANDLE; fn GetConsoleMode(hConsoleHandle: libc::HANDLE, diff --git a/src/libterm/win.rs b/src/libterm/win.rs index 001313db6769f..66ef5e8661797 100644 --- a/src/libterm/win.rs +++ b/src/libterm/win.rs @@ -104,7 +104,7 @@ impl WinConsole { // terminal! Admittedly, this is fragile, since stderr could be // redirected to a different console. This is good enough for // rustc though. See #13400. - let out = GetStdHandle(-11); + let out = GetStdHandle(-11i32 as libc::DWORD); SetConsoleTextAttribute(out, accum); } } @@ -116,7 +116,8 @@ impl WinConsole { let bg; unsafe { let mut buffer_info = ::std::mem::uninitialized(); - if GetConsoleScreenBufferInfo(GetStdHandle(-11), &mut buffer_info) != 0 { + if GetConsoleScreenBufferInfo(GetStdHandle(-11i32 as libc::DWORD), + &mut buffer_info) != 0 { fg = bits_to_color(buffer_info.wAttributes); bg = bits_to_color(buffer_info.wAttributes >> 4); } else { diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 8d329367972d1..c84703b93ed26 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -757,7 +757,7 @@ fn stdout_isatty() -> bool { } #[cfg(windows)] fn stdout_isatty() -> bool { - const STD_OUTPUT_HANDLE: libc::DWORD = -11; + const STD_OUTPUT_HANDLE: libc::DWORD = -11i32 as libc::DWORD; extern "system" { fn GetStdHandle(which: libc::DWORD) -> libc::HANDLE; fn GetConsoleMode(hConsoleHandle: libc::HANDLE, diff --git a/src/test/compile-fail/coherence-impls-copy.rs b/src/test/compile-fail/coherence-impls-copy.rs index f1a04a8ea5736..1be606c3546fd 100644 --- a/src/test/compile-fail/coherence-impls-copy.rs +++ b/src/test/compile-fail/coherence-impls-copy.rs @@ -28,6 +28,8 @@ impl Copy for MyType {} impl Copy for &'static mut MyType {} //~^ ERROR E0206 +//~| ERROR E0277 +//~| ERROR E0277 impl Clone for MyType { fn clone(&self) -> Self { *self } } impl Copy for (MyType, MyType) {}