std: Stabilize the prelude module

This commit is an implementation of [RFC 503][rfc] which is a stabilization
story for the prelude. Most of the RFC was directly applied, removing reexports.
Some reexports are kept around, however:

* `range` remains until range syntax has landed to reduce churn.
* `Path` and `GenericPath` remain until path reform lands. This is done to
  prevent many imports of `GenericPath` which will soon be removed.
* All `io` traits remain until I/O reform lands so imports can be rewritten all
  at once to `std::io::prelude::*`.

This is a breaking change because many prelude reexports have been removed, and
the RFC can be consulted for the exact list of removed reexports, as well as to
find the locations of where to import them.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0503-prelude-stabilization.md
[breaking-change]

Closes #20068
This commit is contained in:
Alex Crichton 2014-12-22 09:04:23 -08:00
parent 3dcc409fac
commit c32d03f417
314 changed files with 1616 additions and 1155 deletions

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use prelude::*;
use prelude::v1::*;
use io::IoResult;

View file

@ -20,12 +20,13 @@
//! can be created in the future and there must be no active timers at that
//! time.
use prelude::*;
use prelude::v1::*;
use cell::UnsafeCell;
use comm::{channel, Sender, Receiver};
use mem;
use sync::{StaticMutex, StaticCondvar};
use rt;
use sync::{StaticMutex, StaticCondvar};
use sys::helper_signal;
use thread::Thread;

View file

@ -12,7 +12,7 @@
#![allow(dead_code)]
use io::{mod, IoError, IoResult};
use prelude::*;
use prelude::v1::*;
use sys::{last_error, retry};
use c_str::CString;
use num::Int;

View file

@ -8,23 +8,23 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use prelude::v1::*;
use self::SocketStatus::*;
use self::InAddr::*;
use alloc::arc::Arc;
use c_str::ToCStr;
use io::net::addrinfo;
use io::net::ip::{SocketAddr, IpAddr, Ipv4Addr, Ipv6Addr};
use io::{IoResult, IoError};
use libc::{mod, c_char, c_int};
use mem;
use num::Int;
use ptr::{mod, null, null_mut};
use io::net::ip::{SocketAddr, IpAddr, Ipv4Addr, Ipv6Addr};
use io::net::addrinfo;
use io::{IoResult, IoError};
use sys::{mod, retry, c, sock_t, last_error, last_net_error, last_gai_error, close_sock,
wrlen, msglen_t, os, wouldblock, set_nonblocking, timer, ms_to_timeval,
decode_error_detailed};
use sync::{Mutex, MutexGuard};
use sync::{Arc, Mutex, MutexGuard};
use sys_common::{mod, keep_going, short_write, timeout};
use prelude::*;
use cmp;
use io;

View file

