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

@ -10,7 +10,7 @@
// no-prefer-dynamic
#![feature(allocator, no_std, core, core_intrinsics, libc)]
#![feature(allocator, core_intrinsics, libc)]
#![allocator]
#![crate_type = "rlib"]
#![no_std]

View file

@ -10,7 +10,7 @@
// no-prefer-dynamic
#![feature(allocator, no_std, core)]
#![feature(allocator)]
#![allocator]
#![crate_type = "rlib"]
#![no_std]

View file

@ -10,7 +10,7 @@
// no-prefer-dynamic
#![feature(allocator, no_std, core)]
#![feature(allocator)]
#![allocator]
#![crate_type = "rlib"]
#![no_std]

View file

@ -10,7 +10,7 @@
// no-prefer-dynamic
#![feature(no_std, allocator)]
#![feature(allocator)]
#![no_std]
#![allocator]
#![crate_type = "rlib"]

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(no_std, core, libc)]
#![feature(libc)]
#![no_std]
#![feature(lang_items)]

View file

@ -10,7 +10,7 @@
// no-prefer-dynamic
#![feature(no_std, needs_allocator)]
#![feature(needs_allocator)]
#![no_std]
#![needs_allocator]
#![crate_type = "rlib"]

View file

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(no_std)]
#![no_std]
pub fn foo() {}

View file

@ -13,7 +13,6 @@
// This aux-file will require the eh_personality function to be codegen'd, but
// it hasn't been defined just yet. Make sure we don't explode.
#![feature(no_std)]
#![no_std]
#![crate_type = "rlib"]

View file

@ -12,6 +12,6 @@
// https://github.com/rust-lang/rust/issues/21833#issuecomment-72353044
#![cfg_attr(broken, no_std)] //~ ERROR no_std is experimental
#![cfg_attr(broken, no_core)] //~ ERROR no_core is experimental
fn main() { }

View file

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(no_std)]
#![no_std]
extern crate core;

View file

@ -10,10 +10,9 @@
#![deny(dead_code)]
#![allow(unreachable_code)]
#![feature(core)]
#[macro_use] extern crate core;
#[macro_use]
extern crate core;
fn foo() { //~ ERROR function is never used

View file

@ -8,6 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![no_std] //~ ERROR no_std is experimental
#![no_core] //~ ERROR no_core is experimental
fn main() {}

View file

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(no_std)]
#![no_std]
#![allow(unused_variables)]
#![allow(non_camel_case_types)]

View file

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(no_std, core)]
#![no_std]
extern crate core; //~ ERROR: an external crate named `core` has already

View file

@ -12,8 +12,8 @@
// error-pattern: requires `owned_box` lang_item
#![feature(lang_items, box_syntax)]
#![no_std]
#![feature(lang_items, no_std, box_syntax)]
fn main() {
let x = box 1i32;

View file

@ -11,7 +11,6 @@
// Check that placement in respects unstable code checks.
#![feature(placement_in_syntax)]
#![feature(core)]
extern crate core;

View file

@ -12,7 +12,6 @@
#![crate_type = "lib"]
#![feature(lang_items)]
#![feature(no_std)]
#![no_std]
// OK

View file

@ -10,7 +10,7 @@
#![deny(unused_attributes)]
#![allow(dead_code, unused_imports)]
#![feature(core, custom_attribute)]
#![feature(custom_attribute)]
#![foo] //~ ERROR unused attribute

View file

@ -8,11 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Check that `pub extern crate` gives a warning.
#![feature(rustc_attrs)]
pub extern crate core; //~WARN `pub extern crate` does not work
//~^ ERROR core
fn main() {
}
#[rustc_error]
fn main() {} //~ ERROR: compilation successful

View file

@ -12,7 +12,6 @@
// error-pattern: language item required, but not found: `panic_fmt`
// error-pattern: language item required, but not found: `eh_personality`
#![feature(no_std)]
#![no_std]
extern crate core;

View file

@ -9,10 +9,8 @@
// except according to those terms.
#![crate_type = "rlib"]
#![feature(no_std)]
#![no_std]
#[inline]
pub unsafe fn allocate(_size: usize, _align: usize) -> *mut u8 { 0 as *mut u8 }

View file

@ -8,9 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(lang_items, no_std, libc)]
#![no_std]
#![feature(lang_items, libc)]
#![crate_type = "dylib"]
#![no_std]
extern crate libc;

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(lang_items, no_std, libc)]
#![feature(lang_items, libc)]
#![no_std]
#![crate_type = "dylib"]

