diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index 291b66939e5e..5e0f0abb8ffc 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -1144,18 +1144,6 @@ impl<'a, K, V> DoubleEndedIterator for RangeMut<'a, K, V> { } impl<'a, K: Ord, V> Entry<'a, K, V> { - #[unstable(feature = "std_misc", - reason = "will soon be replaced by or_insert")] - #[deprecated(since = "1.0", - reason = "replaced with more ergonomic `or_insert` and `or_insert_with`")] - /// Returns a mutable reference to the entry if occupied, or the VacantEntry if vacant - pub fn get(self) -> Result<&'a mut V, VacantEntry<'a, K, V>> { - match self { - Occupied(entry) => Ok(entry.into_mut()), - Vacant(entry) => Err(entry), - } - } - #[stable(feature = "rust1", since = "1.0.0")] /// Ensures a value is in the entry by inserting the default if empty, and returns /// a mutable reference to the value in the entry. diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index ecbe9369e781..04283877a86c 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -37,7 +37,6 @@ #![feature(unsafe_no_drop_flag, filling_drop)] #![feature(step_by)] #![feature(str_char)] -#![feature(str_words)] #![feature(slice_patterns)] #![feature(debug_builders)] #![feature(utf8_error)] diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 38431ab5bf1b..8d29525c6ffd 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -50,9 +50,8 @@ use self::RecompositionState::*; use self::DecompositionType::*; -use core::clone::Clone; use core::iter::{Iterator, Extend}; -use core::option::Option::{self, Some, None}; +use core::option::Option::{self}; use core::result::Result; use core::str as core_str; use core::str::pattern::Pattern; @@ -60,11 +59,8 @@ use core::str::pattern::{Searcher, ReverseSearcher, DoubleEndedSearcher}; use rustc_unicode::str::{UnicodeStr, Utf16Encoder}; use core::convert::AsRef; -use vec_deque::VecDeque; use borrow::{Borrow, ToOwned}; use string::String; -use rustc_unicode; -use vec::Vec; use slice::SliceConcatExt; pub use core::str::{FromStr, Utf8Error}; @@ -133,119 +129,12 @@ impl> SliceConcatExt for [S] { Section: Iterators */ -// Helper functions used for Unicode normalization -fn canonical_sort(comb: &mut [(char, u8)]) { - let len = comb.len(); - for i in 0..len { - let mut swapped = false; - for j in 1..len-i { - let class_a = comb[j-1].1; - let class_b = comb[j].1; - if class_a != 0 && class_b != 0 && class_a > class_b { - comb.swap(j-1, j); - swapped = true; - } - } - if !swapped { break; } - } -} - #[derive(Clone)] enum DecompositionType { Canonical, Compatible } -/// External iterator for a string decomposition's characters. -/// -/// For use with the `std::iter` module. -#[allow(deprecated)] -#[deprecated(reason = "use the crates.io `unicode-normalization` library instead", - since = "1.0.0")] -#[derive(Clone)] -#[unstable(feature = "unicode", - reason = "this functionality may be replaced with a more generic \ - unicode crate on crates.io")] -pub struct Decompositions<'a> { - kind: DecompositionType, - iter: Chars<'a>, - buffer: Vec<(char, u8)>, - sorted: bool -} - -#[allow(deprecated)] -#[stable(feature = "rust1", since = "1.0.0")] -impl<'a> Iterator for Decompositions<'a> { - type Item = char; - - #[inline] - fn next(&mut self) -> Option { - match self.buffer.first() { - Some(&(c, 0)) => { - self.sorted = false; - self.buffer.remove(0); - return Some(c); - } - Some(&(c, _)) if self.sorted => { - self.buffer.remove(0); - return Some(c); - } - _ => self.sorted = false - } - - if !self.sorted { - for ch in self.iter.by_ref() { - let buffer = &mut self.buffer; - let sorted = &mut self.sorted; - { - let callback = |d| { - let class = - rustc_unicode::char::canonical_combining_class(d); - if class == 0 && !*sorted { - canonical_sort(buffer); - *sorted = true; - } - buffer.push((d, class)); - }; - match self.kind { - Canonical => { - rustc_unicode::char::decompose_canonical(ch, callback) - } - Compatible => { - rustc_unicode::char::decompose_compatible(ch, callback) - } - } - } - if *sorted { - break - } - } - } - - if !self.sorted { - canonical_sort(&mut self.buffer); - self.sorted = true; - } - - if self.buffer.is_empty() { - None - } else { - match self.buffer.remove(0) { - (c, 0) => { - self.sorted = false; - Some(c) - } - (c, _) => Some(c), - } - } - } - - fn size_hint(&self) -> (usize, Option) { - let (lower, _) = self.iter.size_hint(); - (lower, None) - } -} - #[derive(Clone)] enum RecompositionState { Composing, @@ -253,110 +142,6 @@ enum RecompositionState { Finished } -/// External iterator for a string recomposition's characters. -/// -/// For use with the `std::iter` module. -#[allow(deprecated)] -#[deprecated(reason = "use the crates.io `unicode-normalization` library instead", - since = "1.0.0")] -#[derive(Clone)] -#[unstable(feature = "unicode", - reason = "this functionality may be replaced with a more generic \ - unicode crate on crates.io")] -pub struct Recompositions<'a> { - iter: Decompositions<'a>, - state: RecompositionState, - buffer: VecDeque, - composee: Option, - last_ccc: Option -} - -#[allow(deprecated)] -#[stable(feature = "rust1", since = "1.0.0")] -impl<'a> Iterator for Recompositions<'a> { - type Item = char; - - #[inline] - fn next(&mut self) -> Option { - loop { - match self.state { - Composing => { - for ch in self.iter.by_ref() { - let ch_class = rustc_unicode::char::canonical_combining_class(ch); - if self.composee.is_none() { - if ch_class != 0 { - return Some(ch); - } - self.composee = Some(ch); - continue; - } - let k = self.composee.clone().unwrap(); - - match self.last_ccc { - None => { - match rustc_unicode::char::compose(k, ch) { - Some(r) => { - self.composee = Some(r); - continue; - } - None => { - if ch_class == 0 { - self.composee = Some(ch); - return Some(k); - } - self.buffer.push_back(ch); - self.last_ccc = Some(ch_class); - } - } - } - Some(l_class) => { - if l_class >= ch_class { - // `ch` is blocked from `composee` - if ch_class == 0 { - self.composee = Some(ch); - self.last_ccc = None; - self.state = Purging; - return Some(k); - } - self.buffer.push_back(ch); - self.last_ccc = Some(ch_class); - continue; - } - match rustc_unicode::char::compose(k, ch) { - Some(r) => { - self.composee = Some(r); - continue; - } - None => { - self.buffer.push_back(ch); - self.last_ccc = Some(ch_class); - } - } - } - } - } - self.state = Finished; - if self.composee.is_some() { - return self.composee.take(); - } - } - Purging => { - match self.buffer.pop_front() { - None => self.state = Composing, - s => return s - } - } - Finished => { - match self.buffer.pop_front() { - None => return self.composee.take(), - s => return s - } - } - } - } - } -} - /// External iterator for a string's UTF16 codeunits. /// /// For use with the `std::iter` module. @@ -469,80 +254,6 @@ impl str { result } - /// Returns an iterator over the string in Unicode Normalization Form D - /// (canonical decomposition). - #[allow(deprecated)] - #[deprecated(reason = "use the crates.io `unicode-normalization` library instead", - since = "1.0.0")] - #[inline] - #[unstable(feature = "unicode", - reason = "this functionality may be replaced with a more generic \ - unicode crate on crates.io")] - pub fn nfd_chars(&self) -> Decompositions { - Decompositions { - iter: self[..].chars(), - buffer: Vec::new(), - sorted: false, - kind: Canonical - } - } - - /// Returns an iterator over the string in Unicode Normalization Form KD - /// (compatibility decomposition). - #[allow(deprecated)] - #[deprecated(reason = "use the crates.io `unicode-normalization` library instead", - since = "1.0.0")] - #[inline] - #[unstable(feature = "unicode", - reason = "this functionality may be replaced with a more generic \ - unicode crate on crates.io")] - pub fn nfkd_chars(&self) -> Decompositions { - Decompositions { - iter: self[..].chars(), - buffer: Vec::new(), - sorted: false, - kind: Compatible - } - } - - /// An Iterator over the string in Unicode Normalization Form C - /// (canonical decomposition followed by canonical composition). - #[allow(deprecated)] - #[deprecated(reason = "use the crates.io `unicode-normalization` library instead", - since = "1.0.0")] - #[inline] - #[unstable(feature = "unicode", - reason = "this functionality may be replaced with a more generic \ - unicode crate on crates.io")] - pub fn nfc_chars(&self) -> Recompositions { - Recompositions { - iter: self.nfd_chars(), - state: Composing, - buffer: VecDeque::new(), - composee: None, - last_ccc: None - } - } - - /// An Iterator over the string in Unicode Normalization Form KC - /// (compatibility decomposition followed by canonical composition). - #[allow(deprecated)] - #[deprecated(reason = "use the crates.io `unicode-normalization` library instead", - since = "1.0.0")] - #[inline] - #[unstable(feature = "unicode", - reason = "this functionality may be replaced with a more generic \ - unicode crate on crates.io")] - pub fn nfkc_chars(&self) -> Recompositions { - Recompositions { - iter: self.nfkd_chars(), - state: Composing, - buffer: VecDeque::new(), - composee: None, - last_ccc: None - } - } - /// Returns `true` if `self` contains another `&str`. /// /// # Examples @@ -1684,81 +1395,6 @@ impl str { core_str::StrExt::parse(&self[..]) } - /// Returns an iterator over the [grapheme clusters][graphemes] of `self`. - /// - /// [graphemes]: http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries - /// - /// If `is_extended` is true, the iterator is over the - /// *extended grapheme clusters*; - /// otherwise, the iterator is over the *legacy grapheme clusters*. - /// [UAX#29](http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries) - /// recommends extended grapheme cluster boundaries for general processing. - /// - /// # Examples - /// - /// ``` - /// # #![feature(unicode, core)] - /// let gr1 = "a\u{310}e\u{301}o\u{308}\u{332}".graphemes(true).collect::>(); - /// let b: &[_] = &["a\u{310}", "e\u{301}", "o\u{308}\u{332}"]; - /// - /// assert_eq!(&gr1[..], b); - /// - /// let gr2 = "a\r\nb🇷🇺🇸🇹".graphemes(true).collect::>(); - /// let b: &[_] = &["a", "\r\n", "b", "🇷🇺🇸🇹"]; - /// - /// assert_eq!(&gr2[..], b); - /// ``` - #[deprecated(reason = "use the crates.io `unicode-segmentation` library instead", - since = "1.0.0")] - #[unstable(feature = "unicode", - reason = "this functionality may only be provided by libunicode")] - pub fn graphemes(&self, is_extended: bool) -> Graphemes { - UnicodeStr::graphemes(&self[..], is_extended) - } - - /// Returns an iterator over the grapheme clusters of `self` and their - /// byte offsets. See - /// `graphemes()` for more information. - /// - /// # Examples - /// - /// ``` - /// # #![feature(unicode, core)] - /// let gr_inds = "a̐éö̲\r\n".grapheme_indices(true).collect::>(); - /// let b: &[_] = &[(0, "a̐"), (3, "é"), (6, "ö̲"), (11, "\r\n")]; - /// - /// assert_eq!(&gr_inds[..], b); - /// ``` - #[deprecated(reason = "use the crates.io `unicode-segmentation` library instead", - since = "1.0.0")] - #[unstable(feature = "unicode", - reason = "this functionality may only be provided by libunicode")] - pub fn grapheme_indices(&self, is_extended: bool) -> GraphemeIndices { - UnicodeStr::grapheme_indices(&self[..], is_extended) - } - - /// An iterator over the non-empty substrings of `self` which contain no whitespace, - /// and which are separated by any amount of whitespace. - /// - /// # Examples - /// - /// ``` - /// # #![feature(str_words)] - /// # #![allow(deprecated)] - /// let some_words = " Mary had\ta little \n\t lamb"; - /// let v: Vec<&str> = some_words.words().collect(); - /// - /// assert_eq!(v, ["Mary", "had", "a", "little", "lamb"]); - /// ``` - #[deprecated(reason = "words() will be removed. Use split_whitespace() instead", - since = "1.1.0")] - #[unstable(feature = "str_words", - reason = "the precise algorithm to use is unclear")] - #[allow(deprecated)] - pub fn words(&self) -> Words { - UnicodeStr::words(&self[..]) - } - /// An iterator over the non-empty substrings of `self` which contain no whitespace, /// and which are separated by any amount of whitespace. /// @@ -1775,27 +1411,6 @@ impl str { UnicodeStr::split_whitespace(&self[..]) } - /// Returns a string's displayed width in columns. - /// - /// Control characters have zero width. - /// - /// `is_cjk` determines behavior for characters in the Ambiguous category: - /// if `is_cjk` is - /// `true`, these are 2 columns wide; otherwise, they are 1. - /// In CJK locales, `is_cjk` should be - /// `true`, else it should be `false`. - /// [Unicode Standard Annex #11](http://www.unicode.org/reports/tr11/) - /// recommends that these - /// characters be treated as 1 column (i.e., `is_cjk = false`) if the - /// locale is unknown. - #[deprecated(reason = "use the crates.io `unicode-width` library instead", - since = "1.0.0")] - #[unstable(feature = "unicode", - reason = "this functionality may only be provided by libunicode")] - pub fn width(&self, is_cjk: bool) -> usize { - UnicodeStr::width(&self[..], is_cjk) - } - /// Returns a `&str` with leading and trailing whitespace removed. /// /// # Examples diff --git a/src/libcollections/vec_map.rs b/src/libcollections/vec_map.rs index 6ff819fc87cd..f83c50256b2c 100644 --- a/src/libcollections/vec_map.rs +++ b/src/libcollections/vec_map.rs @@ -632,18 +632,6 @@ impl VecMap { impl<'a, V> Entry<'a, V> { - #[unstable(feature = "collections", - reason = "will soon be replaced by or_insert")] - #[deprecated(since = "1.0", - reason = "replaced with more ergonomic `or_insert` and `or_insert_with`")] - /// Returns a mutable reference to the entry if occupied, or the VacantEntry if vacant - pub fn get(self) -> Result<&'a mut V, VacantEntry<'a, V>> { - match self { - Occupied(entry) => Ok(entry.into_mut()), - Vacant(entry) => Err(entry), - } - } - #[unstable(feature = "collections", reason = "matches entry v3 specification, waiting for dust to settle")] /// Ensures a value is in the entry by inserting the default if empty, and returns diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index 5782c57834ee..a64a6afe1dd6 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -539,16 +539,6 @@ pub fn opt(short_name: &str, } } -impl Fail { - /// Convert a `Fail` enum into an error string. - #[unstable(feature = "rustc_private")] - #[deprecated(since = "1.0.0", - reason = "use `fmt::Display` (`{}` format specifier)")] - pub fn to_err_msg(self) -> String { - self.to_string() - } -} - impl fmt::Display for Fail { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index eedda3cf4371..ae9a494b91da 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -24,7 +24,7 @@ use mem::{self, replace}; use ops::{Deref, FnMut, FnOnce, Index}; use option::Option::{self, Some, None}; use rand::{self, Rng}; -use result::Result::{self, Ok, Err}; +use result::Result::{self}; use super::table::{ self, @@ -1462,18 +1462,6 @@ impl<'a, K, V> ExactSizeIterator for Drain<'a, K, V> { } impl<'a, K, V> Entry<'a, K, V> { - #[unstable(feature = "std_misc", - reason = "will soon be replaced by or_insert")] - #[deprecated(since = "1.0", - reason = "replaced with more ergonomic `or_insert` and `or_insert_with`")] - /// Returns a mutable reference to the entry if occupied, or the VacantEntry if vacant - pub fn get(self) -> Result<&'a mut V, VacantEntry<'a, K, V>> { - match self { - Occupied(entry) => Ok(entry.into_mut()), - Vacant(entry) => Err(entry), - } - } - #[stable(feature = "rust1", since = "1.0.0")] /// Ensures a value is in the entry by inserting the default if empty, and returns /// a mutable reference to the value in the entry. diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 5a05c61e064d..114aadc5c452 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -208,14 +208,6 @@ impl File { OpenOptions::new().write(true).create(true).truncate(true).open(path) } - /// Returns `None`. - #[unstable(feature = "file_path", - reason = "this abstraction was imposed by this library and was removed")] - #[deprecated(since = "1.0.0", reason = "abstraction was removed")] - pub fn path(&self) -> Option<&Path> { - None - } - /// Attempts to sync all OS-internal metadata to disk. /// /// This function will attempt to ensure that all in-core data reaches the @@ -575,38 +567,6 @@ impl Metadata { pub fn permissions(&self) -> Permissions { Permissions(self.0.perm()) } - - /// Returns the most recent access time for a file. - /// - /// The return value is in milliseconds since the epoch. - #[unstable(feature = "fs_time", - reason = "the return type of u64 is not quite appropriate for \ - this method and may change if the standard library \ - gains a type to represent a moment in time")] - #[deprecated(since = "1.1.0", - reason = "use os::platform::fs::MetadataExt extension traits")] - pub fn accessed(&self) -> u64 { - self.adjust_time(self.0.accessed()) - } - - /// Returns the most recent modification time for a file. - /// - /// The return value is in milliseconds since the epoch. - #[unstable(feature = "fs_time", - reason = "the return type of u64 is not quite appropriate for \ - this method and may change if the standard library \ - gains a type to represent a moment in time")] - #[deprecated(since = "1.1.0", - reason = "use os::platform::fs::MetadataExt extension traits")] - pub fn modified(&self) -> u64 { - self.adjust_time(self.0.modified()) - } - - fn adjust_time(&self, val: u64) -> u64 { - // FILETIME (what `val` represents) is in 100ns intervals and there are - // 10000 intervals in a millisecond. - if cfg!(windows) {val / 10000} else {val} - } } impl AsInner for Metadata { diff --git a/src/libstd/sys/unix/fs2.rs b/src/libstd/sys/unix/fs2.rs index 350161c751cb..6e5785d8d28d 100644 --- a/src/libstd/sys/unix/fs2.rs +++ b/src/libstd/sys/unix/fs2.rs @@ -69,9 +69,11 @@ impl FileAttr { FilePermissions { mode: (self.stat.st_mode as mode_t) & 0o777 } } + #[allow(dead_code)] pub fn accessed(&self) -> u64 { self.mktime(self.stat.st_atime as u64, self.stat.st_atime_nsec as u64) } + #[allow(dead_code)] pub fn modified(&self) -> u64 { self.mktime(self.stat.st_mtime as u64, self.stat.st_mtime_nsec as u64) } @@ -83,6 +85,7 @@ impl FileAttr { pub fn raw(&self) -> &raw::stat { &self.stat } // times are in milliseconds (currently) + #[allow(dead_code)] fn mktime(&self, secs: u64, nsecs: u64) -> u64 { secs * 1000 + nsecs / 1000000 } diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 50ab430f148c..9c4011b1707f 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -577,13 +577,6 @@ impl<'a> ExtCtxt<'a> { } } - #[unstable(feature = "rustc_private")] - #[deprecated(since = "1.0.0", - reason = "Replaced with `expander().fold_expr()`")] - pub fn expand_expr(&mut self, e: P) -> P { - self.expander().fold_expr(e) - } - /// Returns a `Folder` for deeply expanding all macros in a AST node. pub fn expander<'b>(&'b mut self) -> expand::MacroExpander<'b, 'a> { expand::MacroExpander::new(self) diff --git a/src/libsyntax/util/small_vector.rs b/src/libsyntax/util/small_vector.rs index 5353d12b6781..283e0ebbb0a5 100644 --- a/src/libsyntax/util/small_vector.rs +++ b/src/libsyntax/util/small_vector.rs @@ -128,13 +128,6 @@ impl SmallVector { } } - /// Deprecated: use `into_iter`. - #[unstable(feature = "rustc_private")] - #[deprecated(since = "1.0.0", reason = "use into_iter")] - pub fn move_iter(self) -> IntoIter { - self.into_iter() - } - pub fn into_iter(self) -> IntoIter { let repr = match self.repr { Zero => ZeroIterator,