@ -56,7 +56,7 @@
#![allow(non_camel_case_types)]
use prelude::*;
use prelude::v1::*;
use sync::atomic::{mod, AtomicUint};
use sync::{Mutex, Once, ONCE_INIT};
@ -246,7 +246,7 @@ impl Drop for Key {
#[cfg(test)]
mod tests {
use prelude::*;
use prelude::v1::*;
use super::{Key, StaticKey, INIT_INNER};
fn assert_sync<T: Sync>() {}

View file

@ -10,16 +10,15 @@
//! Blocking posix-based file I/O
use libc::{mod, c_int, c_void};
use c_str::CString;
use mem;
use io;
use prelude::*;
use prelude::v1::*;
use c_str::{CString, ToCStr};
use io::{FilePermission, Write, UnstableFileStat, Open, FileAccess, FileMode};
use io::{IoResult, FileStat, SeekStyle};
use io::{Read, Truncate, SeekCur, SeekSet, ReadWrite, SeekEnd, Append};
use io;
use libc::{mod, c_int, c_void};
use mem;
use sys::retry;
use sys_common::{keep_going, eof, mkerr_libc};
@ -360,7 +359,7 @@ mod tests {
use super::FileDesc;
use libc;
use os;
use prelude::*;
use prelude::v1::*;
#[cfg_attr(target_os = "freebsd", ignore)] // hmm, maybe pipes have a tiny buffer
#[test]

View file

@ -19,7 +19,7 @@ extern crate libc;
use num;
use num::{Int, SignedInt};
use prelude::*;
use prelude::v1::*;
use io::{mod, IoResult, IoError};
use sys_common::mkerr_libc;

View file

@ -10,17 +10,18 @@
//! Implementation of `std::os` functionality for unix systems
use prelude::*;
use prelude::v1::*;
use c_str::ToCStr;
use error::{FromError, Error};
use fmt;
use io::{IoError, IoResult};
use libc::{mod, c_int, c_char, c_void};
use path::BytesContainer;
use os;
use path::{BytesContainer};
use ptr;
use sync::atomic::{AtomicInt, INIT_ATOMIC_INT, SeqCst};
use sys::fs::FileDesc;
use os;
use os::TMPBUF_SZ;

View file

@ -8,13 +8,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use alloc::arc::Arc;
use prelude::v1::*;
use libc;
use c_str::CString;
use mem;
use sync::{atomic, Mutex};
use sync::{atomic, Arc, Mutex};
use io::{mod, IoResult, IoError};
use prelude::*;
use sys::{mod, timer, retry, c, set_nonblocking, wouldblock};
use sys::fs::{fd_t, FileDesc};

View file

@ -7,22 +7,23 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use prelude::v1::*;
use self::Req::*;
use libc::{mod, pid_t, c_void, c_int};
use c_str::CString;
use c_str::{CString, ToCStr};
use collections;
use comm::{channel, Sender, Receiver};
use hash::Hash;
use io::process::{ProcessExit, ExitStatus, ExitSignal};
use io::{mod, IoResult, IoError, EndOfFile};
use libc::{mod, pid_t, c_void, c_int};
use mem;
use os;
use ptr;
use prelude::*;
use io::process::{ProcessExit, ExitStatus, ExitSignal};
use collections;
use path::BytesContainer;
use hash::Hash;
use sys::{mod, retry, c, wouldblock, set_nonblocking, ms_to_timeval};
use ptr;
use sys::fs::FileDesc;
use sys::{mod, retry, c, wouldblock, set_nonblocking, ms_to_timeval};
use sys_common::helper_thread::Helper;
use sys_common::{AsInner, mkerr_libc, timeout};

View file

@ -8,12 +8,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use prelude::v1::*;
use io::net::ip;
use io::IoResult;
use libc;
use mem;
use ptr;
use prelude::*;
use super::{last_error, last_net_error, retry, sock_t};
use sync::{Arc, atomic};
use sys::fs::FileDesc;

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use prelude::*;
use prelude::v1::*;
use libc::c_int;
pub type Key = pthread_key_t;

View file

@ -46,19 +46,19 @@
//!
//! Note that all time units in this file are in *milliseconds*.
use prelude::v1::*;
use self::Req::*;
use comm::{mod, channel, Sender, Receiver};
use io::IoResult;
use libc;
use mem;
use os;
use ptr;
use sync::atomic;
use comm;
use sys::c;
use sys::fs::FileDesc;
use sys_common::helper_thread::Helper;
use prelude::*;
use io::IoResult;
helper_init! { static HELPER: Helper<Req> }

View file

@ -8,8 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use prelude::v1::*;
use sys::fs::FileDesc;
use prelude::*;
use libc::{mod, c_int};
use io::{mod, IoResult, IoError};
use sys_common;

View file

@ -15,7 +15,7 @@
#![allow(non_camel_case_types)]
use libc;
use prelude::*;
use prelude::v1::*;
pub const WSADESCRIPTION_LEN: uint = 256;
pub const WSASYS_STATUS_LEN: uint = 128;
@ -133,7 +133,7 @@ pub mod compat {
use intrinsics::{atomic_store_relaxed, transmute};
use iter::IteratorExt;
use libc::types::os::arch::extra::{LPCWSTR, HMODULE, LPCSTR, LPVOID};
use prelude::*;
use prelude::v1::*;
extern "system" {
fn GetModuleHandleW(lpModuleName: LPCWSTR) -> HMODULE;

View file

@ -21,7 +21,7 @@ use ptr;
use str;
use io;
use prelude::*;
use prelude::v1::*;
use sys;
use sys::os;
use sys_common::{keep_going, eof, mkerr_libc};

View file

@ -18,9 +18,10 @@
extern crate libc;
use prelude::v1::*;
use num;
use mem;
use prelude::*;
use io::{mod, IoResult, IoError};
use sync::{Once, ONCE_INIT};

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use prelude::*;
use prelude::v1::*;
use sync::atomic;
use alloc::{mod, heap};

View file

@ -13,7 +13,7 @@
// FIXME: move various extern bindings from here into liblibc or
// something similar
use prelude::*;
use prelude::v1::*;
use fmt;
use io::{IoResult, IoError};

View file

@ -84,14 +84,14 @@
//! the test suite passing (the suite is in libstd), and that's good enough for
//! me!
use alloc::arc::Arc;
use prelude::v1::*;
use libc;
use c_str::CString;
use mem;
use ptr;
use sync::{atomic, Mutex};
use sync::{atomic, Arc, Mutex};
use io::{mod, IoError, IoResult};
use prelude::*;
use sys_common::{mod, eof};

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use prelude::v1::*;
use libc::{pid_t, c_void, c_int};
use libc;
use c_str::CString;
@ -15,7 +17,6 @@ use io;
use mem;
use os;
use ptr;
use prelude::*;
use io::process::{ProcessExit, ExitStatus, ExitSignal};
use collections;
use path::BytesContainer;
@ -469,7 +470,7 @@ mod tests {
#[test]
fn test_make_command_line() {
use prelude::*;
use prelude::v1::*;
use str;
use c_str::CString;
use super::make_command_line;

View file

@ -13,7 +13,7 @@ use io::IoResult;
use libc;
use mem;
use ptr;
use prelude::*;
use prelude::v1::*;
use super::{last_error, last_net_error, retry, sock_t};
use sync::{Arc, atomic};
use sys::fs::FileDesc;

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use prelude::*;
use prelude::v1::*;
use libc::types::os::arch::extra::{DWORD, LPVOID, BOOL};

View file

@ -29,7 +29,7 @@ use comm;
use sys::c;
use sys::fs::FileDesc;
use sys_common::helper_thread::Helper;
use prelude::*;
use prelude::v1::*;
use io::IoResult;
helper_init! { static HELPER: Helper<Req> }

View file

@ -25,6 +25,8 @@
//! wrapper that performs encoding/decoding, this implementation should switch
//! to working in raw UTF-16, with such a wrapper around it.
use prelude::v1::*;
use super::c::{ReadConsoleW, WriteConsoleW, GetConsoleMode, SetConsoleMode};
use super::c::{ERROR_ILLEGAL_CHARACTER};
use super::c::{ENABLE_ECHO_INPUT, ENABLE_EXTENDED_FLAGS};
@ -34,7 +36,6 @@ use libc::{c_int, HANDLE, LPDWORD, DWORD, LPVOID};
use libc::{get_osfhandle, CloseHandle};
use libc::types::os::arch::extra::LPCVOID;
use io::{mod, IoError, IoResult, MemReader};
use prelude::*;
use ptr;
use str::from_utf8;