about summary refs log tree commit diff
path: root/src/liballoc/string.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-03-29 11:34:17 +0000
committerbors <bors@rust-lang.org>2018-03-29 11:34:17 +0000
commitae544ee1c90afc0f939753014dc5e884cb2749a0 (patch)
treed07caa9ff970a3127f3530bc78460b81fe727ca7 /src/liballoc/string.rs
parent409744bcb91f4efa35b8fcc9e7033523a86b90c2 (diff)
parent6c9b3cccbcef8918829e173a2ea9c5d975cd2777 (diff)
downloadrust-ae544ee1c90afc0f939753014dc5e884cb2749a0.tar.gz
rust-ae544ee1c90afc0f939753014dc5e884cb2749a0.zip
Auto merge of #49163 - SimonSapin:range-bounds, r=alexcrichton
Rename RangeArgument to RangeBounds, move it and Bound to libcore

As proposed in the tracking issue: https://github.com/rust-lang/rust/issues/30877

Changes to *stable* items:

* `core::ops::Bound` / `std::ops::Bound` is new
* `std::collections::Bound` is a deprecated reexport of it (does this actually cause a warning?)

Changes to *unstable* items

* `alloc::Bound` is gone
* `alloc::range::RangeArgument` is moved to `core::ops::RangeBounds` / `std::ops::RangeBounds`
* `alloc::range` is gone
* `std::collections::range::RangeArgument` is deprecated reexport, to be removed later
* `std::collections::range` is deprecated, to be removed later
* `impl RangeBounds<T> for Range{,From,To,Inclusive,ToInclusive}<&T>` are added

The idea of replacing this trait with a type to be used with `Into<_>` is left for future consideration / work.

(Fixes https://github.com/rust-lang-nursery/rust-clippy/issues/2552.)
Diffstat (limited to 'src/liballoc/string.rs')
-rw-r--r--src/liballoc/string.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs
index 23c12bef3aa..aa202e23628 100644
--- a/src/liballoc/string.rs
+++ b/src/liballoc/string.rs
@@ -59,15 +59,14 @@
 use core::fmt;
 use core::hash;
 use core::iter::{FromIterator, FusedIterator};
-use core::ops::{self, Add, AddAssign, Index, IndexMut};
+use core::ops::Bound::{Excluded, Included, Unbounded};
+use core::ops::{self, Add, AddAssign, Index, IndexMut, RangeBounds};
 use core::ptr;
 use core::str::pattern::Pattern;
 use std_unicode::lossy;
 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;
@@ -1484,7 +1483,7 @@ impl String {
     /// ```
     #[stable(feature = "drain", since = "1.6.0")]
     pub fn drain<R>(&mut self, range: R) -> Drain
-        where R: RangeArgument<usize>
+        where R: RangeBounds<usize>
     {
         // Memory safety
         //
@@ -1548,7 +1547,7 @@ impl String {
     /// ```
     #[unstable(feature = "splice", reason = "recently added", issue = "44643")]
     pub fn splice<R>(&mut self, range: R, replace_with: &str)
-        where R: RangeArgument<usize>
+        where R: RangeBounds<usize>
     {
         // Memory safety
         //