View file

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(no_std)]
#![no_std]
#![crate_type = "lib"]
#![crate_name = "a"]

View file

@ -12,6 +12,6 @@
// pretty-expanded FIXME #23616
#![cfg_attr(not_used, no_std)]
#![cfg_attr(not_used, no_core)]
fn main() { }

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(no_std, rand, collections, rustc_private)]
#![feature(rand, collections, rustc_private)]
#![no_std]
extern crate rand;

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(lang_items, start, no_std, core_slice_ext, collections)]
#![feature(lang_items, start, collections)]
#![no_std]
extern crate std as other;

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(lang_items, start, no_std, collections)]
#![feature(lang_items, start, collections)]
#![no_std]
extern crate std as other;

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(unboxed_closures, core)]
#![feature(fn_traits, unboxed_closures)]
use std::ops::Fn;
struct Foo<T>(T);

View file

@ -10,7 +10,7 @@
// pretty-expanded FIXME #23616
#![feature(unboxed_closures, core)]
#![feature(fn_traits, unboxed_closures)]
trait Foo { fn dummy(&self) { }}

View file

@ -10,7 +10,7 @@
// pretty-expanded FIXME #23616
#![feature(unboxed_closures, core)]
#![feature(fn_traits, unboxed_closures)]
use std::ops::Fn;

View file

@ -11,7 +11,7 @@
#![allow(unknown_features)]
#![feature(box_syntax)]
#![feature(unboxed_closures, core)]
#![feature(unboxed_closures, fn_traits)]
// Test that unboxing shim for calling rust-call ABI methods through a
// trait box works and does not cause an ICE.

View file

@ -13,10 +13,8 @@
// pretty-expanded FIXME #23616
#![feature(unboxed_closures, core)]
pub fn inside<F: Fn()>(c: F) {
c.call(());
c();
}
// Use different number of type parameters and closure type to trigger

View file

@ -8,18 +8,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// pretty-expanded FIXME #23616
#![feature(unboxed_closures, core)]
pub trait Handler {
fn handle(&self, &mut String);
}
impl<F> Handler for F
where F: for<'a, 'b> Fn(&'a mut String) {
impl<F> Handler for F where F: for<'a, 'b> Fn(&'a mut String) {
fn handle(&self, st: &mut String) {
self.call((st,))
self(st)
}
}

View file

@ -10,7 +10,7 @@
// pretty-expanded FIXME #23616
#![feature(core,unboxed_closures)]
#![feature(fn_traits, unboxed_closures)]
#[allow(dead_code)]
struct Foo;

View file

@ -9,7 +9,7 @@
// except according to those terms.
#![feature(unboxed_closures)]
#![feature(core)]
#![feature(fn_traits)]
struct Fun<F>(F);

View file

@ -10,21 +10,15 @@
// Make sure #1399 stays fixed
#![allow(unknown_features)]
#![feature(box_syntax)]
#![feature(unboxed_closures, core)]
struct A { a: Box<isize> }
fn foo() -> Box<FnMut() -> isize + 'static> {
let k: Box<_> = box 22;
let k: Box<_> = Box::new(22);
let _u = A {a: k.clone()};
let result = || 22;
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
Box::new(result)
}
pub fn main() {
assert_eq!(foo().call_mut(()), 22);
assert_eq!(foo()(), 22);
}

View file

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(no_std)]
#![no_std]
extern crate std;

View file

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(no_std)]
#![no_std]
extern crate std;

View file

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(no_std)]
#![no_std]
extern crate std;

View file

@ -12,7 +12,7 @@
// pretty-expanded FIXME #23616
#![feature(unboxed_closures, core)]
#![feature(unboxed_closures, fn_traits)]
use std::marker::PhantomData;
use std::ops::Fn;

View file

@ -9,7 +9,7 @@
// except according to those terms.
#![feature(lang_items, unboxed_closures, core)]
#![feature(lang_items, unboxed_closures, fn_traits)]
use std::ops::{Fn, FnMut, FnOnce};

View file

@ -9,7 +9,7 @@
// except according to those terms.
#![feature(unboxed_closures, core)]
#![feature(unboxed_closures, fn_traits)]
use std::ops::FnMut;

View file

@ -8,10 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(unknown_features)]
#![feature(unboxed_closures, core)]
struct closure_box<'a> {
cl: Box<FnMut() + 'a>,
}
@ -25,9 +21,8 @@ pub fn main() {
assert_eq!(i, 3);
{
let cl = || i += 1;
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
let mut cl_box = box_it(Box::new(cl));
cl_box.cl.call_mut(());
(cl_box.cl)();
}
assert_eq!(i, 4);
}

