about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2018-03-19 09:01:17 +0100
committerManish Goregaokar <manishsmail@gmail.com>2018-03-29 13:12:49 +0200
commitc3a63970dee2422e2fcc79d8b99303b4b046f444 (patch)
treef8cdc9df5af3d6f06bac1650ac7df2bbe549b7f3 /src/liballoc
parent409744bcb91f4efa35b8fcc9e7033523a86b90c2 (diff)
downloadrust-c3a63970dee2422e2fcc79d8b99303b4b046f444.tar.gz
rust-c3a63970dee2422e2fcc79d8b99303b4b046f444.zip
Move alloc::Bound to {core,std}::ops
The stable reexport `std::collections::Bound` is now deprecated.

Another deprecated reexport could be added in `alloc`,
but that crate is unstable.
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/btree/map.rs4
-rw-r--r--src/liballoc/btree/set.rs2
-rw-r--r--src/liballoc/lib.rs51
-rw-r--r--src/liballoc/range.rs2
-rw-r--r--src/liballoc/string.rs2
-rw-r--r--src/liballoc/tests/btree/map.rs2
-rw-r--r--src/liballoc/vec.rs2
-rw-r--r--src/liballoc/vec_deque.rs2
8 files changed, 8 insertions, 59 deletions
diff --git a/src/liballoc/btree/map.rs b/src/liballoc/btree/map.rs
index cada190032a..2ba56063e36 100644
--- a/src/liballoc/btree/map.rs
+++ b/src/liballoc/btree/map.rs
@@ -13,11 +13,11 @@ use core::fmt::Debug;
 use core::hash::{Hash, Hasher};
 use core::iter::{FromIterator, Peekable, FusedIterator};
 use core::marker::PhantomData;
+use core::ops::Bound::{Excluded, Included, Unbounded};
 use core::ops::Index;
 use core::{fmt, intrinsics, mem, ptr};
 
 use borrow::Borrow;
-use Bound::{Excluded, Included, Unbounded};
 use range::RangeArgument;
 
 use super::node::{self, Handle, NodeRef, marker};
@@ -804,7 +804,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
     ///
     /// ```
     /// use std::collections::BTreeMap;
-    /// use std::collections::Bound::Included;
+    /// use std::ops::Bound::Included;
     ///
     /// let mut map = BTreeMap::new();
     /// map.insert(3, "a");
