Skip to content

Commit 16d3ba1

Browse files
SimonSapinManishearth
authored andcommitted
Move RangeArguments to {core::std}::ops and rename to RangeBounds
These unstable items are deprecated: * The `std::collections::range::RangeArgument` reexport * The `std::collections::range` module.
1 parent c3a6397 commit 16d3ba1

File tree

13 files changed

+183
-184
lines changed

13 files changed

+183
-184
lines changed

src/liballoc/btree/map.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ use core::iter::{FromIterator, Peekable, FusedIterator};
1515
use core::marker::PhantomData;
1616
use core::ops::Bound::{Excluded, Included, Unbounded};
1717
use core::ops::Index;
18+
use core::ops::RangeBounds;
1819
use core::{fmt, intrinsics, mem, ptr};
1920

2021
use borrow::Borrow;
21-
use range::RangeArgument;
2222

2323
use super::node::{self, Handle, NodeRef, marker};
2424
use super::search;
@@ -817,7 +817,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
817817
/// ```
818818
#[stable(feature = "btree_range", since = "1.17.0")]
819819
pub fn range<T: ?Sized, R>(&self, range: R) -> Range<K, V>
820-
where T: Ord, K: Borrow<T>, R: RangeArgument<T>
820+
where T: Ord, K: Borrow<T>, R: RangeBounds<T>
821821
{
822822
let root1 = self.root.as_ref();
823823
let root2 = self.root.as_ref();
@@ -857,7 +857,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
857857
/// ```
858858
#[stable(feature = "btree_range", since = "1.17.0")]
859859
pub fn range_mut<T: ?Sized, R>(&mut self, range: R) -> RangeMut<K, V>
860-
where T: Ord, K: Borrow<T>, R: RangeArgument<T>
860+
where T: Ord, K: Borrow<T>, R: RangeBounds<T>
861861
{
862862
let root1 = self.root.as_mut();
863863
let root2 = unsafe { ptr::read(&root1) };
@@ -1812,7 +1812,7 @@ fn last_leaf_edge<BorrowType, K, V>
18121812
}
18131813
}
18141814