View file

@ -8,10 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(unknown_features)]
#![feature(box_syntax)]
#![feature(unboxed_closures, core)]
struct closure_box<'a> {
cl: Box<FnMut() + 'a>,
}
@ -21,11 +17,10 @@ fn box_it<'a>(x: Box<FnMut() + 'a>) -> closure_box<'a> {
}
fn call_static_closure(mut cl: closure_box<'static>) {
cl.cl.call_mut(())
(cl.cl)();
}
pub fn main() {
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
let cl_box = box_it(Box::new(|| println!("Hello, world!")));
call_static_closure(cl_box);
}

View file

@ -10,11 +10,6 @@
// Checks that higher-ranked extern fn pointers implement the full range of Fn traits.
#![feature(unboxed_closures, core)]
use std::ops::{Fn,FnMut,FnOnce};
fn square(x: &isize) -> isize { (*x) * (*x) }
fn call_it<F:Fn(&isize)->isize>(f: &F, x: isize) -> isize {
@ -22,7 +17,7 @@ fn call_it<F:Fn(&isize)->isize>(f: &F, x: isize) -> isize {
}
fn call_it_boxed(f: &Fn(&isize) -> isize, x: isize) -> isize {
f.call((&x,))
f(&x)
}
fn call_it_mut<F:FnMut(&isize)->isize>(f: &mut F, x: isize) -> isize {

View file

@ -12,7 +12,7 @@
// any Fn trait to be used where Fn is implemented.
#![feature(unboxed_closures, core)]
#![feature(unboxed_closures, fn_traits)]
use std::ops::{Fn,FnMut,FnOnce};

View file

@ -12,9 +12,7 @@
// FnMut or FnOnce to be used where FnMut is implemented.
#![feature(unboxed_closures, core)]
use std::ops::{FnMut,FnOnce};
#![feature(unboxed_closures, fn_traits)]
struct S;

View file

@ -8,8 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(core,unboxed_closures)]
#![feature(fn_traits, unboxed_closures)]
use std::marker::PhantomData;

View file

@ -8,10 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(unboxed_closures, core)]
use std::ops::FnMut;
#![feature(unboxed_closures, fn_traits)]
struct S;

View file

@ -11,30 +11,25 @@
// Test that unboxed closures in contexts with free type parameters
// monomorphize correctly (issue #16791)
#![allow(unknown_features)]
#![feature(box_syntax)]
#![feature(unboxed_closures, core)]
fn main(){
fn bar<'a, T:Clone+'a> (t: T) -> Box<FnMut()->T + 'a> {
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
Box::new(move || t.clone())
}
let mut f = bar(42_u32);
assert_eq!(f.call_mut(()), 42);
assert_eq!(f(), 42);
let mut f = bar("forty-two");
assert_eq!(f.call_mut(()), "forty-two");
assert_eq!(f(), "forty-two");
let x = 42_u32;
let mut f = bar(&x);
assert_eq!(f.call_mut(()), &x);
assert_eq!(f(), &x);
#[derive(Clone, Copy, Debug, PartialEq)]
struct Foo(usize, &'static str);
let x = Foo(42, "forty-two");
let mut f = bar(x);
assert_eq!(f.call_mut(()), x);
assert_eq!(f(), x);
}

View file

@ -12,14 +12,9 @@
// pretty-expanded FIXME #23616
#![allow(unknown_features)]
#![feature(box_syntax)]
#![feature(unboxed_closures, core)]
fn main() {
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
let task: Box<Fn(isize) -> isize> = Box::new(|x| x);
task.call((0, ));
task(0);
let mut task: Box<FnMut(isize) -> isize> = Box::new(|x| x);
task(0);

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(lang_items, start, no_std, core_slice_ext, libc, collections)]
#![feature(lang_items, start, libc, collections)]
#![no_std]
extern crate std as other;
@ -18,8 +18,6 @@ extern crate libc;
#[macro_use]
extern crate collections;
use core::option::Option::Some;
use core::slice::SliceExt;
use collections::vec::Vec;
// Issue #16806

View file

@ -11,7 +11,6 @@
// aux-build:issue-15318.rs
// ignore-cross-compile
#![feature(no_std)]
#![no_std]
extern crate issue_15318;

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(no_std, lang_items, core)]
#![feature(lang_items)]
#![no_std]
pub mod str {