diff options
Diffstat (limited to 'src/libstd')
49 files changed, 178 insertions, 268 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 6f8151c2b9f..60b1738d2c9 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -23,8 +23,6 @@ use hash::{Hash, SipHasher}; use iter::{self, Iterator, ExactSizeIterator, IntoIterator, IteratorExt, FromIterator, Extend, Map}; use marker::Sized; use mem::{self, replace}; -#[cfg(stage0)] -use num::{Int, UnsignedInt}; use ops::{Deref, FnMut, Index, IndexMut}; use option::Option::{self, Some, None}; use rand::{self, Rng}; diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs index cba46859f34..052bcfd7e16 100644 --- a/src/libstd/collections/hash/table.rs +++ b/src/libstd/collections/hash/table.rs @@ -19,15 +19,10 @@ use iter::{Iterator, IteratorExt, ExactSizeIterator, count}; use marker::{Copy, Send, Sync, Sized, self}; use mem::{min_align_of, size_of}; use mem; -#[cfg(stage0)] -use num::{Int, UnsignedInt}; use num::wrapping::{OverflowingOps, WrappingOps}; use ops::{Deref, DerefMut, Drop}; use option::Option; use option::Option::{Some, None}; -#[cfg(stage0)] -use ptr::{self, PtrExt, Unique}; -#[cfg(not(stage0))] use ptr::{self, Unique}; use rt::heap::{allocate, deallocate, EMPTY}; use collections::hash_state::HashState; diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs index d06b027adf6..a42809127bf 100644 --- a/src/libstd/dynamic_lib.rs +++ b/src/libstd/dynamic_lib.rs @@ -272,10 +272,6 @@ mod dl { use ptr; use result::Result; use result::Result::{Ok, Err}; - #[cfg(stage0)] - use slice::SliceExt; - #[cfg(stage0)] - use str::StrExt; use str; use string::String; use vec::Vec; @@ -294,10 +290,11 @@ mod dl { let err = os::errno(); if err as libc::c_int == ERROR_CALL_NOT_IMPLEMENTED { use_thread_mode = false; - // SetThreadErrorMode not found. use fallback solution: SetErrorMode() - // Note that SetErrorMode is process-wide so this can cause race condition! - // However, since even Windows APIs do not care of such problem (#20650), - // we just assume SetErrorMode race is not a great deal. + // SetThreadErrorMode not found. use fallback solution: + // SetErrorMode() Note that SetErrorMode is process-wide so + // this can cause race condition! However, since even + // Windows APIs do not care of such problem (#20650), we + // just assume SetErrorMode race is not a great deal. prev_error_mode = SetErrorMode(new_error_mode); } } diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 28f22468d22..fc4f03ff3a5 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -22,12 +22,7 @@ use old_io; use ops::Deref; use option::Option::{self, Some, None}; use result::Result::{self, Ok, Err}; -#[cfg(stage0)] -use slice::{self, SliceExt}; -#[cfg(not(stage0))] use slice; -#[cfg(stage0)] -use str::StrExt; use string::String; use vec::Vec; diff --git a/src/libstd/fs/mod.rs b/src/libstd/fs/mod.rs index ba89b3a0ea6..c56852cb18a 100644 --- a/src/libstd/fs/mod.rs +++ b/src/libstd/fs/mod.rs @@ -73,6 +73,11 @@ pub struct Metadata(fs_imp::FileAttr); /// will yield instances of `io::Result<DirEntry>`. Through a `DirEntry` /// information like the entry's path and possibly other metadata can be /// learned. +/// +/// # Failure +/// +/// This `io::Result` will be an `Err` if there's some sort of intermittent +/// IO error during iteration. #[stable(feature = "rust1", since = "1.0.0")] pub struct ReadDir(fs_imp::ReadDir); @@ -493,7 +498,7 @@ pub fn copy<P: AsPath, Q: AsPath>(from: P, to: Q) -> io::Result<u64> { let from = from.as_path(); let to = to.as_path(); if !from.is_file() { - return Err(Error::new(ErrorKind::MismatchedFileTypeForOperation, + return Err(Error::new(ErrorKind::InvalidInput, "the source path is not an existing file", None)) } @@ -1134,7 +1139,7 @@ mod tests { let dir = &tmpdir.join("mkdir_error_twice"); check!(fs::create_dir(dir)); let e = fs::create_dir(dir).err().unwrap(); - assert_eq!(e.kind(), ErrorKind::PathAlreadyExists); + assert_eq!(e.kind(), ErrorKind::AlreadyExists); } #[test] diff --git a/src/libstd/fs/tempdir.rs b/src/libstd/fs/tempdir.rs index c1da77a6668..8f32d7a5864 100644 --- a/src/libstd/fs/tempdir.rs +++ b/src/libstd/fs/tempdir.rs @@ -68,12 +68,12 @@ impl TempDir { let path = tmpdir.join(&leaf); match fs::create_dir(&path) { Ok(_) => return Ok(TempDir { path: Some(path) }), - Err(ref e) if e.kind() == ErrorKind::PathAlreadyExists => {} + Err(ref e) if e.kind() == ErrorKind::AlreadyExists => {} Err(e) => return Err(e) } } - Err(Error::new(ErrorKind::PathAlreadyExists, + Err(Error::new(ErrorKind::AlreadyExists, "too many temporary directories already exist", None)) } diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index 530c6728107..f445ace081e 100644 --- a/src/libstd/io/error.rs +++ b/src/libstd/io/error.rs @@ -51,41 +51,53 @@ struct Custom { } /// A list specifying general categories of I/O error. +/// +/// This list is intended to grow over time and it is not recommended to +/// exhaustively match against it. #[derive(Copy, PartialEq, Eq, Clone, Debug)] -#[unstable(feature = "io", - reason = "the interaction between OS error codes and how they map to \ - these names (as well as the names themselves) has not \ - been thoroughly thought out")] +#[stable(feature = "rust1", since = "1.0.0")] pub enum ErrorKind { - /// The file was not found. - FileNotFound, - /// The file permissions disallowed access to this file. + /// An entity was not found, often a file. + #[stable(feature = "rust1", since = "1.0.0")] + NotFound, + /// The operation lacked the necessary privileges to complete. + #[stable(feature = "rust1", since = "1.0.0")] PermissionDenied, /// The connection was refused by the remote server. + #[stable(feature = "rust1", since = "1.0.0")] ConnectionRefused, /// The connection was reset by the remote server. + #[stable(feature = "rust1", since = "1.0.0")] ConnectionReset, /// The connection was aborted (terminated) by the remote server. + #[stable(feature = "rust1", since = "1.0.0")] ConnectionAborted, /// The network operation failed because it was not connected yet. + #[stable(feature = "rust1", since = "1.0.0")] NotConnected, + /// A socket address could not be bound because the address is already in + /// use elsewhere. + #[stable(feature = "rust1", since = "1.0.0")] + AddrInUse, + /// A nonexistent interface was requested or the requested address was not + /// local. + #[stable(feature = "rust1", since = "1.0.0")] + AddrNotAvailable, /// The operation failed because a pipe was closed. + #[stable(feature = "rust1", since = "1.0.0")] BrokenPipe, - /// A file already existed with that name. - PathAlreadyExists, - /// No file exists at that location. - PathDoesntExist, - /// The path did not specify the type of file that this operation required. - /// For example, attempting to copy a directory with the `fs::copy()` - /// operation will fail with this error. - MismatchedFileTypeForOperation, - /// The operation temporarily failed (for example, because a signal was - /// received), and retrying may succeed. - ResourceUnavailable, - /// A parameter was incorrect in a way that caused an I/O error not part of - /// this list. + /// An entity already exists, often a file. + #[stable(feature = "rust1", since = "1.0.0")] + AlreadyExists, + /// The operation needs to block to complete, but the blocking operation was + /// requested to not occur. + #[stable(feature = "rust1", since = "1.0.0")] + WouldBlock, + /// A parameter was incorrect. + #[stable(feature = "rust1", since = "1.0.0")] InvalidInput, /// The I/O operation's timeout expired, causing it to be canceled. + #[stable(feature = "rust1", since = "1.0.0")] TimedOut, /// An error returned when an operation could not be completed because a /// call to `write` returned `Ok(0)`. @@ -93,11 +105,23 @@ pub enum ErrorKind { /// This typically means that an operation could only succeed if it wrote a /// particular number of bytes but only a smaller number of bytes could be /// written. + #[stable(feature = "rust1", since = "1.0.0")] WriteZero, - /// This operation was interrupted + /// This operation was interrupted. + /// + /// Interrupted operations can typically be retried. + #[stable(feature = "rust1", since = "1.0.0")] Interrupted, /// Any I/O error not part of this list. + #[stable(feature = "rust1", since = "1.0.0")] Other, + + /// Any I/O error not part of this list. + #[unstable(feature = "std_misc", + reason = "better expressed through extensible enums that this \ + enum cannot be exhaustively matched against")] + #[doc(hidden)] + __Nonexhaustive, } impl Error { @@ -134,6 +158,19 @@ impl Error { Error { repr: Repr::Os(code) } } + /// Returns the OS error that this error represents (if any). + /// + /// If this `Error` was constructed via `last_os_error` then this function + /// will return `Some`, otherwise it will return `None`. + #[unstable(feature = "io", reason = "function was just added and the return \ + type may become an abstract OS error")] + pub fn raw_os_error(&self) -> Option<i32> { + match self.repr { + Repr::Os(i) => Some(i), + Repr::Custom(..) => None, + } + } + /// Return the corresponding `ErrorKind` for this error. #[stable(feature = "rust1", since = "1.0.0")] pub fn kind(&self) -> ErrorKind { diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index d9e8047104a..237435d6dfb 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -20,18 +20,10 @@ use iter::Iterator; use marker::Sized; use ops::{Drop, FnOnce}; use option::Option::{self, Some, None}; -#[cfg(stage0)] -use ptr::PtrExt; use result::Result::{Ok, Err}; use result; -#[cfg(stage0)] -use slice::{self, SliceExt}; -#[cfg(not(stage0))] use slice; use string::String; -#[cfg(stage0)] -use str::{self, StrExt}; -#[cfg(not(stage0))] use str; use vec::Vec; @@ -592,7 +584,8 @@ pub trait BufRead: Read { read_until(self, byte, buf) } - /// Read all bytes until a newline byte (the 0xA byte) is reached. + /// Read all bytes until a newline byte (the 0xA byte) is reached, and + /// append them to the provided buffer. /// /// This function will continue to read (and buffer) bytes from the /// underlying stream until the newline delimiter (the 0xA byte) or EOF is diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index 75d047d5c9c..53f67766ea6 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -19,7 +19,7 @@ use io::{self, BufReader, LineWriter}; use sync::{Arc, Mutex, MutexGuard}; use sys::stdio; -/// Stdout used by print! and println! macroses +/// Stdout used by print! and println! macros thread_local! { static LOCAL_STDOUT: RefCell<Option<Box<Write + Send>>> = { RefCell::new(None) @@ -146,7 +146,7 @@ impl Stdin { /// accessing the underlying data. #[stable(feature = "rust1", since = "1.0.0")] pub fn lock(&self) -> StdinLock { - StdinLock { inner: self.inner.lock().unwrap() } + StdinLock { inner: self.inner.lock().unwrap_or_else(|e| e.into_inner()) } } /// Locks this handle and reads a line of input into the specified buffer. @@ -249,7 +249,7 @@ impl Stdout { /// returned guard also implements the `Write` trait for writing data. #[stable(feature = "rust1", since = "1.0.0")] pub fn lock(&self) -> StdoutLock { - StdoutLock { inner: self.inner.lock().unwrap() } + StdoutLock { inner: self.inner.lock().unwrap_or_else(|e| e.into_inner()) } } } @@ -319,7 +319,7 @@ impl Stderr { /// returned guard also implements the `Write` trait for writing data. #[stable(feature = "rust1", since = "1.0.0")] pub fn lock(&self) -> StderrLock { - StderrLock { inner: self.inner.lock().unwrap() } + StderrLock { inner: self.inner.lock().unwrap_or_else(|e| e.into_inner()) } } } @@ -402,3 +402,29 @@ pub fn _print(args: fmt::Arguments) { panic!("failed printing to stdout: {}", e); } } + +#[cfg(test)] +mod test { + use thread; + use super::*; + + #[test] + fn panic_doesnt_poison() { + thread::spawn(|| { + let _a = stdin(); + let _a = _a.lock(); + let _a = stdout(); + let _a = _a.lock(); + let _a = stderr(); + let _a = _a.lock(); + panic!(); + }).join().unwrap_err(); + + let _a = stdin(); + let _a = _a.lock(); + let _a = stdout(); + let _a = _a.lock(); + let _a = stderr(); + let _a = _a.lock(); + } +} diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 81e2113cfdf..b055796ba54 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -73,10 +73,10 @@ //! //! ## Concurrency, I/O, and the runtime //! -//! The [`thread`](thread/index.html) module contains Rust's threading abstractions, -//! while [`comm`](comm/index.html) contains the channel types for message -//! passing. [`sync`](sync/index.html) contains further, primitive, shared -//! memory types, including [`atomic`](sync/atomic/index.html). +//! The [`thread`](thread/index.html) module contains Rust's threading abstractions. +//! [`sync`](sync/index.html) contains further, primitive, shared memory types, +//! including [`atomic`](sync/atomic/index.html), and [`mpsc`](sync/mpmc/index.html), +//! which contains the channel types for message passing. //! //! Common types of I/O, including files, TCP, UDP, pipes, Unix domain sockets, //! timers, and process spawning, are defined in the @@ -127,6 +127,7 @@ #![feature(int_uint)] #![feature(unique)] #![feature(allow_internal_unstable)] +#![feature(str_char)] #![cfg_attr(test, feature(test, rustc_private))] // Don't link to std. We are std. diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index e1ef3062794..f4a7e8b1b98 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -404,4 +404,18 @@ pub mod builtin { /// ``` #[macro_export] macro_rules! cfg { ($cfg:tt) => ({ /* compiler built-in */ }) } + + /// Parse the current given file as an expression. + /// + /// This is generally a bad idea, because it's going to behave unhygenically. + /// + /// # Examples + /// + /// ```ignore + /// fn foo() { + /// include!("/path/to/a/file") + /// } + /// ``` + #[macro_export] + macro_rules! include { ($cfg:tt) => ({ /* compiler built-in */ }) } } diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index c5f2ae53d22..73c2464a6b2 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -202,7 +202,7 @@ impl FromInner<libc::in_addr> for Ipv4Addr { impl Ipv6Addr { /// Create a new IPv6 address from eight 16-bit segments. /// - /// The result will represent the IP address a:b:c:d:e:f + /// The result will represent the IP address a:b:c:d:e:f:g:h #[stable(feature = "rust1", since = "1.0.0")] pub fn new(a: u16, b: u16, c: u16, d: u16, e: u16, f: u16, g: u16, h: u16) -> Ipv6Addr { diff --git a/src/libstd/net/mod.rs b/src/libstd/net/mod.rs index 36f36af73e1..543fdd16f41 100644 --- a/src/libstd/net/mod.rs +++ b/src/libstd/net/mod.rs @@ -25,6 +25,7 @@ pub use self::ip::{Ipv4Addr, Ipv6Addr, Ipv6MulticastScope}; pub use self::addr::{SocketAddr, SocketAddrV4, SocketAddrV6, ToSocketAddrs}; pub use self::tcp::{TcpStream, TcpListener}; pub use self::udp::UdpSocket; +pub use self::parser::AddrParseError; mod ip; mod addr; diff --git a/src/libstd/net/parser.rs b/src/libstd/net/parser.rs index 9843a152718..e7509834c7b 100644 --- a/src/libstd/net/parser.rs +++ b/src/libstd/net/parser.rs @@ -296,35 +296,40 @@ impl<'a> Parser<'a> { } } +#[stable(feature = "rust1", since = "1.0.0")] impl FromStr for Ipv4Addr { - type Err = ParseError; - fn from_str(s: &str) -> Result<Ipv4Addr, ParseError> { + type Err = AddrParseError; + fn from_str(s: &str) -> Result<Ipv4Addr, AddrParseError> { match Parser::new(s).read_till_eof(|p| p.read_ipv4_addr()) { Some(s) => Ok(s), - None => Err(ParseError) + None => Err(AddrParseError(())) } } } +#[stable(feature = "rust1", since = "1.0.0")] impl FromStr for Ipv6Addr { - type Err = ParseError; - fn from_str(s: &str) -> Result<Ipv6Addr, ParseError> { + type Err = AddrParseError; + fn from_str(s: &str) -> Result<Ipv6Addr, AddrParseError> { match Parser::new(s).read_till_eof(|p| p.read_ipv6_addr()) { Some(s) => Ok(s), - None => Err(ParseError) + None => Err(AddrParseError(())) } } } +#[stable(feature = "rust1", since = "1.0.0")] impl FromStr for SocketAddr { - type Err = ParseError; - fn from_str(s: &str) -> Result<SocketAddr, ParseError> { + type Err = AddrParseError; + fn from_str(s: &str) -> Result<SocketAddr, AddrParseError> { match Parser::new(s).read_till_eof(|p| p.read_socket_addr()) { Some(s) => Ok(s), - None => Err(ParseError), + None => Err(AddrParseError(())), } } } -#[derive(Debug, Clone, PartialEq, Copy)] -pub struct ParseError; +/// An error returned when parsing an IP address or a socket address. +#[stable(feature = "rust1", since = "1.0.0")] +#[derive(Debug, Clone, PartialEq)] +pub struct AddrParseError(()); diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs index 501ba2dc2c1..f263d7d72d3 100644 --- a/src/libstd/net/tcp.rs +++ b/src/libstd/net/tcp.rs @@ -273,8 +273,7 @@ mod tests { match TcpListener::bind("1.1.1.1:9999") { Ok(..) => panic!(), Err(e) => - // EADDRNOTAVAIL is mapped to ConnectionRefused - assert_eq!(e.kind(), ErrorKind::ConnectionRefused), + assert_eq!(e.kind(), ErrorKind::AddrNotAvailable), } } @@ -282,8 +281,11 @@ mod tests { fn connect_error() { match TcpStream::connect("0.0.0.0:1") { Ok(..) => panic!(), - Err(e) => assert!((e.kind() == ErrorKind::ConnectionRefused) - || (e.kind() == ErrorKind::InvalidInput)), + Err(e) => assert!(e.kind() == ErrorKind::ConnectionRefused || + e.kind() == ErrorKind::InvalidInput || + e.kind() == ErrorKind::AddrInUse || + e.kind() == ErrorKind::AddrNotAvailable, + "bad error: {} {:?}", e, e.kind()), } } @@ -535,7 +537,8 @@ mod tests { Ok(..) => panic!(), Err(e) => { assert!(e.kind() == ErrorKind::ConnectionRefused || - e.kind() == ErrorKind::Other, + e.kind() == ErrorKind::Other || + e.kind() == ErrorKind::AddrInUse, "unknown error: {} {:?}", e, e.kind()); } } diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs index a7825c4f93a..b5513dfd035 100644 --- a/src/libstd/num/f32.rs +++ b/src/libstd/num/f32.rs @@ -191,8 +191,8 @@ impl Float for f32 { /// Constructs a floating point number by multiplying `x` by 2 raised to the /// power of `exp` #[inline] - fn ldexp(x: f32, exp: int) -> f32 { - unsafe { cmath::ldexpf(x, exp as c_int) } + fn ldexp(self, exp: isize) -> f32 { + unsafe { cmath::ldexpf(self, exp as c_int) } } /// Breaks the number into a normalized fraction and a base-2 exponent, @@ -357,7 +357,6 @@ impl Float for f32 { } } -#[cfg(not(stage0))] #[cfg(not(test))] #[lang = "f32"] #[stable(feature = "rust1", since = "1.0.0")] @@ -2208,8 +2207,8 @@ mod tests { let f1: f32 = FromStrRadix::from_str_radix("1p-123", 16).unwrap(); let f2: f32 = FromStrRadix::from_str_radix("1p-111", 16).unwrap(); let f3: f32 = FromStrRadix::from_str_radix("1.Cp-12", 16).unwrap(); - assert_eq!(Float::ldexp(1f32, -123), f1); - assert_eq!(Float::ldexp(1f32, -111), f2); + assert_eq!(1f32.ldexp(-123), f1); + assert_eq!(1f32.ldexp(-111), f2); assert_eq!(Float::ldexp(1.75f32, -12), f3); assert_eq!(Float::ldexp(0f32, -123), 0f32); diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs index f3978cae485..61bddc3d18f 100644 --- a/src/libstd/num/f64.rs +++ b/src/libstd/num/f64.rs @@ -200,8 +200,8 @@ impl Float for f64 { fn to_radians(self) -> f64 { num::Float::to_radians(self) } #[inline] - fn ldexp(x: f64, exp: int) -> f64 { - unsafe { cmath::ldexp(x, exp as c_int) } + fn ldexp(self, exp: isize) -> f64 { + unsafe { cmath::ldexp(self, exp as c_int) } } /// Breaks the number into a normalized fraction and a base-2 exponent, @@ -366,7 +366,6 @@ impl Float for f64 { } } -#[cfg(not(stage0))] #[cfg(not(test))] #[lang = "f64"] #[stable(feature = "rust1", since = "1.0.0")] @@ -2215,8 +2214,8 @@ mod tests { let f1: f64 = FromStrRadix::from_str_radix("1p-123", 16).unwrap(); let f2: f64 = FromStrRadix::from_str_radix("1p-111", 16).unwrap(); let f3: f64 = FromStrRadix::from_str_radix("1.Cp-12", 16).unwrap(); - assert_eq!(Float::ldexp(1f64, -123), f1); - assert_eq!(Float::ldexp(1f64, -111), f2); + assert_eq!(1f64.ldexp(-123), f1); + assert_eq!(1f64.ldexp(-111), f2); assert_eq!(Float::ldexp(1.75f64, -12), f3); assert_eq!(Float::ldexp(0f64, -123), 0f64); diff --git a/src/libstd/num/float_macros.rs b/src/libstd/num/float_macros.rs index ece7af9c152..60a548b596b 100644 --- a/src/libstd/num/float_macros.rs +++ b/src/libstd/num/float_macros.rs @@ -11,17 +11,6 @@ #![unstable(feature = "std_misc")] #![doc(hidden)] -#[cfg(stage0)] -macro_rules! assert_approx_eq { - ($a:expr, $b:expr) => ({ - use num::Float; - let (a, b) = (&$a, &$b); - assert!((*a - *b).abs() < 1.0e-6, - "{} is not approximately equal to {}", *a, *b); - }) -} - -#[cfg(not(stage0))] macro_rules! assert_approx_eq { ($a:expr, $b:expr) => ({ let (a, b) = (&$a, &$b); diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs index 599f3f02a8b..082dad613b5 100644 --- a/src/libstd/num/mod.rs +++ b/src/libstd/num/mod.rs @@ -23,9 +23,6 @@ use marker::Copy; use clone::Clone; use cmp::{PartialOrd, PartialEq}; -#[cfg(stage0)] -pub use core::num::{Int, SignedInt, UnsignedInt}; -#[cfg(not(stage0))] pub use core::num::{Int, SignedInt}; pub use core::num::{cast, FromPrimitive, NumCast, ToPrimitive}; pub use core::num::{from_int, from_i8, from_i16, from_i32, from_i64}; @@ -702,7 +699,7 @@ pub trait Float /// ``` #[unstable(feature = "std_misc", reason = "pending integer conventions")] - fn ldexp(x: Self, exp: isize) -> Self; + fn ldexp(self, exp: isize) -> Self; /// Breaks the number into a normalized fraction and a base-2 exponent, /// satisfying: /// diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index ea1e05df85f..66826b359e6 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -16,17 +16,10 @@ use self::ExponentFormat::*; use self::SignificantDigits::*; use self::SignFormat::*; -#[cfg(stage0)] -use char::{self, CharExt}; -#[cfg(not(stage0))] use char; use num::{self, Int, Float, ToPrimitive}; use num::FpCategory as Fp; use ops::FnMut; -#[cfg(stage0)] -use slice::SliceExt; -#[cfg(stage0)] -use str::StrExt; use string::String; use vec::Vec; diff --git a/src/libstd/old_io/buffered.rs b/src/libstd/old_io/buffered.rs index 82a48a72499..56bc21303bb 100644 --- a/src/libstd/old_io/buffered.rs +++ b/src/libstd/old_io/buffered.rs @@ -20,8 +20,6 @@ use ops::Drop; use option::Option; use option::Option::{Some, None}; use result::Result::Ok; -#[cfg(stage0)] -use slice::{SliceExt}; use slice; use vec::Vec; diff --git a/src/libstd/old_io/comm_adapters.rs b/src/libstd/old_io/comm_adapters.rs index 33928d638e0..2dc61f409e2 100644 --- a/src/libstd/old_io/comm_adapters.rs +++ b/src/libstd/old_io/comm_adapters.rs @@ -14,9 +14,6 @@ use sync::mpsc::{Sender, Receiver}; use old_io; use option::Option::{None, Some}; use result::Result::{Ok, Err}; -#[cfg(stage0)] -use slice::{bytes, SliceExt}; -#[cfg(not(stage0))] use slice::bytes; use super::{Buffer, Reader, Writer, IoResult}; use vec::Vec; diff --git a/src/libstd/old_io/extensions.rs b/src/libstd/old_io/extensions.rs index a81275952c5..12c9970aa84 100644 --- a/src/libstd/old_io/extensions.rs +++ b/src/libstd/old_io/extensions.rs @@ -26,11 +26,7 @@ use num::Int; use ops::FnOnce; use option::Option; use option::Option::{Some, None}; -#[cfg(stage0)] -use ptr::PtrExt; use result::Result::{Ok, Err}; -#[cfg(stage0)] -use slice::SliceExt; /// An iterator that reads a single byte on each iteration, /// until `.read_byte()` returns `EndOfFile`. @@ -164,8 +160,6 @@ pub fn u64_to_be_bytes<T, F>(n: u64, size: uint, f: F) -> T where /// 32-bit value is parsed. pub fn u64_from_be_bytes(data: &[u8], start: uint, size: uint) -> u64 { use ptr::{copy_nonoverlapping_memory}; - #[cfg(stage0)] - use slice::SliceExt; assert!(size <= 8); diff --git a/src/libstd/old_io/fs.rs b/src/libstd/old_io/fs.rs index ff3af380b7d..2df925beb36 100644 --- a/src/libstd/old_io/fs.rs +++ b/src/libstd/old_io/fs.rs @@ -64,8 +64,6 @@ use option::Option::{Some, None}; use old_path::{Path, GenericPath}; use old_path; use result::Result::{Err, Ok}; -#[cfg(stage0)] -use slice::SliceExt; use string::String; use vec::Vec; diff --git a/src/libstd/old_io/mem.rs b/src/libstd/old_io/mem.rs index 72774334c13..eb7691361d4 100644 --- a/src/libstd/old_io/mem.rs +++ b/src/libstd/old_io/mem.rs @@ -17,9 +17,6 @@ use option::Option::None; use result::Result::{Err, Ok}; use old_io; use old_io::{Reader, Writer, Seek, Buffer, IoError, SeekStyle, IoResult}; -#[cfg(stage0)] -use slice::{self, SliceExt}; -#[cfg(not(stage0))] use slice; use vec::Vec; diff --git a/src/libstd/old_io/mod.rs b/src/libstd/old_io/mod.rs index 15a80e34451..6b6c36a31ec 100644 --- a/src/libstd/old_io/mod.rs +++ b/src/libstd/old_io/mod.rs @@ -251,8 +251,6 @@ pub use self::FileMode::*; pub use self::FileAccess::*; pub use self::IoErrorKind::*; -#[cfg(stage0)] -use char::CharExt; use default::Default; use error::Error; use fmt; @@ -268,10 +266,6 @@ use boxed::Box; use result::Result; use result::Result::{Ok, Err}; use sys; -#[cfg(stage0)] -use slice::SliceExt; -#[cfg(stage0)] -use str::StrExt; use str; use string::String; use usize; @@ -935,8 +929,6 @@ impl<'a> Reader for &'a mut (Reader+'a) { // API yet. If so, it should be a method on Vec. unsafe fn slice_vec_capacity<'a, T>(v: &'a mut Vec<T>, start: uint, end: uint) -> &'a mut [T] { use slice; - #[cfg(stage0)] - use ptr::PtrExt; assert!(start <= end); assert!(end <= v.capacity()); diff --git a/src/libstd/old_io/net/ip.rs b/src/libstd/old_io/net/ip.rs index 2dda2c1277a..077a5072570 100644 --- a/src/libstd/old_io/net/ip.rs +++ b/src/libstd/old_io/net/ip.rs @@ -26,11 +26,6 @@ use ops::{FnOnce, FnMut}; use option::Option; use option::Option::{None, Some}; use result::Result::{self, Ok, Err}; -#[cfg(stage0)] -use slice::SliceExt; -#[cfg(stage0)] -use str::{FromStr, StrExt}; -#[cfg(not(stage0))] use str::FromStr; use vec::Vec; diff --git a/src/libstd/old_io/stdio.rs b/src/libstd/old_io/stdio.rs index b699b93f2b8..4ca40382375 100644 --- a/src/libstd/old_io/stdio.rs +++ b/src/libstd/old_io/stdio.rs @@ -43,10 +43,6 @@ use ops::{Deref, DerefMut, FnOnce}; use ptr; use result::Result::{Ok, Err}; use rt; -#[cfg(stage0)] -use slice::SliceExt; -#[cfg(stage0)] -use str::StrExt; use string::String; use sys::{fs, tty}; use sync::{Arc, Mutex, MutexGuard, Once, ONCE_INIT}; diff --git a/src/libstd/old_io/tempfile.rs b/src/libstd/old_io/tempfile.rs index b34804fce61..04bfd4409cf 100644 --- a/src/libstd/old_io/tempfile.rs +++ b/src/libstd/old_io/tempfile.rs @@ -21,8 +21,6 @@ use option::Option; use old_path::{Path, GenericPath}; use rand::{Rng, thread_rng}; use result::Result::{Ok, Err}; -#[cfg(stage0)] -use str::StrExt; use string::String; /// A wrapper for a path to temporary directory implementing automatic diff --git a/src/libstd/old_path/mod.rs b/src/libstd/old_path/mod.rs index 5fc34c0fe92..fd117838f2f 100644 --- a/src/libstd/old_path/mod.rs +++ b/src/libstd/old_path/mod.rs @@ -72,11 +72,7 @@ use iter::IteratorExt; use option::Option; use option::Option::{None, Some}; use str; -#[cfg(stage0)] -use str::StrExt; use string::{String, CowString}; -#[cfg(stage0)] -use slice::SliceExt; use vec::Vec; /// Typedef for POSIX file paths. diff --git a/src/libstd/old_path/posix.rs b/src/libstd/old_path/posix.rs index c42f1e6b07d..4f28e9e44f1 100644 --- a/src/libstd/old_path/posix.rs +++ b/src/libstd/old_path/posix.rs @@ -20,13 +20,7 @@ use iter::{Iterator, IteratorExt, Map}; use marker::Sized; use option::Option::{self, Some, None}; use result::Result::{self, Ok, Err}; -#[cfg(stage0)] -use slice::{AsSlice, Split, SliceExt, SliceConcatExt}; -#[cfg(not(stage0))] use slice::{AsSlice, Split, SliceConcatExt}; -#[cfg(stage0)] -use str::{self, FromStr, StrExt}; -#[cfg(not(stage0))] use str::{self, FromStr}; use vec::Vec; diff --git a/src/libstd/old_path/windows.rs b/src/libstd/old_path/windows.rs index 6c5311d859c..ef873265b7b 100644 --- a/src/libstd/old_path/windows.rs +++ b/src/libstd/old_path/windows.rs @@ -15,8 +15,6 @@ use self::PathPrefix::*; use ascii::AsciiExt; -#[cfg(stage0)] -use char::CharExt; use clone::Clone; use cmp::{Ordering, Eq, Ord, PartialEq, PartialOrd}; use fmt; @@ -27,13 +25,7 @@ use iter::{Iterator, IteratorExt, Map, repeat}; use mem; use option::Option::{self, Some, None}; use result::Result::{self, Ok, Err}; -#[cfg(stage0)] -use slice::{SliceExt, SliceConcatExt}; -#[cfg(not(stage0))] use slice::SliceConcatExt; -#[cfg(stage0)] -use str::{SplitTerminator, FromStr, StrExt}; -#[cfg(not(stage0))] use str::{SplitTerminator, FromStr}; use string::{String, ToString}; use vec::Vec; diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 46233a46ee5..a1a3afca7a9 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -52,18 +52,10 @@ use option::Option::{Some, None}; use option::Option; use old_path::{Path, GenericPath, BytesContainer}; use path::{self, PathBuf}; -#[cfg(stage0)] -use ptr::PtrExt; use ptr; use result::Result::{Err, Ok}; use result::Result; -#[cfg(stage0)] -use slice::{AsSlice, SliceExt}; -#[cfg(not(stage0))] use slice::AsSlice; -#[cfg(stage0)] -use str::{Str, StrExt}; -#[cfg(not(stage0))] use str::Str; use str; use string::{String, ToString}; diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 2d97d651366..ddceed14cc6 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -159,8 +159,6 @@ mod platform { use core::prelude::*; use ascii::*; - #[cfg(stage0)] - use char::CharExt as UnicodeCharExt; use super::{os_str_as_u8_slice, u8_slice_as_os_str, Prefix}; use ffi::OsStr; diff --git a/src/libstd/prelude/v1.rs b/src/libstd/prelude/v1.rs index 4327b26260a..2aaf6e82800 100644 --- a/src/libstd/prelude/v1.rs +++ b/src/libstd/prelude/v1.rs @@ -25,9 +25,6 @@ // Reexported types and traits #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] pub use boxed::Box; -#[cfg(stage0)] -#[stable(feature = "rust1", since = "1.0.0")] -#[doc(no_inline)] pub use char::CharExt; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] pub use clone::Clone; #[stable(feature = "rust1", since = "1.0.0")] @@ -40,21 +37,10 @@ #[doc(no_inline)] pub use iter::{Iterator, IteratorExt, Extend}; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] pub use option::Option::{self, Some, None}; -#[cfg(stage0)] -#[stable(feature = "rust1", since = "1.0.0")] -#[doc(no_inline)] pub use ptr::{PtrExt, MutPtrExt}; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] pub use result::Result::{self, Ok, Err}; -#[cfg(stage0)] -#[stable(feature = "rust1", since = "1.0.0")] -#[doc(no_inline)] pub use slice::{SliceExt, SliceConcatExt, AsSlice}; -#[cfg(not(stage0))] #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] pub use slice::{SliceConcatExt, AsSlice}; -#[cfg(stage0)] -#[stable(feature = "rust1", since = "1.0.0")] -#[doc(no_inline)] pub use str::{Str, StrExt}; -#[cfg(not(stage0))] #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] pub use str::Str; #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/process.rs b/src/libstd/process.rs index df8a5d27c7f..cda37b19c48 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -668,7 +668,7 @@ mod tests { #[test] fn test_process_output_fail_to_start() { match Command::new("/no-binary-by-this-name-should-exist").output() { - Err(e) => assert_eq!(e.kind(), ErrorKind::FileNotFound), + Err(e) => assert_eq!(e.kind(), ErrorKind::NotFound), Ok(..) => panic!() } } diff --git a/src/libstd/rand/os.rs b/src/libstd/rand/os.rs index 46e35e0fa8b..51b6045cf16 100644 --- a/src/libstd/rand/os.rs +++ b/src/libstd/rand/os.rs @@ -24,8 +24,6 @@ mod imp { use rand::Rng; use rand::reader::ReaderRng; use result::Result::Ok; - #[cfg(stage0)] - use slice::SliceExt; use mem; use os::errno; @@ -194,8 +192,6 @@ mod imp { use rand::Rng; use result::Result::{Ok}; use self::libc::{c_int, size_t}; - #[cfg(stage0)] - use slice::SliceExt; /// A random number generator that retrieves randomness straight from /// the operating system. Platform sources: @@ -265,8 +261,6 @@ mod imp { use result::Result::{Ok, Err}; use self::libc::{DWORD, BYTE, LPCSTR, BOOL}; use self::libc::types::os::arch::extra::{LONG_PTR}; - #[cfg(stage0)] - use slice::SliceExt; type HCRYPTPROV = LONG_PTR; diff --git a/src/libstd/rand/reader.rs b/src/libstd/rand/reader.rs index 42c153af036..5231b122b9e 100644 --- a/src/libstd/rand/reader.rs +++ b/src/libstd/rand/reader.rs @@ -13,8 +13,6 @@ use old_io::Reader; use rand::Rng; use result::Result::{Ok, Err}; -#[cfg(stage0)] -use slice::SliceExt; /// An RNG that reads random bytes straight from a `Reader`. This will /// work best with an infinite reader, but this is not required. diff --git a/src/libstd/rt/at_exit_imp.rs b/src/libstd/rt/at_exit_imp.rs index f6bb87f011d..9fa12b1ef30 100644 --- a/src/libstd/rt/at_exit_imp.rs +++ b/src/libstd/rt/at_exit_imp.rs @@ -12,9 +12,6 @@ //! //! Documentation can be found on the `rt::at_exit` function. -#[cfg(stage0)] -use core::prelude::*; - use boxed; use boxed::Box; use vec::Vec; diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs index 20e29998d7c..e52e68dad23 100644 --- a/src/libstd/rt/mod.rs +++ b/src/libstd/rt/mod.rs @@ -30,7 +30,7 @@ use thunk::Thunk; use usize; // Reexport some of our utilities which are expected by other crates. -pub use self::util::{default_sched_threads, min_stack, running_on_valgrind}; +pub use self::util::{min_stack, running_on_valgrind}; pub use self::unwind::{begin_unwind, begin_unwind_fmt}; // Reexport some functionality from liballoc. diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs index e72fd7b3320..f1c43a07e6e 100644 --- a/src/libstd/rt/util.rs +++ b/src/libstd/rt/util.rs @@ -58,29 +58,6 @@ pub fn min_stack() -> uint { return amt; } -/// Get's the number of scheduler threads requested by the environment -/// either `RUST_THREADS` or `num_cpus`. -#[allow(deprecated)] -pub fn default_sched_threads() -> uint { - use os; - match env::var("RUST_THREADS") { - Ok(nstr) => { - let opt_n: Option<uint> = nstr.parse().ok(); - match opt_n { - Some(n) if n > 0 => n, - _ => panic!("`RUST_THREADS` is `{}`, should be a positive integer", nstr) - } - } - Err(..) => { - if limit_thread_creation_due_to_osx_and_valgrind() { - 1 - } else { - os::num_cpus() - } - } - } -} - // Indicates whether we should perform expensive sanity checks, including rtassert! // // FIXME: Once the runtime matures remove the `true` below to turn off rtassert, diff --git a/src/libstd/sys/common/rwlock.rs b/src/libstd/sys/common/rwlock.rs index fe374e1fd78..f7d7a5715bc 100644 --- a/src/libstd/sys/common/rwlock.rs +++ b/src/libstd/sys/common/rwlock.rs @@ -25,7 +25,7 @@ impl RWLock { /// thread to do so. /// /// Behavior is undefined if the rwlock has been moved between this and any - /// previous methodo call. + /// previous method call. #[inline] pub unsafe fn read(&self) { self.0.read() } @@ -35,7 +35,7 @@ impl RWLock { /// This function does not block the current thread. /// /// Behavior is undefined if the rwlock has been moved between this and any - /// previous methodo call. + /// previous method call. #[inline] pub unsafe fn try_read(&self) -> bool { self.0.try_read() } @@ -43,7 +43,7 @@ impl RWLock { /// to do so. /// /// Behavior is undefined if the rwlock has been moved between this and any - /// previous methodo call. + /// previous method call. #[inline] pub unsafe fn write(&self) { self.0.write() } @@ -53,7 +53,7 @@ impl RWLock { /// This function does not block the current thread. /// /// Behavior is undefined if the rwlock has been moved between this and any - /// previous methodo call. + /// previous method call. #[inline] pub unsafe fn try_write(&self) -> bool { self.0.try_write() } diff --git a/src/libstd/sys/common/wtf8.rs b/src/libstd/sys/common/wtf8.rs index dfc88571a82..3cc91bf54b4 100644 --- a/src/libstd/sys/common/wtf8.rs +++ b/src/libstd/sys/common/wtf8.rs @@ -172,18 +172,6 @@ impl Wtf8Buf { Wtf8Buf { bytes: string.into_bytes() } } - #[cfg(stage0)] - /// Create a WTF-8 string from an UTF-8 `&str` slice. - /// - /// This copies the content of the slice. - /// - /// Since WTF-8 is a superset of UTF-8, this always succeeds. - #[inline] - pub fn from_str(str: &str) -> Wtf8Buf { - Wtf8Buf { bytes: slice::SliceExt::to_vec(str.as_bytes()) } - } - - #[cfg(not(stage0))] /// Create a WTF-8 string from an UTF-8 `&str` slice. /// /// This copies the content of the slice. diff --git a/src/libstd/sys/unix/mod.rs b/src/libstd/sys/unix/mod.rs index a8cee74828d..5555eec4f39 100644 --- a/src/libstd/sys/unix/mod.rs +++ b/src/libstd/sys/unix/mod.rs @@ -139,22 +139,19 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind { libc::EPIPE => ErrorKind::BrokenPipe, libc::ENOTCONN => ErrorKind::NotConnected, libc::ECONNABORTED => ErrorKind::ConnectionAborted, - libc::EADDRNOTAVAIL => ErrorKind::ConnectionRefused, - libc::EADDRINUSE => ErrorKind::ConnectionRefused, - libc::ENOENT => ErrorKind::FileNotFound, - libc::EISDIR => ErrorKind::InvalidInput, + libc::EADDRNOTAVAIL => ErrorKind::AddrNotAvailable, + libc::EADDRINUSE => ErrorKind::AddrInUse, + libc::ENOENT => ErrorKind::NotFound, libc::EINTR => ErrorKind::Interrupted, libc::EINVAL => ErrorKind::InvalidInput, - libc::ENOTTY => ErrorKind::MismatchedFileTypeForOperation, libc::ETIMEDOUT => ErrorKind::TimedOut, - libc::ECANCELED => ErrorKind::TimedOut, - libc::consts::os::posix88::EEXIST => ErrorKind::PathAlreadyExists, + libc::consts::os::posix88::EEXIST => ErrorKind::AlreadyExists, // These two constants can have the same value on some systems, // but different values on others, so we can't use a match // clause x if x == libc::EAGAIN || x == libc::EWOULDBLOCK => - ErrorKind::ResourceUnavailable, + ErrorKind::WouldBlock, _ => ErrorKind::Other, } diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index 75aeafe6e3c..a5a2f71acb7 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -306,12 +306,11 @@ pub fn args() -> Args { // In general it looks like: // res = Vec::new() // let args = [[NSProcessInfo processInfo] arguments] -// for i in range(0, [args count]) +// for i in (0..[args count]) // res.push([args objectAtIndex:i]) // res #[cfg(target_os = "ios")] pub fn args() -> Args { - use iter::range; use mem; #[link(name = "objc")] @@ -341,7 +340,7 @@ pub fn args() -> Args { let args = objc_msgSend(info, arguments_sel); let cnt: int = mem::transmute(objc_msgSend(args, count_sel)); - for i in range(0, cnt) { + for i in (0..cnt) { let tmp = objc_msgSend(args, object_at_sel, i); let utf_c_str: *const libc::c_char = mem::transmute(objc_msgSend(tmp, utf8_sel)); diff --git a/src/libstd/sys/unix/os_str.rs b/src/libstd/sys/unix/os_str.rs index 99591480752..3b8d18d87a0 100644 --- a/src/libstd/sys/unix/os_str.rs +++ b/src/libstd/sys/unix/os_str.rs @@ -16,8 +16,6 @@ use core::prelude::*; use borrow::Cow; use fmt::{self, Debug}; use vec::Vec; -#[cfg(stage0)] -use slice::SliceExt as StdSliceExt; use str; use string::String; use mem; diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index 04508294981..c5f07c6c75a 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -130,12 +130,13 @@ pub mod guard { #[cfg(any(target_os = "openbsd", target_os = "bitrig"))] pub unsafe fn current() -> usize { #[repr(C)] - pub struct stack_t { + struct stack_t { ss_sp: *mut libc::c_void, ss_size: libc::size_t, ss_flags: libc::c_int, } extern { + fn pthread_main_np() -> libc::c_uint; fn pthread_stackseg_np(thread: pthread_t, sinfo: *mut stack_t) -> libc::c_uint; } @@ -339,9 +340,6 @@ fn min_stack_size(_: *const libc::pthread_attr_t) -> libc::size_t { } extern { - #[cfg(any(target_os = "bitrig", target_os = "openbsd"))] - fn pthread_main_np() -> libc::c_uint; - fn pthread_self() -> libc::pthread_t; fn pthread_create(native: *mut libc::pthread_t, attr: *const libc::pthread_attr_t, diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs index d02fe79fcdb..eeaf4ced072 100644 --- a/src/libstd/sys/windows/mod.rs +++ b/src/libstd/sys/windows/mod.rs @@ -149,25 +149,21 @@ pub fn decode_error_detailed(errno: i32) -> IoError { pub fn decode_error_kind(errno: i32) -> ErrorKind { match errno as libc::c_int { libc::ERROR_ACCESS_DENIED => ErrorKind::PermissionDenied, - libc::ERROR_ALREADY_EXISTS => ErrorKind::PathAlreadyExists, + libc::ERROR_ALREADY_EXISTS => ErrorKind::AlreadyExists, libc::ERROR_BROKEN_PIPE => ErrorKind::BrokenPipe, - libc::ERROR_FILE_NOT_FOUND => ErrorKind::FileNotFound, - libc::ERROR_INVALID_FUNCTION => ErrorKind::InvalidInput, - libc::ERROR_INVALID_HANDLE => ErrorKind::MismatchedFileTypeForOperation, - libc::ERROR_INVALID_NAME => ErrorKind::InvalidInput, - libc::ERROR_NOTHING_TO_TERMINATE => ErrorKind::InvalidInput, + libc::ERROR_FILE_NOT_FOUND => ErrorKind::NotFound, libc::ERROR_NO_DATA => ErrorKind::BrokenPipe, libc::ERROR_OPERATION_ABORTED => ErrorKind::TimedOut, libc::WSAEACCES => ErrorKind::PermissionDenied, - libc::WSAEADDRINUSE => ErrorKind::ConnectionRefused, - libc::WSAEADDRNOTAVAIL => ErrorKind::ConnectionRefused, + libc::WSAEADDRINUSE => ErrorKind::AddrInUse, + libc::WSAEADDRNOTAVAIL => ErrorKind::AddrNotAvailable, libc::WSAECONNABORTED => ErrorKind::ConnectionAborted, libc::WSAECONNREFUSED => ErrorKind::ConnectionRefused, libc::WSAECONNRESET => ErrorKind::ConnectionReset, libc::WSAEINVAL => ErrorKind::InvalidInput, libc::WSAENOTCONN => ErrorKind::NotConnected, - libc::WSAEWOULDBLOCK => ErrorKind::ResourceUnavailable, + libc::WSAEWOULDBLOCK => ErrorKind::WouldBlock, _ => ErrorKind::Other, } diff --git a/src/libstd/sys/windows/process2.rs b/src/libstd/sys/windows/process2.rs index e3cf5da59f0..4c2777459dd 100644 --- a/src/libstd/sys/windows/process2.rs +++ b/src/libstd/sys/windows/process2.rs @@ -128,8 +128,6 @@ impl Process { use env::split_paths; use mem; use iter::IteratorExt; - #[cfg(stage0)] - use str::StrExt; // To have the spawning semantics of unix/windows stay the same, we need to // read the *child's* PATH if one is provided. See #15149 for more details. |
