diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index acf2209423323..05910a3529dc1 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -86,10 +86,13 @@ use core::raw::{TraitObject}; #[lang = "exchange_heap"] #[unstable(feature = "box_heap", reason = "may be renamed; uncertain about custom allocator design")] +#[allow(deprecated)] pub const HEAP: ExchangeHeapSingleton = ExchangeHeapSingleton { _force_singleton: () }; /// This the singleton type used solely for `boxed::HEAP`. +#[unstable(feature = "box_heap", + reason = "may be renamed; uncertain about custom allocator design")] #[derive(Copy, Clone)] pub struct ExchangeHeapSingleton { _force_singleton: () } diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index 4378d0804df96..00a0432956b8b 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -762,12 +762,16 @@ impl [T] { /// Find the first index containing a matching value. #[unstable(feature = "slice_position_elem")] + #[deprecated(since = "1.3.0", + reason = "less idiomatic than .iter().position()")] pub fn position_elem(&self, t: &T) -> Option where T: PartialEq { core_slice::SliceExt::position_elem(self, t) } /// Find the last index containing a matching value. #[unstable(feature = "slice_position_elem")] + #[deprecated(since = "1.3.0", + reason = "less idiomatic than .iter().rev().position()")] pub fn rposition_elem(&self, t: &T) -> Option where T: PartialEq { core_slice::SliceExt::rposition_elem(self, t) } @@ -1009,6 +1013,8 @@ impl [T] { /// ``` #[unstable(feature = "move_from", reason = "uncertain about this API approach")] + #[deprecated(since = "1.3.0", + reason = "unclear that it must belong in the standard library")] #[inline] pub fn move_from(&mut self, mut src: Vec, start: usize, end: usize) -> usize { for (a, b) in self.iter_mut().zip(&mut src[start .. end]) { diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 7c64dea3dc338..58affdc4729fa 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -553,6 +553,9 @@ impl str { /// ``` #[unstable(feature = "slice_chars", reason = "may have yet to prove its worth")] + #[deprecated(since = "1.3.0", + reason = "can be implemented with char_indices and \ + hasn't seen enough use to justify inclusion")] pub fn slice_chars(&self, begin: usize, end: usize) -> &str { core_str::StrExt::slice_chars(self, begin, end) } @@ -1666,6 +1669,8 @@ impl str { /// ``` #[unstable(feature = "subslice_offset", reason = "awaiting convention about comparability of arbitrary slices")] + #[deprecated(since = "1.3.0", + reason = "replaced with other pattern-related methods")] pub fn subslice_offset(&self, inner: &str) -> usize { core_str::StrExt::subslice_offset(self, inner) } diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 007de408efec7..e9f3651d63b89 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -772,6 +772,9 @@ impl Vec { /// ``` #[unstable(feature = "map_in_place", reason = "API may change to provide stronger guarantees")] + #[deprecated(since = "1.3.0", + reason = "unclear that the API is strong enough and did \ + not proven itself")] pub fn map_in_place(self, mut f: F) -> Vec where F: FnMut(T) -> U { // FIXME: Assert statically that the types `T` and `U` have the same // size. @@ -1627,6 +1630,7 @@ impl IntoIter { #[inline] /// Drops all items that have not yet been moved and returns the empty vector. #[unstable(feature = "iter_to_vec")] + #[deprecated(since = "1.3.0", reason = "replaced by drain()")] pub fn into_inner(mut self) -> Vec { unsafe { for _x in self.by_ref() { } diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index 52ed29c1b61f4..93542185eab5b 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -401,6 +401,7 @@ pub fn max(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(v1: T, v2: T) -> Option { match v1.partial_cmp(&v2) { Some(Less) | Some(Equal) => Some(v1), @@ -434,6 +435,7 @@ pub fn partial_min(v1: T, v2: T) -> Option { /// ``` #[inline] #[unstable(feature = "cmp_partial")] +#[deprecated(since = "1.3.0", reason = "has not proven itself worthwhile")] pub fn partial_max(v1: T, v2: T) -> Option { match v1.partial_cmp(&v2) { Some(Equal) | Some(Less) => Some(v2), diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs index abf9e55a1f2fb..a660cf0cf2d54 100644 --- a/src/libcore/hash/mod.rs +++ b/src/libcore/hash/mod.rs @@ -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(value: &T) -> u64 { let mut h: H = Default::default(); value.hash(&mut h); diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 415326a8a616e..4d8de0c85b6e9 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -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(self, initial_state: St, f: F) -> Scan where Self: Sized, F: FnMut(&mut St, Self::Item) -> Option, { @@ -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 where Self: Sized, Self::Item: Ord { let (mut min, mut max) = match self.next() { @@ -1336,6 +1340,8 @@ impl RandomAccessIterator for Rev #[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 { /// Empty iterator NoElements, @@ -1349,6 +1355,8 @@ pub enum MinMaxResult { } #[unstable(feature = "iter_min_max", reason = "type is unstable")] +#[deprecated(since = "1.3.0", reason = "has not proven itself")] +#[allow(deprecated)] impl MinMaxResult { /// `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 ExactSizeIterator for Take 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 { iter: I, f: F, @@ -2256,6 +2265,7 @@ pub struct Scan { /// 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 Iterator for Scan where type Item = B; #[inline] + #[allow(deprecated)] fn next(&mut self) -> Option { self.iter.next().and_then(|a| (self.f)(&mut self.state, a)) } @@ -2448,6 +2459,8 @@ impl Fuse { /// 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 } diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 13d95e9ab1a71..6fed89547d4f5 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -131,6 +131,9 @@ pub unsafe fn read(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(dest: *mut T) -> T { // Copy the data out from `dest`: let tmp = read(&*dest); diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index fb11aaed61958..c38345a79fd70 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -37,13 +37,11 @@ #![feature(dynamic_lib)] #![feature(enumset)] #![feature(fs_canonicalize)] -#![feature(hash_default)] #![feature(hashmap_hasher)] #![feature(into_cow)] #![feature(iter_cmp)] #![feature(iter_arith)] #![feature(libc)] -#![feature(map_in_place)] #![feature(num_bits_bytes)] #![feature(path_ext)] #![feature(quote)] @@ -55,8 +53,6 @@ #![feature(slice_bytes)] #![feature(slice_splits)] #![feature(slice_patterns)] -#![feature(slice_position_elem)] -#![feature(slice_concat_ext)] #![feature(staged_api)] #![feature(str_char)] #![feature(str_match_indices)] diff --git a/src/librustc/metadata/creader.rs b/src/librustc/metadata/creader.rs index 8562d8c01cc67..4ca347063096a 100644 --- a/src/librustc/metadata/creader.rs +++ b/src/librustc/metadata/creader.rs @@ -660,14 +660,14 @@ pub fn import_codemap(local_codemap: &codemap::CodeMap, // `CodeMap::new_imported_filemap()` will then translate those // coordinates to their new global frame of reference when the // offset of the FileMap is known. - let lines = lines.into_inner().map_in_place(|pos| pos - start_pos); - let multibyte_chars = multibyte_chars - .into_inner() - .map_in_place(|mbc| - codemap::MultiByteChar { - pos: mbc.pos - start_pos, - bytes: mbc.bytes - }); + let mut lines = lines.into_inner(); + for pos in &mut lines { + *pos = *pos - start_pos; + } + let mut multibyte_chars = multibyte_chars.into_inner(); + for mbc in &mut multibyte_chars { + mbc.pos = mbc.pos - start_pos; + } let local_version = local_codemap.new_imported_filemap(name, source_length, diff --git a/src/librustc/metadata/cstore.rs b/src/librustc/metadata/cstore.rs index 3112e8f4b4cfd..4941c932eadcc 100644 --- a/src/librustc/metadata/cstore.rs +++ b/src/librustc/metadata/cstore.rs @@ -197,7 +197,9 @@ impl CStore { })) .collect::>(); libs.sort_by(|&(a, _), &(b, _)| { - ordering.position_elem(&a).cmp(&ordering.position_elem(&b)) + let a = ordering.iter().position(|x| *x == a); + let b = ordering.iter().position(|x| *x == b); + a.cmp(&b) }); libs } diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index 7415b576f762b..55f0ef4fd57b6 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -35,7 +35,7 @@ use util::nodemap::FnvHashMap; use std::cell::{Cell, RefCell}; use std::collections::HashMap; -use std::hash::{self, Hash, SipHasher}; +use std::hash::{Hash, SipHasher, Hasher}; use std::io::prelude::*; use std::io; use std::rc::Rc; @@ -89,9 +89,9 @@ pub fn maybe_find_item<'a>(item_id: ast::NodeId, fn eq_item(bytes: &[u8], item_id: ast::NodeId) -> bool { u32_from_be_bytes(bytes) == item_id } - lookup_hash(items, - |a| eq_item(a, item_id), - hash::hash::(&(item_id as i64))) + let mut s = SipHasher::new_with_keys(0, 0); + (item_id as i64).hash(&mut s); + lookup_hash(items, |a| eq_item(a, item_id), s.finish()) } fn find_item<'a>(item_id: ast::NodeId, items: rbml::Doc<'a>) -> rbml::Doc<'a> { diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index ea5ca8acb094f..69a4888777fdd 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -79,7 +79,6 @@ use std::ops; use std::rc::Rc; use std::vec::IntoIter; use collections::enum_set::{self, EnumSet, CLike}; -use collections::slice::SliceConcatExt; use std::collections::{HashMap, HashSet}; use syntax::abi; use syntax::ast::{CrateNum, DefId, ItemImpl, ItemTrait, LOCAL_CRATE}; diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs index 77575cd6b24c9..03aa4bc2ead76 100644 --- a/src/librustc/util/common.rs +++ b/src/librustc/util/common.rs @@ -124,6 +124,7 @@ fn get_working_set_size() -> Option { } #[cfg_attr(windows, allow(dead_code))] +#[allow(deprecated)] fn get_proc_self_statm_field(field: usize) -> Option { use std::fs::File; use std::io::Read; diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index fd49d0468c906..d215813b7400d 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -279,7 +279,7 @@ impl<'tcx> fmt::Display for ty::TraitTy<'tcx> { .expect("could not lift TraitRef for printing"); let projections = tcx.lift(&bounds.projection_bounds[..]) .expect("could not lift projections for printing"); - let projections = projections.map_in_place(|p| p.0); + let projections = projections.into_iter().map(|p| p.0).collect(); let tap = ty::Binder(TraitAndProjections(principal, projections)); in_binder(f, tcx, &ty::Binder(""), Some(tap)) diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 57c0db8f96e66..83e77a5c03865 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -34,7 +34,7 @@ //! both occur before the crate is rendered. pub use self::ExternalLocation::*; -use std::ascii::OwnedAsciiExt; +use std::ascii::AsciiExt; use std::cell::RefCell; use std::cmp::Ordering; use std::collections::{BTreeMap, HashMap, HashSet}; @@ -2547,7 +2547,7 @@ fn get_index_search_type(item: &clean::Item, // Consider `self` an argument as well. if let Some(name) = parent { - inputs.push(Type { name: Some(name.into_ascii_lowercase()) }); + inputs.push(Type { name: Some(name.to_ascii_lowercase()) }); } inputs.extend(&mut decl.inputs.values.iter().map(|arg| { @@ -2563,7 +2563,7 @@ fn get_index_search_type(item: &clean::Item, } fn get_index_type(clean_type: &clean::Type) -> Type { - Type { name: get_index_type_name(clean_type).map(|s| s.into_ascii_lowercase()) } + Type { name: get_index_type_name(clean_type).map(|s| s.to_ascii_lowercase()) } } fn get_index_type_name(clean_type: &clean::Type) -> Option { diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 421dcae19c957..a19cd73fd6e25 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -24,14 +24,12 @@ #![feature(box_syntax)] #![feature(dynamic_lib)] #![feature(libc)] -#![feature(owned_ascii_ext)] #![feature(path_ext)] #![feature(path_relative_from)] #![feature(rustc_private)] #![feature(set_stdio)] #![feature(slice_patterns)] #![feature(staged_api)] -#![feature(subslice_offset)] #![feature(test)] #![feature(unicode)] #![feature(vec_push_all)] diff --git a/src/librustdoc/markdown.rs b/src/librustdoc/markdown.rs index 00de4e3ec53cf..bc6c797e5c5da 100644 --- a/src/librustdoc/markdown.rs +++ b/src/librustdoc/markdown.rs @@ -34,7 +34,7 @@ fn extract_leading_metadata<'a>(s: &'a str) -> (Vec<&'a str>, &'a str) { // remove % metadata.push(line[1..].trim_left()) } else { - let line_start_byte = s.subslice_offset(line); + let line_start_byte = s.find(line).unwrap(); return (metadata, &s[line_start_byte..]); } } diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index cf78fa7b69a00..ac98282ebb86b 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -20,6 +20,9 @@ use mem; /// Extension methods for ASCII-subset only operations on owned strings #[unstable(feature = "owned_ascii_ext", reason = "would prefer to do this in a more general way")] +#[deprecated(since = "1.3.0", + reason = "hasn't yet proved essential to be in the standard library")] +#[allow(deprecated)] pub trait OwnedAsciiExt { /// Converts the string to ASCII upper case: /// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z', @@ -164,11 +167,13 @@ impl AsciiExt for str { } #[inline] + #[allow(deprecated)] fn to_ascii_uppercase(&self) -> String { self.to_string().into_ascii_uppercase() } #[inline] + #[allow(deprecated)] fn to_ascii_lowercase(&self) -> String { self.to_string().into_ascii_lowercase() } @@ -189,6 +194,7 @@ impl AsciiExt for str { } } +#[allow(deprecated)] impl OwnedAsciiExt for String { #[inline] fn into_ascii_uppercase(self) -> String { @@ -212,11 +218,13 @@ impl AsciiExt for [u8] { } #[inline] + #[allow(deprecated)] fn to_ascii_uppercase(&self) -> Vec { self.to_vec().into_ascii_uppercase() } #[inline] + #[allow(deprecated)] fn to_ascii_lowercase(&self) -> Vec { self.to_vec().into_ascii_lowercase() } @@ -242,6 +250,7 @@ impl AsciiExt for [u8] { } } +#[allow(deprecated)] impl OwnedAsciiExt for Vec { #[inline] fn into_ascii_uppercase(mut self) -> Vec { diff --git a/src/libstd/env.rs b/src/libstd/env.rs index 6842de56d215d..d1a49da461ec9 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -590,6 +590,8 @@ impl ExactSizeIterator for ArgsOs { /// Returns the page size of the current architecture in bytes. #[unstable(feature = "page_size", reason = "naming and/or location may change")] +#[deprecated(since = "1.3.0", + reason = "hasn't seen enough usage to justify inclusion")] pub fn page_size() -> usize { os_imp::page_size() } diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index e5f2fcbae8394..a879c2ebd7372 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -1225,6 +1225,9 @@ impl PathExt for Path { reason = "the argument type of u64 is not quite appropriate for \ this function and may change if the standard library \ gains a type to represent a moment in time")] +#[deprecated(since = "1.3.0", + reason = "will never be stabilized as-is and its replacement will \ + likely have a totally new API")] pub fn set_file_times>(path: P, accessed: u64, modified: u64) -> io::Result<()> { fs_imp::utimes(path.as_ref(), accessed, modified) diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index c25aa35ffbe3b..29d1fe19adf61 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -747,7 +747,7 @@ impl LineWriter { #[stable(feature = "rust1", since = "1.0.0")] impl Write for LineWriter { fn write(&mut self, buf: &[u8]) -> io::Result { - match buf.rposition_elem(&b'\n') { + match buf.iter().rposition(|b| *b == b'\n') { Some(i) => { let n = try!(self.inner.write(&buf[..i + 1])); if n != i + 1 { return Ok(n) } diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index fbdfdeaaef4f2..ffdd75b0e6e0f 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -1105,7 +1105,7 @@ fn read_until(r: &mut R, delim: u8, buf: &mut Vec) Err(ref e) if e.kind() == ErrorKind::Interrupted => continue, Err(e) => return Err(e) }; - match available.position_elem(&delim) { + match available.iter().position(|x| *x == delim) { Some(i) => { buf.push_all(&available[..i + 1]); (true, i + 1) diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 440e3a26f6b33..4297bbffbdfb1 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -232,7 +232,6 @@ #![feature(linkage, thread_local, asm)] #![feature(macro_reexport)] #![feature(slice_concat_ext)] -#![feature(slice_position_elem)] #![feature(no_std)] #![feature(oom)] #![feature(optin_builtin_traits)] diff --git a/src/libstd/path.rs b/src/libstd/path.rs index d3573345afbb0..f5f8508e9aa8a 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -200,7 +200,7 @@ mod platform { return Some(VerbatimUNC(server, share)); } else { // \\?\path - let idx = path.position_elem(&b'\\'); + let idx = path.iter().position(|&b| b == b'\\'); if idx == Some(2) && path[1] == b':' { let c = path[0]; if c.is_ascii() && (c as char).is_alphabetic() { @@ -214,7 +214,8 @@ mod platform { } else if path.starts_with(b".\\") { // \\.\path path = &path[2..]; - let slice = &path[.. path.position_elem(&b'\\').unwrap_or(path.len())]; + let pos = path.iter().position(|&b| b == b'\\'); + let slice = &path[..pos.unwrap_or(path.len())]; return Some(DeviceNS(u8_slice_as_os_str(slice))); } match parse_two_comps(path, is_sep_byte) { diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index 09dc1a3f6d69d..8601f59138c0d 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -56,7 +56,6 @@ #![deny(missing_docs)] #![feature(box_syntax)] -#![feature(owned_ascii_ext)] #![feature(path_ext)] #![feature(rustc_private)] #![feature(staged_api)] diff --git a/src/libterm/terminfo/parm.rs b/src/libterm/terminfo/parm.rs index 9af751debc384..14a9d2677e2b9 100644 --- a/src/libterm/terminfo/parm.rs +++ b/src/libterm/terminfo/parm.rs @@ -14,7 +14,7 @@ pub use self::Param::*; use self::States::*; use self::FormatState::*; use self::FormatOp::*; -use std::ascii::OwnedAsciiExt; +use std::ascii::AsciiExt; use std::mem::replace; use std::iter::repeat; @@ -532,7 +532,7 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result ,String> { } } FormatHEX => { - s = s.into_ascii_uppercase(); + s = s.to_ascii_uppercase(); if flags.alternate { let s_ = replace(&mut s, vec!(b'0', b'X')); s.extend(s_);