Skip to content

Commit f89af3d

Browse files
committed
---
yaml --- r: 207915 b: refs/heads/snap-stage3 c: 1291041 h: refs/heads/master i: 207913: e1b7ffa 207911: 4ee5c64 v: v3
1 parent 601f534 commit f89af3d

File tree

16 files changed

+216
-78
lines changed

16 files changed

+216
-78
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 38a97becdf3e6a6157f6f7ec2d98ade8d8edc193
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: f6574c5b0404f55c4dd4056be47d37eff33684b5
4+
refs/heads/snap-stage3: 12910418fbfd1da76cfc43ffa7a15d0b0c4acb5b
55
refs/heads/try: 7b4ef47b7805a402d756fb8157101f64880a522f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/libcollections/string.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,8 @@ impl<'a> FromIterator<&'a str> for String {
740740
}
741741
}
742742

743-
#[stable(feature = "rust1", since = "1.0.0")]
743+
#[unstable(feature = "collections",
744+
reason = "waiting on Extend stabilization")]
744745
impl Extend<char> for String {
745746
fn extend<I: IntoIterator<Item=char>>(&mut self, iterable: I) {
746747
let iterator = iterable.into_iter();
@@ -752,7 +753,8 @@ impl Extend<char> for String {
752753
}
753754
}
754755

755-
#[stable(feature = "rust1", since = "1.0.0")]
756+
#[unstable(feature = "collections",
757+
reason = "waiting on Extend stabilization")]
756758
impl<'a> Extend<&'a str> for String {
757759
fn extend<I: IntoIterator<Item=&'a str>>(&mut self, iterable: I) {
758760
let iterator = iterable.into_iter();
@@ -867,7 +869,8 @@ impl hash::Hash for String {
867869
}
868870
}
869871

870-
#[stable(feature = "rust1", since = "1.0.0")]
872+
#[unstable(feature = "collections",
873+
reason = "recent addition, needs more experience")]
871874
impl<'a> Add<&'a str> for String {
872875
type Output = String;
873876

@@ -961,17 +964,11 @@ pub fn as_string<'a>(x: &'a str) -> DerefString<'a> {
961964
DerefString { x: as_vec(x.as_bytes()) }
962965
}
963966

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

