std: Deprecate a number of unstable features

Many of these have long since reached their stage of being obsolete, so this
commit starts the removal process for all of them. The unstable features that
were deprecated are:

* cmp_partial
* fs_time
* hash_default
* int_slice
* iter_min_max
* iter_reset_fuse
* iter_to_vec
* map_in_place
* move_from
* owned_ascii_ext
* page_size
* read_and_zero
* scan_state
* slice_chars
* slice_position_elem
* subslice_offset
This commit is contained in:
Alex Crichton
2015-07-08 08:33:13 -07:00
parent a5c12f4e39
commit b3aa1a6d4a
27 changed files with 80 additions and 33 deletions

View File

@@ -401,6 +401,7 @@ pub fn max<T: Ord>(v1: T, v2: T) -> T {
/// ```
#[inline]
#[unstable(feature = "cmp_partial")]
#[deprecated(since = "1.3.0", reason = "has not proven itself worthwhile")]
pub fn partial_min<T: PartialOrd>(v1: T, v2: T) -> Option<T> {
match v1.partial_cmp(&v2) {
Some(Less) | Some(Equal) => Some(v1),
@@ -434,6 +435,7 @@ pub fn partial_min<T: PartialOrd>(v1: T, v2: T) -> Option<T> {
/// ```
#[inline]
#[unstable(feature = "cmp_partial")]
#[deprecated(since = "1.3.0", reason = "has not proven itself worthwhile")]
pub fn partial_max<T: PartialOrd>(v1: T, v2: T) -> Option<T> {
match v1.partial_cmp(&v2) {
Some(Equal) | Some(Less) => Some(v2),

View File

@@ -171,6 +171,8 @@ pub trait Hasher {
#[unstable(feature = "hash_default",
reason = "not the most ergonomic interface unless `H` is defaulted \
to SipHasher, but perhaps not ready to commit to that")]
#[deprecated(since = "1.3.0",
reason = "has yet to prove itself useful")]
pub fn hash<T: Hash, H: Hasher + Default>(value: &T) -> u64 {
let mut h: H = Default::default();
value.hash(&mut h);

View File

@@ -56,6 +56,7 @@
#![stable(feature = "rust1", since = "1.0.0")]
#[allow(deprecated)]
use self::MinMaxResult::*;
use clone::Clone;
@@ -445,6 +446,7 @@ pub trait Iterator {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[allow(deprecated)]
fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where Self: Sized, F: FnMut(&mut St, Self::Item) -> Option<B>,
{
@@ -840,6 +842,8 @@ pub trait Iterator {
#[unstable(feature = "iter_min_max",
reason = "return type may change or may wish to have a closure \
based version as well")]
#[deprecated(since = "1.3.0", reason = "has not proven itself")]
#[allow(deprecated)]
fn min_max(mut self) -> MinMaxResult<Self::Item> where Self: Sized, Self::Item: Ord
{
let (mut min, mut max) = match self.next() {
@@ -1336,6 +1340,8 @@ impl<I> RandomAccessIterator for Rev<I>
#[derive(Clone, PartialEq, Debug)]
#[unstable(feature = "iter_min_max",
reason = "unclear whether such a fine-grained result is widely useful")]
#[deprecated(since = "1.3.0", reason = "has not proven itself")]
#[allow(deprecated)]
pub enum MinMaxResult<T> {
/// Empty iterator
NoElements,
@@ -1349,6 +1355,8 @@ pub enum MinMaxResult<T> {
}
#[unstable(feature = "iter_min_max", reason = "type is unstable")]
#[deprecated(since = "1.3.0", reason = "has not proven itself")]
#[allow(deprecated)]
impl<T: Clone> MinMaxResult<T> {
/// `into_option` creates an `Option` of type `(T,T)`. The returned `Option`
/// has variant `None` if and only if the `MinMaxResult` has variant
@@ -2249,6 +2257,7 @@ impl<I> ExactSizeIterator for Take<I> where I: ExactSizeIterator {}
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(Clone)]
#[allow(deprecated)]
pub struct Scan<I, St, F> {
iter: I,
f: F,
@@ -2256,6 +2265,7 @@ pub struct Scan<I, St, F> {
/// The current internal state to be passed to the closure next.
#[unstable(feature = "scan_state",
reason = "public fields are otherwise rare in the stdlib")]
#[deprecated(since = "1.3.0", reason = "unclear whether this is necessary")]
pub state: St,
}
@@ -2267,6 +2277,7 @@ impl<B, I, St, F> Iterator for Scan<I, St, F> where
type Item = B;
#[inline]
#[allow(deprecated)]
fn next(&mut self) -> Option<B> {
self.iter.next().and_then(|a| (self.f)(&mut self.state, a))
}
@@ -2448,6 +2459,8 @@ impl<I> Fuse<I> {
/// previously returned `None`.
#[inline]
#[unstable(feature = "iter_reset_fuse", reason = "seems marginal")]
#[deprecated(since = "1.3.0",
reason = "unusual for adaptors to have one-off methods")]
pub fn reset_fuse(&mut self) {
self.done = false
}

View File

@@ -131,6 +131,9 @@ pub unsafe fn read<T>(src: *const T) -> T {
#[inline(always)]
#[unstable(feature = "read_and_zero",
reason = "may play a larger role in std::ptr future extensions")]
#[deprecated(since = "1.3.0",
reason = "a \"zero value\" will soon not actually exist for all \
types once dynamic drop has been implemented")]
pub unsafe fn read_and_zero<T>(dest: *mut T) -> T {
// Copy the data out from `dest`:
let tmp = read(&*dest);