diff --git a/src/liballoc/btree/set.rs b/src/liballoc/btree/set.rs
index 2e3157147a0..d488dd6cbbd 100644
--- a/src/liballoc/btree/set.rs
+++ b/src/liballoc/btree/set.rs
@@ -240,7 +240,7 @@ impl<T: Ord> BTreeSet<T> {
     ///
     /// ```
     /// use std::collections::BTreeSet;
-    /// use std::collections::Bound::Included;
+    /// use std::ops::Bound::Included;
     ///
     /// let mut set = BTreeSet::new();
     /// set.insert(3);
diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs
index 19d64d8fea9..eddbd50ea03 100644
--- a/src/liballoc/lib.rs
+++ b/src/liballoc/lib.rs
@@ -204,57 +204,6 @@ mod std {
     pub use core::ops;      // RangeFull
 }
 
-/// An endpoint of a range of keys.
-///
-/// # Examples
-///
-/// `Bound`s are range endpoints:
-///
-/// ```
-/// #![feature(collections_range)]
-///
-/// use std::collections::range::RangeArgument;
-/// use std::collections::Bound::*;
-///
-/// assert_eq!((..100).start(), Unbounded);
-/// assert_eq!((1..12).start(), Included(&1));
-/// assert_eq!((1..12).end(), Excluded(&12));
-/// ```
-///
-/// Using a tuple of `Bound`s as an argument to [`BTreeMap::range`].
-/// Note that in most cases, it's better to use range syntax (`1..5`) instead.
-///
-/// ```
-/// use std::collections::BTreeMap;
-/// use std::collections::Bound::{Excluded, Included, Unbounded};
-///
-/// let mut map = BTreeMap::new();
-/// map.insert(3, "a");
-/// map.insert(5, "b");
-/// map.insert(8, "c");
-///
-/// for (key, value) in map.range((Excluded(3), Included(8))) {
-///     println!("{}: {}", key, value);
-/// }
-///
-/// assert_eq!(Some((&3, &"a")), map.range((Unbounded, Included(5))).next());
-/// ```
-///
-/// [`BTreeMap::range`]: btree_map/struct.BTreeMap.html#method.range
-#[stable(feature = "collections_bound", since = "1.17.0")]
-#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
-pub enum Bound<T> {
-    /// An inclusive bound.
-    #[stable(feature = "collections_bound", since = "1.17.0")]
-    Included(#[stable(feature = "collections_bound", since = "1.17.0")] T),
-    /// An exclusive bound.
-    #[stable(feature = "collections_bound", since = "1.17.0")]
-    Excluded(#[stable(feature = "collections_bound", since = "1.17.0")] T),
-    /// An infinite endpoint. Indicates that there is no bound in this direction.
-    #[stable(feature = "collections_bound", since = "1.17.0")]
-    Unbounded,
-}
-
 /// An intermediate trait for specialization of `Extend`.
 #[doc(hidden)]
 trait SpecExtend<I: IntoIterator> {
diff --git a/src/liballoc/range.rs b/src/liballoc/range.rs
index b03abc85180..7cadbf3c90a 100644
--- a/src/liballoc/range.rs
+++ b/src/liballoc/range.rs
@@ -15,7 +15,7 @@
 //! Range syntax.
 
 use core::ops::{RangeFull, Range, RangeTo, RangeFrom, RangeInclusive, RangeToInclusive};
-use Bound::{self, Excluded, Included, Unbounded};
+use core::ops::Bound::{self, Excluded, Included, Unbounded};
 
 /// `RangeArgument` is implemented by Rust's built-in range types, produced
 /// by range syntax like `..`, `a..`, `..b` or `c..d`.
diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs
index 23c12bef3aa..754c78f7779 100644
--- a/src/liballoc/string.rs
+++ b/src/liballoc/string.rs
@@ -59,6 +59,7 @@
 use core::fmt;
 use core::hash;
 use core::iter::{FromIterator, FusedIterator};
+use core::ops::Bound::{Excluded, Included, Unbounded};
 use core::ops::{self, Add, AddAssign, Index, IndexMut};
 use core::ptr;
 use core::str::pattern::Pattern;
@@ -67,7 +68,6 @@ use std_unicode::char::{decode_utf16, REPLACEMENT_CHARACTER};
 
 use borrow::{Cow, ToOwned};
 use range::RangeArgument;
-use Bound::{Excluded, Included, Unbounded};
 use str::{self, from_boxed_utf8_unchecked, FromStr, Utf8Error, Chars};
 use vec::Vec;
 use boxed::Box;
diff --git a/src/liballoc/tests/btree/map.rs b/src/liballoc/tests/btree/map.rs
index 2393101040d..6ebdb86cc4a 100644
--- a/src/liballoc/tests/btree/map.rs
+++ b/src/liballoc/tests/btree/map.rs
@@ -9,8 +9,8 @@
 // except according to those terms.
 
 use std::collections::BTreeMap;
-use std::collections::Bound::{self, Excluded, Included, Unbounded};
 use std::collections::btree_map::Entry::{Occupied, Vacant};
+use std::ops::Bound::{self, Excluded, Included, Unbounded};
 use std::rc::Rc;
 
 use std::iter::FromIterator;
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs
index bcc999d7386..280570ecd65 100644
--- a/src/liballoc/vec.rs
+++ b/src/liballoc/vec.rs
@@ -75,6 +75,7 @@ use core::marker::PhantomData;
 use core::mem;
 #[cfg(not(test))]
 use core::num::Float;
+use core::ops::Bound::{Excluded, Included, Unbounded};
 use core::ops::{InPlace, Index, IndexMut, Place, Placer};
 use core::ops;
 use core::ptr;
@@ -87,7 +88,6 @@ use boxed::Box;
 use raw_vec::RawVec;
 use super::range::RangeArgument;
 use super::allocator::CollectionAllocErr;
-use Bound::{Excluded, Included, Unbounded};
 
 /// A contiguous growable array type, written `Vec<T>` but pronounced 'vector'.
 ///
diff --git a/src/liballoc/vec_deque.rs b/src/liballoc/vec_deque.rs
index be6e8d0f22f..9efd730790d 100644
--- a/src/liballoc/vec_deque.rs
+++ b/src/liballoc/vec_deque.rs
@@ -21,6 +21,7 @@ use core::cmp::Ordering;
 use core::fmt;
 use core::iter::{repeat, FromIterator, FusedIterator};
 use core::mem;
+use core::ops::Bound::{Excluded, Included, Unbounded};
 use core::ops::{Index, IndexMut, Place, Placer, InPlace};
 use core::ptr;
 use core::ptr::NonNull;
@@ -33,7 +34,6 @@ use raw_vec::RawVec;
 
 use super::allocator::CollectionAllocErr;
 use super::range::RangeArgument;
-use Bound::{Excluded, Included, Unbounded};
 use super::vec::Vec;
 
 const INITIAL_CAPACITY: usize = 7; // 2^3 - 1