branches/snap-stage3/src/libcollections/vec.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,7 @@ pub fn from_elem<T: Clone>(elem: T, n: usize) -> Vec<T> {
12991299
// Common trait implementations for Vec
13001300
////////////////////////////////////////////////////////////////////////////////
13011301

1302-
#[stable(feature = "rust1", since = "1.0.0")]
1302+
#[unstable(feature = "collections")]
13031303
impl<T:Clone> Clone for Vec<T> {
13041304
#[cfg(not(test))]
13051305
fn clone(&self) -> Vec<T> { <[T]>::to_vec(&**self) }
@@ -1554,7 +1554,7 @@ impl<'a, T> IntoIterator for &'a mut Vec<T> {
15541554
}
15551555
}
15561556

1557-
#[stable(feature = "rust1", since = "1.0.0")]
1557+
#[unstable(feature = "collections", reason = "waiting on Extend stability")]
15581558
impl<T> Extend<T> for Vec<T> {
15591559
#[inline]
15601560
fn extend<I: IntoIterator<Item=T>>(&mut self, iterable: I) {
@@ -1614,7 +1614,8 @@ impl<T: Ord> Ord for Vec<T> {
16141614
}
16151615
}
16161616

1617-
#[stable(feature = "rust1", since = "1.0.0")]
1617+
#[unstable(feature = "collections",
1618+
reason = "recent addition, needs more experience")]
16181619
impl<'a, T: Clone> Add<&'a [T]> for Vec<T> {
16191620
type Output = Vec<T>;
16201621

@@ -1693,7 +1694,7 @@ impl<'a> From<&'a str> for Vec<u8> {
16931694
// Clone-on-write
16941695
////////////////////////////////////////////////////////////////////////////////
16951696

1696-
#[stable(feature = "rust1", since = "1.0.0")]
1697+
#[unstable(feature = "collections")]
16971698
impl<'a, T> FromIterator<T> for Cow<'a, [T]> where T: Clone {
16981699
fn from_iter<I: IntoIterator<Item=T>>(it: I) -> Cow<'a, [T]> {
16991700
Cow::Owned(FromIterator::from_iter(it))

branches/snap-stage3/src/libcore/iter.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -626,10 +626,12 @@ pub trait Iterator {
626626
/// # Examples
627627
///
628628
/// ```
629+
/// # #![feature(core)]
629630
/// let a = [1, 2, 3, 4, 5];
630631
/// let mut it = a.iter();
631632
/// assert!(it.any(|x| *x == 3));
632-
/// assert_eq!(it.collect::<Vec<_>>(), [&4, &5]);
633+
/// assert_eq!(&it[..], [4, 5]);
634+
///
633635
/// ```
634636
#[inline]
635637
#[stable(feature = "rust1", since = "1.0.0")]
@@ -652,10 +654,11 @@ pub trait Iterator {
652654
/// # Examples
653655
///
654656
/// ```
657+
/// # #![feature(core)]
655658
/// let a = [1, 2, 3, 4, 5];
656659
/// let mut it = a.iter();
657660
/// assert_eq!(it.find(|&x| *x == 3).unwrap(), &3);
658-
/// assert_eq!(it.collect::<Vec<_>>(), [&4, &5]);
661+
/// assert_eq!(&it[..], [4, 5]);
659662
#[inline]
660663
#[stable(feature = "rust1", since = "1.0.0")]
661664
fn find<P>(&mut self, mut predicate: P) -> Option<Self::Item> where
@@ -675,10 +678,11 @@ pub trait Iterator {
675678
/// # Examples
676679
///
677680
/// ```
681+
/// # #![feature(core)]
678682
/// let a = [1, 2, 3, 4, 5];
679683
/// let mut it = a.iter();
680684
/// assert_eq!(it.position(|x| *x == 3).unwrap(), 2);
681-
/// assert_eq!(it.collect::<Vec<_>>(), [&4, &5]);
685+
/// assert_eq!(&it[..], [4, 5]);
682686
#[inline]
683687
#[stable(feature = "rust1", since = "1.0.0")]
684688
fn position<P>(&mut self, mut predicate: P) -> Option<usize> where
@@ -704,10 +708,11 @@ pub trait Iterator {
704708
/// # Examples
705709
///
706710
/// ```
711+
/// # #![feature(core)]
707712
/// let a = [1, 2, 2, 4, 5];
708713
/// let mut it = a.iter();
709714
/// assert_eq!(it.rposition(|x| *x == 2).unwrap(), 2);
710-
/// assert_eq!(it.collect::<Vec<_>>(), [&1, &2]);
715+
/// assert_eq!(&it[..], [1, 2]);
711716
#[inline]
712717
#[stable(feature = "rust1", since = "1.0.0")]
713718
fn rposition<P>(&mut self, mut predicate: P) -> Option<usize> where

branches/snap-stage3/src/libcore/num/float_macros.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ macro_rules! from_str_radix_float_impl {
3535
}
3636

3737
let (is_positive, src) = match src.slice_shift_char() {
38-
None => return Err(PFE { kind: Empty }),
39-
Some(('-', "")) => return Err(PFE { kind: Empty }),
38+
None => return Err(PFE { __kind: Empty }),
39+
Some(('-', "")) => return Err(PFE { __kind: Empty }),
4040
Some(('-', src)) => (false, src),
4141
Some((_, _)) => (true, src),
4242
};
@@ -88,7 +88,7 @@ macro_rules! from_str_radix_float_impl {
8888
break; // start of fractional part
8989
},
9090
_ => {
91-
return Err(PFE { kind: Invalid });
91+
return Err(PFE { __kind: Invalid });
9292
},
9393
},
9494
}
@@ -122,7 +122,7 @@ macro_rules! from_str_radix_float_impl {
122122
break; // start of exponent
123123
},
124124
_ => {
125-
return Err(PFE { kind: Invalid });
125+
return Err(PFE { __kind: Invalid });
126126
},
127127
},
128128
}
@@ -135,7 +135,7 @@ macro_rules! from_str_radix_float_impl {
135135
let base = match c {
136136
'E' | 'e' if radix == 10 => 10.0,
137137
'P' | 'p' if radix == 16 => 2.0,
138-
_ => return Err(PFE { kind: Invalid }),
138+
_ => return Err(PFE { __kind: Invalid }),
139139
};
140140

141141
// Parse the exponent as decimal integer
@@ -144,13 +144,13 @@ macro_rules! from_str_radix_float_impl {
144144
Some(('-', src)) => (false, src.parse::<usize>()),
145145
Some(('+', src)) => (true, src.parse::<usize>()),
146146
Some((_, _)) => (true, src.parse::<usize>()),
147-
None => return Err(PFE { kind: Invalid }),
147+
None => return Err(PFE { __kind: Invalid }),
148148
};
149149

150150
match (is_positive, exp) {
151151
(true, Ok(exp)) => base.powi(exp as i32),
152152
(false, Ok(exp)) => 1.0 / base.powi(exp as i32),
153-
(_, Err(_)) => return Err(PFE { kind: Invalid }),
153+
(_, Err(_)) => return Err(PFE { __kind: Invalid }),
154154
}
155155
},
156156
None => 1.0, // no exponent

branches/snap-stage3/src/libcore/num/mod.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,11 @@ impl fmt::Display for ParseIntError {
15241524

15251525
/// An error which can be returned when parsing a float.
15261526
#[derive(Debug, Clone, PartialEq)]
1527-
pub struct ParseFloatError { pub kind: FloatErrorKind }
1527+
#[stable(feature = "rust1", since = "1.0.0")]
1528+
pub struct ParseFloatError {
1529+
#[doc(hidden)]
1530+
pub __kind: FloatErrorKind
1531+
}
15281532

15291533
#[derive(Debug, Clone, PartialEq)]
15301534
pub enum FloatErrorKind {
@@ -1533,9 +1537,9 @@ pub enum FloatErrorKind {
15331537
}
15341538

15351539
impl ParseFloatError {
1536-
#[unstable(feature = "core", reason = "available through Error trait")]
1537-
pub fn description(&self) -> &str {
1538-
match self.kind {
1540+
#[doc(hidden)]
1541+
pub fn __description(&self) -> &str {
1542+
match self.__kind {
15391543
FloatErrorKind::Empty => "cannot parse float from empty string",
15401544
FloatErrorKind::Invalid => "invalid float literal",
15411545
}
@@ -1545,6 +1549,6 @@ impl ParseFloatError {
15451549
#[stable(feature = "rust1", since = "1.0.0")]
15461550
impl fmt::Display for ParseFloatError {
15471551
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1548-
self.description().fmt(f)
1552+
self.__description().fmt(f)
15491553
}
15501554
}

branches/snap-stage3/src/libcore/slice.rs

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,46 @@ pub struct Iter<'a, T: 'a> {
762762
unsafe impl<'a, T: Sync> Sync for Iter<'a, T> {}
763763
unsafe impl<'a, T: Sync> Send for Iter<'a, T> {}
764764

765+
#[unstable(feature = "core")]
766+
impl<'a, T> ops::Index<ops::Range<usize>> for Iter<'a, T> {
767+
type Output = [T];
768+
769+
#[inline]
770+
fn index(&self, index: ops::Range<usize>) -> &[T] {
771+
self.as_slice().index(index)
772+
}
773+
}
774+
775+
#[unstable(feature = "core")]
776+
impl<'a, T> ops::Index<ops::RangeTo<usize>> for Iter<'a, T> {
777+
type Output = [T];
778+
779+
#[inline]
780+
fn index(&self, index: ops::RangeTo<usize>) -> &[T] {
781+
self.as_slice().index(index)
782+
}
783+
}
784+
785+
#[unstable(feature = "core")]
786+
impl<'a, T> ops::Index<ops::RangeFrom<usize>> for Iter<'a, T> {
787+
type Output = [T];
788+
789+
#[inline]
790+
fn index(&self, index: ops::RangeFrom<usize>) -> &[T] {
791+
self.as_slice().index(index)
792+
}
793+
}
794+
795+
#[unstable(feature = "core")]
796+
impl<'a, T> ops::Index<RangeFull> for Iter<'a, T> {
797+
type Output = [T];
798+
799+
#[inline]
800+
fn index(&self, _index: RangeFull) -> &[T] {
801+
self.as_slice()
802+
}
803+
}
804+
765805
impl<'a, T> Iter<'a, T> {
766806
/// View the underlying data as a subslice of the original data.
767807
///
@@ -833,6 +873,76 @@ pub struct IterMut<'a, T: 'a> {
833873
unsafe impl<'a, T: Sync> Sync for IterMut<'a, T> {}
834874
unsafe impl<'a, T: Send> Send for IterMut<'a, T> {}
835875

876+
#[unstable(feature = "core")]
877+
impl<'a, T> ops::Index<ops::Range<usize>> for IterMut<'a, T> {
878+
type Output = [T];
879+
880+
#[inline]
881+
fn index(&self, index: ops::Range<usize>) -> &[T] {
882+
self.index(RangeFull).index(index)
883+
}
884+
}
885+
#[unstable(feature = "core")]
886+
impl<'a, T> ops::Index<ops::RangeTo<usize>> for IterMut<'a, T> {
887+
type Output = [T];
888+
889+
#[inline]
890+
fn index(&self, index: ops::RangeTo<usize>) -> &[T] {
891+
self.index(RangeFull).index(index)
892+
}
893+
}
894+
#[unstable(feature = "core")]
895+
impl<'a, T> ops::Index<ops::RangeFrom<usize>> for IterMut<'a, T> {
896+
type Output = [T];
897+
898+
#[inline]
899+
fn index(&self, index: ops::RangeFrom<usize>) -> &[T] {
900+
self.index(RangeFull).index(index)
901+
}
902+
}
903+
#[unstable(feature = "core")]
904+
impl<'a, T> ops::Index<RangeFull> for IterMut<'a, T> {
905+
type Output = [T];
906+
907+
#[inline]
908+
fn index(&self, _index: RangeFull) -> &[T] {
909+
make_slice!(T => &[T]: self.ptr, self.end)
910+
}
911+
}
912+
913+
#[unstable(feature = "core")]
914+
impl<'a, T> ops::IndexMut<ops::Range<usize>> for IterMut<'a, T> {
915+
#[inline]
916+
fn index_mut(&mut self, index: ops::Range<usize>) -> &mut [T] {
917+
self.index_mut(RangeFull).index_mut(index)
918+
}
919+
}
920+
#[unstable(feature = "core")]
921+
impl<'a, T> ops::IndexMut<ops::RangeTo<usize>> for IterMut<'a, T> {
922+
923+
#[inline]
924+
fn index_mut(&mut self, index: ops::RangeTo<usize>) -> &mut [T] {
925+
self.index_mut(RangeFull).index_mut(index)
926+
}
927+
}
928+
#[unstable(feature = "core")]
929+
impl<'a, T> ops::IndexMut<ops::RangeFrom<usize>> for IterMut<'a, T> {
930+
931+
#[inline]
932+
fn index_mut(&mut self, index: ops::RangeFrom<usize>) -> &mut [T] {
933+
self.index_mut(RangeFull).index_mut(index)
934+
}
935+
}
936+
#[unstable(feature = "core")]
937+
impl<'a, T> ops::IndexMut<RangeFull> for IterMut<'a, T> {
938+
939+
#[inline]
940+
fn index_mut(&mut self, _index: RangeFull) -> &mut [T] {
941+
make_mut_slice!(T => &mut [T]: self.ptr, self.end)
942+
}
943+
}
944+
945+
836946
impl<'a, T> IterMut<'a, T> {
837947
/// View the underlying data as a subslice of the original data.
838948
///

0 commit comments

Comments
 (0)