Skip to content

Commit 83b70c2

Browse files
committed
Merge pull request #25192 from alexcrichton/beta-backport
Backport of PRs to Beta
2 parents f873dc5 + 5136e90 commit 83b70c2

File tree

16 files changed

+176
-227
lines changed

16 files changed

+176
-227
lines changed

src/libcollections/string.rs

+12-9
Original file line numberDiff line numberDiff line change
@@ -742,8 +742,7 @@ impl<'a> FromIterator<&'a str> for String {
742742
}
743743
}
744744

745-
#[unstable(feature = "collections",
746-
reason = "waiting on Extend stabilization")]
745+
#[stable(feature = "rust1", since = "1.0.0")]
747746
impl Extend<char> for String {
748747
fn extend<I: IntoIterator<Item=char>>(&mut self, iterable: I) {
749748
let iterator = iterable.into_iter();
@@ -755,8 +754,7 @@ impl Extend<char> for String {
755754
}
756755
}
757756

758-
#[unstable(feature = "collections",
759-
reason = "waiting on Extend stabilization")]
757+
#[stable(feature = "rust1", since = "1.0.0")]
760758
impl<'a> Extend<&'a str> for String {
761759
fn extend<I: IntoIterator<Item=&'a str>>(&mut self, iterable: I) {
762760
let iterator = iterable.into_iter();
@@ -871,8 +869,7 @@ impl hash::Hash for String {
871869
}
872870
}
873871

874-
#[unstable(feature = "collections",
875-
reason = "recent addition, needs more experience")]
872+
#[stable(feature = "rust1", since = "1.0.0")]
876873
impl<'a> Add<&'a str> for String {
877874
type Output = String;
878875

@@ -965,11 +962,17 @@ pub fn as_string<'a>(x: &'a str) -> DerefString<'a> {
965962
DerefString { x: as_vec(x.as_bytes()) }
966963
}
967964

