From 5c3aa01045cee7d632e93cad4295fa12109e9550 Mon Sep 17 00:00:00 2001 From: Dave Huseby Date: Tue, 7 Apr 2015 16:03:14 -0700 Subject: disabling a test that is failing on bitrig. --- src/libstd/net/addr.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/libstd') diff --git a/src/libstd/net/addr.rs b/src/libstd/net/addr.rs index 886f252fb19..18d8fcc8a52 100644 --- a/src/libstd/net/addr.rs +++ b/src/libstd/net/addr.rs @@ -750,8 +750,9 @@ mod tests { assert!(tsa("localhost:23924").unwrap().contains(&a)); } + // FIXME: figure out why this fails on bitrig and fix it #[test] - #[cfg(not(windows))] + #[cfg(not(any(windows, target_os = "bitrig")))] fn to_socket_addr_str_bad() { assert!(tsa("1200::AB00:1234::2552:7777:1313:34300").is_err()); } -- cgit 1.4.1-3-g733a5 From 65e3f0325a64d8f1affa146b3575a4b7c90458d7 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 8 Apr 2015 15:48:46 -0700 Subject: std: Destabilize the internals of panic! Now that we have a `#[allow_internal_unstable]` attribute for macros there's no need for these two `begin_unwind` functions to be stable. Right now the `panic!` interface is the only one we wish to stabilize, so remove the stability markers from these functions. While this is a breaking change, it is highly unlikely to break any actual code. It is recommended to use the `panic!` macro instead if it breaks explicit calls into `std::rt`. [breaking-change] cc #24208 --- src/libstd/macros.rs | 1 + src/libstd/rt/unwind.rs | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index b3d1adb4421..3d10c151f80 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -37,6 +37,7 @@ /// ``` #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] +#[allow_internal_unstable] macro_rules! panic { () => ({ panic!("explicit panic") diff --git a/src/libstd/rt/unwind.rs b/src/libstd/rt/unwind.rs index f71811b1ead..2f58a437eb4 100644 --- a/src/libstd/rt/unwind.rs +++ b/src/libstd/rt/unwind.rs @@ -495,7 +495,6 @@ pub extern fn rust_begin_unwind(msg: fmt::Arguments, /// on (e.g.) the inlining of other functions as possible), by moving /// the actual formatting into this shared place. #[inline(never)] #[cold] -#[stable(since = "1.0.0", feature = "rust1")] pub fn begin_unwind_fmt(msg: fmt::Arguments, file_line: &(&'static str, usize)) -> ! { use fmt::Write; @@ -511,7 +510,6 @@ pub fn begin_unwind_fmt(msg: fmt::Arguments, file_line: &(&'static str, usize)) /// This is the entry point of unwinding for panic!() and assert!(). #[inline(never)] #[cold] // avoid code bloat at the call sites as much as possible -#[stable(since = "1.0.0", feature = "rust1")] pub fn begin_unwind(msg: M, file_line: &(&'static str, usize)) -> ! { // Note that this should be the only allocation performed in this code path. // Currently this means that panic!() on OOM will invoke this code path, @@ -598,7 +596,6 @@ fn begin_unwind_inner(msg: Box, /// Only a limited number of callbacks can be registered, and this function /// returns whether the callback was successfully registered or not. It is not /// currently possible to unregister a callback once it has been registered. -#[unstable(feature = "std_misc")] pub unsafe fn register(f: Callback) -> bool { match CALLBACK_CNT.fetch_add(1, Ordering::SeqCst) { // The invocation code has knowledge of this window where the count has -- cgit 1.4.1-3-g733a5 From 561fdec1350056d77245a17d59c7d740c95621d1 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 8 Apr 2015 16:41:14 -0700 Subject: std: Stabilize io::Error::from_raw_os_error This commit stabilizes the old `io::Error::from_os_error` after being renamed to use the `raw_os_error` terminology instead. This function is often useful when writing bindings to OS functions but only actually converting to an I/O error at a later point. --- src/libstd/io/error.rs | 12 +++++++++--- src/libstd/sys/unix/process2.rs | 2 +- src/libstd/sys/unix/thread.rs | 2 +- src/libstd/sys/windows/net.rs | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index b84dcb8fb62..7428d0a8e35 100644 --- a/src/libstd/io/error.rs +++ b/src/libstd/io/error.rs @@ -163,12 +163,18 @@ impl Error { /// `Error` for the error code. #[stable(feature = "rust1", since = "1.0.0")] pub fn last_os_error() -> Error { - Error::from_os_error(sys::os::errno() as i32) + Error::from_raw_os_error(sys::os::errno() as i32) } /// Creates a new instance of an `Error` from a particular OS error code. - #[unstable(feature = "io", - reason = "unclear whether this function is necessary")] + #[stable(feature = "rust1", since = "1.0.0")] + pub fn from_raw_os_error(code: i32) -> Error { + Error { repr: Repr::Os(code) } + } + + /// Creates a new instance of an `Error` from a particular OS error code. + #[unstable(feature = "io", reason = "deprecated")] + #[deprecated(since = "1.0.0", reason = "renamed to from_raw_os_error")] pub fn from_os_error(code: i32) -> Error { Error { repr: Repr::Os(code) } } diff --git a/src/libstd/sys/unix/process2.rs b/src/libstd/sys/unix/process2.rs index c2a8b26aef4..60f00c80b4a 100644 --- a/src/libstd/sys/unix/process2.rs +++ b/src/libstd/sys/unix/process2.rs @@ -193,7 +193,7 @@ impl Process { let errno = combine(&bytes[0.. 4]); assert!(p.wait().is_ok(), "wait() should either return Ok or panic"); - return Err(Error::from_os_error(errno)) + return Err(Error::from_raw_os_error(errno)) } Ok(0) => return Ok(p), Err(ref e) if e.kind() == ErrorKind::Interrupted => {} diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index eb61f21aacd..73d6cd73621 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -212,7 +212,7 @@ pub unsafe fn create(stack: usize, p: Thunk) -> io::Result { assert_eq!(pthread_attr_destroy(&mut attr), 0); return if ret != 0 { - Err(io::Error::from_os_error(ret)) + Err(io::Error::from_raw_os_error(ret)) } else { mem::forget(p); // ownership passed to pthread_create Ok(native) diff --git a/src/libstd/sys/windows/net.rs b/src/libstd/sys/windows/net.rs index 12a8ef99d76..5ced8863e62 100644 --- a/src/libstd/sys/windows/net.rs +++ b/src/libstd/sys/windows/net.rs @@ -43,7 +43,7 @@ pub fn init() { /// Returns the last error from the Windows socket interface. fn last_error() -> io::Error { - io::Error::from_os_error(unsafe { c::WSAGetLastError() }) + io::Error::from_raw_os_error(unsafe { c::WSAGetLastError() }) } /// Checks if the signed integer is the Windows constant `SOCKET_ERROR` (-1) -- cgit 1.4.1-3-g733a5