1815-
fn range_search<BorrowType, K, V, Q: ?Sized, R: RangeArgument<Q>>(
1815+
fn range_search<BorrowType, K, V, Q: ?Sized, R: RangeBounds<Q>>(
18161816
root1: NodeRef<BorrowType, K, V, marker::LeafOrInternal>,
18171817
root2: NodeRef<BorrowType, K, V, marker::LeafOrInternal>,
18181818
range: R

src/liballoc/btree/set.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ use core::cmp::{min, max};
1616
use core::fmt::Debug;
1717
use core::fmt;
1818
use core::iter::{Peekable, FromIterator, FusedIterator};
19-
use core::ops::{BitOr, BitAnd, BitXor, Sub};
19+
use core::ops::{BitOr, BitAnd, BitXor, Sub, RangeBounds};
2020

2121
use borrow::Borrow;
2222
use btree_map::{BTreeMap, Keys};
2323
use super::Recover;
24-
use range::RangeArgument;
2524

2625
// FIXME(conventions): implement bounded iterators
2726

@@ -253,7 +252,7 @@ impl<T: Ord> BTreeSet<T> {
253252
/// ```
254253
#[stable(feature = "btree_range", since = "1.17.0")]
255254
pub fn range<K: ?Sized, R>(&self, range: R) -> Range<T>
256-
where K: Ord, T: Borrow<K>, R: RangeArgument<K>
255+
where K: Ord, T: Borrow<K>, R: RangeBounds<K>
257256
{
258257
Range { iter: self.map.range(range) }
259258
}

src/liballoc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
#![feature(box_syntax)]
8989
#![feature(cfg_target_has_atomic)]
9090
#![feature(coerce_unsized)]
91+
#![feature(collections_range)]
9192
#![feature(const_fn)]
9293
#![feature(core_intrinsics)]
9394
#![feature(custom_attribute)]
@@ -178,7 +179,6 @@ mod btree;
178179
pub mod borrow;
179180
pub mod fmt;
180181
pub mod linked_list;
181-
pub mod range;
182182
pub mod slice;
183183
pub mod str;
184184
pub mod string;

src/liballoc/range.rs

Lines changed: 0 additions & 152 deletions
This file was deleted.

src/liballoc/string.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,13 @@ use core::fmt;
6060
use core::hash;
6161
use core::iter::{FromIterator, FusedIterator};
6262
use core::ops::Bound::{Excluded, Included, Unbounded};
63-
use core::ops::{self, Add, AddAssign, Index, IndexMut};
63+
use core::ops::{self, Add, AddAssign, Index, IndexMut, RangeBounds};
6464
use core::ptr;
6565
use core::str::pattern::Pattern;
6666
use std_unicode::lossy;
6767
use std_unicode::char::{decode_utf16, REPLACEMENT_CHARACTER};
6868

6969
use borrow::{Cow, ToOwned};
70-
use range::RangeArgument;
7170
use str::{self, from_boxed_utf8_unchecked, FromStr, Utf8Error, Chars};
7271
use vec::Vec;
7372
use boxed::Box;
@@ -1484,7 +1483,7 @@ impl String {
14841483
/// ```
14851484
#[stable(feature = "drain", since = "1.6.0")]
14861485
pub fn drain<R>(&mut self, range: R) -> Drain
1487-
where R: RangeArgument<usize>
1486+
where R: RangeBounds<usize>
14881487
{
14891488
// Memory safety
14901489
//
@@ -1548,7 +1547,7 @@ impl String {
15481547
/// ```
15491548
#[unstable(feature = "splice", reason = "recently added", issue = "44643")]
15501549
pub fn splice<R>(&mut self, range: R, replace_with: &str)
1551-
where R: RangeArgument<usize>
1550+
where R: RangeBounds<usize>
15521551
{
15531552
// Memory safety
15541553
//

src/liballoc/vec.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ use core::mem;
7676
#[cfg(not(test))]
7777
use core::num::Float;
7878
use core::ops::Bound::{Excluded, Included, Unbounded};
79-
use core::ops::{InPlace, Index, IndexMut, Place, Placer};
79+
use core::ops::{InPlace, Index, IndexMut, Place, Placer, RangeBounds};
8080
use core::ops;
8181
use core::ptr;
8282
use core::ptr::NonNull;
@@ -86,7 +86,6 @@ use borrow::ToOwned;
8686
use borrow::Cow;
8787
use boxed::Box;
8888
use raw_vec::RawVec;
89-
use super::range::RangeArgument;
9089
use super::allocator::CollectionAllocErr;
9190

9291
/// A contiguous growable array type, written `Vec<T>` but pronounced 'vector'.
@@ -1176,7 +1175,7 @@ impl<T> Vec<T> {
11761175
/// ```
11771176
#[stable(feature = "drain", since = "1.6.0")]
11781177
pub fn drain<R>(&mut self, range: R) -> Drain<T>
1179-
where R: RangeArgument<usize>
1178+
where R: RangeBounds<usize>
11801179
{
11811180
// Memory safety
11821181
//
@@ -1950,7 +1949,7 @@ impl<T> Vec<T> {
19501949
#[inline]
19511950
#[stable(feature = "vec_splice", since = "1.21.0")]
19521951
pub fn splice<R, I>(&mut self, range: R, replace_with: I) -> Splice<I::IntoIter>
1953-
where R: RangeArgument<usize>, I: IntoIterator<Item=T>
1952+
where R: RangeBounds<usize>, I: IntoIterator<Item=T>
19541953
{
19551954
Splice {
19561955
drain: self.drain(range),

src/liballoc/vec_deque.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use core::fmt;
2222
use core::iter::{repeat, FromIterator, FusedIterator};
2323
use core::mem;
2424
use core::ops::Bound::{Excluded, Included, Unbounded};
25-
use core::ops::{Index, IndexMut, Place, Placer, InPlace};
25+
use core::ops::{Index, IndexMut, Place, Placer, InPlace, RangeBounds};
2626
use core::ptr;
2727
use core::ptr::NonNull;
2828
use core::slice;
@@ -33,7 +33,6 @@ use core::cmp;
3333
use raw_vec::RawVec;
3434

3535
use super::allocator::CollectionAllocErr;
36-
use super::range::RangeArgument;
3736
use super::vec::Vec;
3837

3938
const INITIAL_CAPACITY: usize = 7; // 2^3 - 1
@@ -969,7 +968,7 @@ impl<T> VecDeque<T> {
969968
#[inline]
970969
#[stable(feature = "drain", since = "1.6.0")]
971970
pub fn drain<R>(&mut self, range: R) -> Drain<T>
972-
where R: RangeArgument<usize>
971+
where R: RangeBounds<usize>
973972
{
974973
// Memory safety
975974
//

src/libcore/ops/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ pub use self::index::{Index, IndexMut};
192192
pub use self::range::{Range, RangeFrom, RangeFull, RangeTo};
193193

194194
#[stable(feature = "inclusive_range", since = "1.26.0")]
195-
pub use self::range::{RangeInclusive, RangeToInclusive, Bound};
195+
pub use self::range::{RangeInclusive, RangeToInclusive, RangeBounds, Bound};
196196

197197
#[unstable(feature = "try_trait", issue = "42327")]
198198
pub use self::try::Try;

0 commit comments

Comments
 (0)