968-
#[unstable(feature = "collections", reason = "associated error type may change")]
965+
/// Error returned from `String::from_str`
966+
#[unstable(feature = "str_parse_error", reason = "may want to be replaced with \
967+
Void if it ever exists")]
968+
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
969+
pub struct ParseError(());
970+
971+
#[stable(feature = "rust1", since = "1.0.0")]
969972
impl FromStr for String {
970-
type Err = ();
973+
type Err = ParseError;
971974
#[inline]
972-
fn from_str(s: &str) -> Result<String, ()> {
975+
fn from_str(s: &str) -> Result<String, ParseError> {
973976
Ok(String::from_str(s))
974977
}
975978
}

src/libcollections/vec.rs

+4-16
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ use core::intrinsics::assume;
5959
use core::iter::{repeat, FromIterator};
6060
use core::marker::PhantomData;
6161
use core::mem;
62-
use core::ops::{Index, IndexMut, Deref, Add};
62+
use core::ops::{Index, IndexMut, Deref};
6363
use core::ops;
6464
use core::ptr;
6565
use core::ptr::Unique;
@@ -1276,7 +1276,7 @@ pub fn from_elem<T: Clone>(elem: T, n: usize) -> Vec<T> {
12761276
// Common trait implementations for Vec
12771277
////////////////////////////////////////////////////////////////////////////////
12781278

1279-
#[unstable(feature = "collections")]
1279+
#[stable(feature = "rust1", since = "1.0.0")]
12801280
impl<T:Clone> Clone for Vec<T> {
12811281
#[cfg(not(test))]
12821282
fn clone(&self) -> Vec<T> { <[T]>::to_vec(&**self) }
@@ -1531,7 +1531,7 @@ impl<'a, T> IntoIterator for &'a mut Vec<T> {
15311531
}
15321532
}
15331533

1534-
#[unstable(feature = "collections", reason = "waiting on Extend stability")]
1534+
#[stable(feature = "rust1", since = "1.0.0")]
15351535
impl<T> Extend<T> for Vec<T> {
15361536
#[inline]
15371537
fn extend<I: IntoIterator<Item=T>>(&mut self, iterable: I) {
@@ -1591,18 +1591,6 @@ impl<T: Ord> Ord for Vec<T> {
15911591
}
15921592
}
15931593

1594-
#[unstable(feature = "collections",
1595-
reason = "recent addition, needs more experience")]
1596-
impl<'a, T: Clone> Add<&'a [T]> for Vec<T> {
1597-
type Output = Vec<T>;
1598-
1599-
#[inline]
1600-
fn add(mut self, rhs: &[T]) -> Vec<T> {
1601-
self.push_all(rhs);
1602-
self
1603-
}
1604-
}
1605-
16061594
#[unsafe_destructor]
16071595
#[stable(feature = "rust1", since = "1.0.0")]
16081596
impl<T> Drop for Vec<T> {
@@ -1672,7 +1660,7 @@ impl<'a> From<&'a str> for Vec<u8> {
16721660
// Clone-on-write
16731661
////////////////////////////////////////////////////////////////////////////////
16741662

1675-
#[unstable(feature = "collections")]
1663+
#[stable(feature = "rust1", since = "1.0.0")]
16761664
impl<'a, T> FromIterator<T> for Cow<'a, [T]> where T: Clone {
16771665
fn from_iter<I: IntoIterator<Item=T>>(it: I) -> Cow<'a, [T]> {
16781666
Cow::Owned(FromIterator::from_iter(it))

src/libcore/iter.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -626,12 +626,10 @@ pub trait Iterator {
626626
/// # Examples
627627
///
628628
/// ```
629-
/// # #![feature(core)]
630629
/// let a = [1, 2, 3, 4, 5];
631630
/// let mut it = a.iter();
632631
/// assert!(it.any(|x| *x == 3));
633-
/// assert_eq!(&it[..], [4, 5]);
634-
///
632+
/// assert_eq!(it.collect::<Vec<_>>(), [&4, &5]);
635633
/// ```
636634
#[inline]
637635
#[stable(feature = "rust1", since = "1.0.0")]
@@ -654,11 +652,10 @@ pub trait Iterator {
654652
/// # Examples
655653
///
656654
/// ```
657-
/// # #![feature(core)]
658655
/// let a = [1, 2, 3, 4, 5];
659656
/// let mut it = a.iter();
660657
/// assert_eq!(it.find(|&x| *x == 3).unwrap(), &3);
661-
/// assert_eq!(&it[..], [4, 5]);
658+
/// assert_eq!(it.collect::<Vec<_>>(), [&4, &5]);
662659
#[inline]
663660
#[stable(feature = "rust1", since = "1.0.0")]
664661
fn find<P>(&mut self, mut predicate: P) -> Option<Self::Item> where
@@ -678,11 +675,10 @@ pub trait Iterator {
678675
/// # Examples
679676
///
680677
/// ```
681-
/// # #![feature(core)]
682678
/// let a = [1, 2, 3, 4, 5];
683679
/// let mut it = a.iter();
684680
/// assert_eq!(it.position(|x| *x == 3).unwrap(), 2);
685-
/// assert_eq!(&it[..], [4, 5]);
681+
/// assert_eq!(it.collect::<Vec<_>>(), [&4, &5]);
686682
#[inline]
687683
#[stable(feature = "rust1", since = "1.0.0")]
688684
fn position<P>(&mut self, mut predicate: P) -> Option<usize> where
@@ -708,11 +704,10 @@ pub trait Iterator {
708704
/// # Examples
709705
///
710706
/// ```
711-
/// # #![feature(core)]
712707
/// let a = [1, 2, 2, 4, 5];
713708
/// let mut it = a.iter();
714709
/// assert_eq!(it.rposition(|x| *x == 2).unwrap(), 2);
715-
/// assert_eq!(&it[..], [1, 2]);
710+
/// assert_eq!(it.collect::<Vec<_>>(), [&1, &2]);
716711
#[inline]
717712
#[stable(feature = "rust1", since = "1.0.0")]
718713
fn rposition<P>(&mut self, mut predicate: P) -> Option<usize> where

src/libcore/slice.rs

-110
Original file line numberDiff line numberDiff line change
@@ -736,46 +736,6 @@ pub struct Iter<'a, T: 'a> {
736736
unsafe impl<'a, T: Sync> Sync for Iter<'a, T> {}
737737
unsafe impl<'a, T: Sync> Send for Iter<'a, T> {}
738738

739-
#[unstable(feature = "core")]
740-
impl<'a, T> ops::Index<ops::Range<usize>> for Iter<'a, T> {
741-
type Output = [T];
742-
743-
#[inline]
744-
fn index(&self, index: ops::Range<usize>) -> &[T] {
745-
self.as_slice().index(index)
746-
}
747-
}
748-
749-
#[unstable(feature = "core")]
750-
impl<'a, T> ops::Index<ops::RangeTo<usize>> for Iter<'a, T> {
751-
type Output = [T];
752-
753-
#[inline]
754-
fn index(&self, index: ops::RangeTo<usize>) -> &[T] {
755-
self.as_slice().index(index)
756-
}
757-
}
758-
759-
#[unstable(feature = "core")]
760-
impl<'a, T> ops::Index<ops::RangeFrom<usize>> for Iter<'a, T> {
761-
type Output = [T];
762-
763-
#[inline]
764-
fn index(&self, index: ops::RangeFrom<usize>) -> &[T] {
765-
self.as_slice().index(index)
766-
}
767-
}
768-
769-
#[unstable(feature = "core")]
770-
impl<'a, T> ops::Index<RangeFull> for Iter<'a, T> {
771-
type Output = [T];
772-
773-
#[inline]
774-
fn index(&self, _index: RangeFull) -> &[T] {
775-
self.as_slice()
776-
}
777-
}
778-
779739
impl<'a, T> Iter<'a, T> {
780740
/// View the underlying data as a subslice of the original data.
781741
///
@@ -833,76 +793,6 @@ pub struct IterMut<'a, T: 'a> {
833793
unsafe impl<'a, T: Sync> Sync for IterMut<'a, T> {}
834794
unsafe impl<'a, T: Send> Send for IterMut<'a, T> {}
835795

836-
#[unstable(feature = "core")]
837-
impl<'a, T> ops::Index<ops::Range<usize>> for IterMut<'a, T> {
838-
type Output = [T];
839-
840-
#[inline]
841-
fn index(&self, index: ops::Range<usize>) -> &[T] {
842-
self.index(RangeFull).index(index)
843-
}
844-
}
845-
#[unstable(feature = "core")]
846-
impl<'a, T> ops::Index<ops::RangeTo<usize>> for IterMut<'a, T> {
847-
type Output = [T];
848-
849-
#[inline]
850-
fn index(&self, index: ops::RangeTo<usize>) -> &[T] {
851-
self.index(RangeFull).index(index)
852-
}
853-
}
854-
#[unstable(feature = "core")]
855-
impl<'a, T> ops::Index<ops::RangeFrom<usize>> for IterMut<'a, T> {
856-
type Output = [T];
857-
858-
#[inline]
859-
fn index(&self, index: ops::RangeFrom<usize>) -> &[T] {
860-
self.index(RangeFull).index(index)
861-
}
862-
}
863-
#[unstable(feature = "core")]
864-
impl<'a, T> ops::Index<RangeFull> for IterMut<'a, T> {
865-
type Output = [T];
866-
867-
#[inline]
868-
fn index(&self, _index: RangeFull) -> &[T] {
869-
make_slice!(T => &[T]: self.ptr, self.end)
870-
}
871-
}
872-
873-
#[unstable(feature = "core")]
874-
impl<'a, T> ops::IndexMut<ops::Range<usize>> for IterMut<'a, T> {
875-
#[inline]
876-
fn index_mut(&mut self, index: ops::Range<usize>) -> &mut [T] {
877-
self.index_mut(RangeFull).index_mut(index)
878-
}
879-
}
880-
#[unstable(feature = "core")]
881-
impl<'a, T> ops::IndexMut<ops::RangeTo<usize>> for IterMut<'a, T> {
882-
883-
#[inline]
884-
fn index_mut(&mut self, index: ops::RangeTo<usize>) -> &mut [T] {
885-
self.index_mut(RangeFull).index_mut(index)
886-
}
887-
}
888-
#[unstable(feature = "core")]
889-
impl<'a, T> ops::IndexMut<ops::RangeFrom<usize>> for IterMut<'a, T> {
890-
891-
#[inline]
892-
fn index_mut(&mut self, index: ops::RangeFrom<usize>) -> &mut [T] {
893-
self.index_mut(RangeFull).index_mut(index)
894-
}
895-
}
896-
#[unstable(feature = "core")]
897-
impl<'a, T> ops::IndexMut<RangeFull> for IterMut<'a, T> {
898-
899-
#[inline]
900-
fn index_mut(&mut self, _index: RangeFull) -> &mut [T] {
901-
make_mut_slice!(T => &mut [T]: self.ptr, self.end)
902-
}
903-
}
904-
905-
906796
impl<'a, T> IterMut<'a, T> {
907797
/// View the underlying data as a subslice of the original data.
908798
///

src/libcoretest/slice.rs

-46
Original file line numberDiff line numberDiff line change
@@ -35,50 +35,4 @@ fn binary_search_not_found() {
3535
}
3636

3737
#[test]
38-
fn iterator_to_slice() {
39-
macro_rules! test {
40-
($data: expr) => {{
41-
let data: &mut [_] = &mut $data;
42-
let other_data: &mut [_] = &mut $data;
43-
44-
{
45-
let mut iter = data.iter();
46-
assert_eq!(&iter[..], &other_data[..]);
47-
48-
iter.next();
49-
assert_eq!(&iter[..], &other_data[1..]);
50-
51-
iter.next_back();
52-
assert_eq!(&iter[..], &other_data[1..2]);
53-
54-
let s = iter.as_slice();
55-
iter.next();
56-
assert_eq!(s, &other_data[1..2]);
57-
}
58-
{
59-
let mut iter = data.iter_mut();
60-
assert_eq!(&iter[..], &other_data[..]);
61-
// mutability:
62-
assert!(&mut iter[..] == other_data);
63-
64-
iter.next();
65-
assert_eq!(&iter[..], &other_data[1..]);
66-
assert!(&mut iter[..] == &mut other_data[1..]);
67-
68-
iter.next_back();
69-
70-
assert_eq!(&iter[..], &other_data[1..2]);
71-
assert!(&mut iter[..] == &mut other_data[1..2]);
72-
73-
let s = iter.into_slice();
74-
assert!(s == &mut other_data[1..2]);
75-
}
76-
}}
77-
}
78-
79-
// try types of a variety of sizes
80-
test!([(1u64, 1u64, 1u8), (2, 2, 2), (3, 3, 3)]);
81-
test!([1u64,2,3]);
82-
test!([1u8,2,3]);
83-
test!([(),(),()]);
8438
}

src/librustc_driver/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -855,10 +855,10 @@ pub fn monitor<F:FnOnce()+Send+'static>(f: F) {
855855
pub fn diagnostics_registry() -> diagnostics::registry::Registry {
856856
use syntax::diagnostics::registry::Registry;
857857

858-
let all_errors = Vec::new() +
859-
&rustc::diagnostics::DIAGNOSTICS[..] +
860-
&rustc_typeck::diagnostics::DIAGNOSTICS[..] +
861-
&rustc_resolve::diagnostics::DIAGNOSTICS[..];
858+
let mut all_errors = Vec::new();
859+
all_errors.push_all(&rustc::diagnostics::DIAGNOSTICS);
860+
all_errors.push_all(&rustc_typeck::diagnostics::DIAGNOSTICS);
861+
all_errors.push_all(&rustc_resolve::diagnostics::DIAGNOSTICS);
862862

863863
Registry::new(&*all_errors)
864864
}

0 commit comments

Comments
 (0)