1
Fork 0

std: Stabilize APIs for the 1.6 release

This commit is the standard API stabilization commit for the 1.6 release cycle.
The list of issues and APIs below have all been through their cycle-long FCP and
the libs team decisions are listed below

Stabilized APIs

* `Read::read_exact`
* `ErrorKind::UnexpectedEof` (renamed from `UnexpectedEOF`)
* libcore -- this was a bit of a nuanced stabilization, the crate itself is now
  marked as `#[stable]` and the methods appearing via traits for primitives like
  `char` and `str` are now also marked as stable. Note that the extension traits
  themeselves are marked as unstable as they're imported via the prelude. The
  `try!` macro was also moved from the standard library into libcore to have the
  same interface. Otherwise the functions all have copied stability from the
  standard library now.
* The `#![no_std]` attribute
* `fs::DirBuilder`
* `fs::DirBuilder::new`
* `fs::DirBuilder::recursive`
* `fs::DirBuilder::create`
* `os::unix::fs::DirBuilderExt`
* `os::unix::fs::DirBuilderExt::mode`
* `vec::Drain`
* `vec::Vec::drain`
* `string::Drain`
* `string::String::drain`
* `vec_deque::Drain`
* `vec_deque::VecDeque::drain`
* `collections::hash_map::Drain`
* `collections::hash_map::HashMap::drain`
* `collections::hash_set::Drain`
* `collections::hash_set::HashSet::drain`
* `collections::binary_heap::Drain`
* `collections::binary_heap::BinaryHeap::drain`
* `Vec::extend_from_slice` (renamed from `push_all`)
* `Mutex::get_mut`
* `Mutex::into_inner`
* `RwLock::get_mut`
* `RwLock::into_inner`
* `Iterator::min_by_key` (renamed from `min_by`)
* `Iterator::max_by_key` (renamed from `max_by`)

Deprecated APIs

* `ErrorKind::UnexpectedEOF` (renamed to `UnexpectedEof`)
* `OsString::from_bytes`
* `OsStr::to_cstring`
* `OsStr::to_bytes`
* `fs::walk_dir` and `fs::WalkDir`
* `path::Components::peek`
* `slice::bytes::MutableByteVector`
* `slice::bytes::copy_memory`
* `Vec::push_all` (renamed to `extend_from_slice`)
* `Duration::span`
* `IpAddr`
* `SocketAddr::ip`
* `Read::tee`
* `io::Tee`
* `Write::broadcast`
* `io::Broadcast`
* `Iterator::min_by` (renamed to `min_by_key`)
* `Iterator::max_by` (renamed to `max_by_key`)
* `net::lookup_addr`

New APIs (still unstable)

* `<[T]>::sort_by_key` (added to mirror `min_by_key`)

Closes #27585
Closes #27704
Closes #27707
Closes #27710
Closes #27711
Closes #27727
Closes #27740
Closes #27744
Closes #27799
Closes #27801
cc #27801 (doesn't close as `Chars` is still unstable)
Closes #28968
This commit is contained in:
Alex Crichton 2015-12-02 17:31:49 -08:00
parent ac0e845224
commit 464cdff102
165 changed files with 712 additions and 718 deletions

View file

@ -91,6 +91,8 @@ pub struct DirEntry(fs_imp::DirEntry);
may change and this may end up accounting for files such \
as symlinks differently",
issue = "27707")]
#[rustc_deprecated(reason = "superceded by the walkdir crate",
since = "1.6.0")]
pub struct WalkDir {
cur: Option<ReadDir>,
stack: Vec<io::Result<ReadDir>>,
@ -156,8 +158,7 @@ pub struct FileType(fs_imp::FileType);
/// A builder used to create directories in various manners.
///
/// This builder also supports platform-specific options.
#[unstable(feature = "dir_builder", reason = "recently added API",
issue = "27710")]
#[stable(feature = "dir_builder", since = "1.6.0")]
pub struct DirBuilder {
inner: fs_imp::DirBuilder,
recursive: bool,
@ -1132,16 +1133,23 @@ pub fn read_dir<P: AsRef<Path>>(path: P) -> io::Result<ReadDir> {
may change and this may end up accounting for files such \
as symlinks differently",
issue = "27707")]
#[rustc_deprecated(reason = "superceded by the walkdir crate",
since = "1.6.0")]
#[allow(deprecated)]
pub fn walk_dir<P: AsRef<Path>>(path: P) -> io::Result<WalkDir> {
_walk_dir(path.as_ref())
}
#[allow(deprecated)]
fn _walk_dir(path: &Path) -> io::Result<WalkDir> {
let start = try!(read_dir(path));
Ok(WalkDir { cur: Some(start), stack: Vec::new() })
}
#[unstable(feature = "fs_walk", issue = "27707")]
#[rustc_deprecated(reason = "superceded by the walkdir crate",
since = "1.6.0")]
#[allow(deprecated)]
impl Iterator for WalkDir {
type Item = io::Result<DirEntry>;
@ -1275,11 +1283,10 @@ pub fn set_permissions<P: AsRef<Path>>(path: P, perm: Permissions)
fs_imp::set_perm(path.as_ref(), perm.0)
}
#[unstable(feature = "dir_builder", reason = "recently added API",
issue = "27710")]
impl DirBuilder {
/// Creates a new set of options with default mode/security settings for all
/// platforms and also non-recursive.
#[stable(feature = "dir_builder", since = "1.6.0")]
pub fn new() -> DirBuilder {
DirBuilder {
inner: fs_imp::DirBuilder::new(),
@ -1292,6 +1299,7 @@ impl DirBuilder {
/// permissions settings.
///
/// This option defaults to `false`
#[stable(feature = "dir_builder", since = "1.6.0")]
pub fn recursive(&mut self, recursive: bool) -> &mut Self {
self.recursive = recursive;
self
@ -1303,7 +1311,6 @@ impl DirBuilder {
/// # Examples
///
/// ```no_run
/// #![feature(dir_builder)]
/// use std::fs::{self, DirBuilder};
///
/// let path = "/tmp/foo/bar/baz";
@ -1313,6 +1320,7 @@ impl DirBuilder {
///
/// assert!(fs::metadata(path).unwrap().is_dir());
/// ```
#[stable(feature = "dir_builder", since = "1.6.0")]
pub fn create<P: AsRef<Path>>(&self, path: P) -> io::Result<()> {
self._create(path.as_ref())
}