Skip to content

Commit d969c66

Browse files
committed
---
yaml --- r: 212665 b: refs/heads/tmp c: 02c33b6 h: refs/heads/master i: 212663: 50639dd v: v3
1 parent f06f8e3 commit d969c66

File tree

64 files changed

+615
-198
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+615
-198
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3232
refs/heads/beta: 4efc4ec178f6ddf3c8cd268b011f3a04056f9d16
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
35-
refs/heads/tmp: c160192f5f26279eb065a163e651ce610247b108
35+
refs/heads/tmp: 02c33b690b9270ef7d26412fdf4a8498acfea1a7
3636
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3737
refs/tags/homu-tmp: bea1c4a78e5233ea6f85a2028a26e08c26635fca
3838
refs/heads/gate: 97c84447b65164731087ea82685580cc81424412

branches/tmp/src/liballoc/boxed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ use core::raw::{TraitObject};
8181
#[lang = "exchange_heap"]
8282
#[unstable(feature = "alloc",
8383
reason = "may be renamed; uncertain about custom allocator design")]
84-
pub static HEAP: () = ();
84+
pub const HEAP: () = ();
8585

8686
/// A pointer type for heap allocation.
8787
///

branches/tmp/src/libcollections/binary_heap.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,3 +760,10 @@ impl<T: Ord> Extend<T> for BinaryHeap<T> {
760760
}
761761
}
762762
}
763+
764+
#[stable(feature = "extend_ref", since = "1.2.0")]
765+
impl<'a, T: 'a + Ord + Copy> Extend<&'a T> for BinaryHeap<T> {
766+
fn extend<I: IntoIterator<Item=&'a T>>(&mut self, iter: I) {
767+
self.extend(iter.into_iter().cloned());
768+
}
769+
}

branches/tmp/src/libcollections/bit.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ fn match_words <'a,'b>(a: &'a BitVec, b: &'b BitVec) -> (MatchWords<'a>, MatchWo
125125
}
126126
}
127127

128-
static TRUE: bool = true;
129-
static FALSE: bool = false;
128+
const TRUE: &'static bool = &true;
129+
const FALSE: &'static bool = &false;
130130

131131
/// The bitvector type.
132132
///
@@ -172,9 +172,9 @@ impl Index<usize> for BitVec {
172172
#[inline]
173173
fn index(&self, i: usize) -> &bool {
174174
if self.get(i).expect("index out of bounds") {
175-
&TRUE
175+
TRUE
176176
} else {
177-
&FALSE
177+
FALSE
178178
}
179179
}
180180
}
@@ -1070,6 +1070,13 @@ impl Extend<bool> for BitVec {
10701070
}
10711071
}
10721072

1073+
#[stable(feature = "extend_ref", since = "1.2.0")]
1074+
impl<'a> Extend<&'a bool> for BitVec {
1075+
fn extend<I: IntoIterator<Item=&'a bool>>(&mut self, iter: I) {
1076+
self.extend(iter.into_iter().cloned());
1077+
}
1078+
}
1079+
10731080
#[stable(feature = "rust1", since = "1.0.0")]
10741081
impl Clone for BitVec {
10751082
#[inline]
@@ -1278,6 +1285,13 @@ impl Extend<usize> for BitSet {
12781285
}
12791286
}
12801287

1288+
#[stable(feature = "extend_ref", since = "1.2.0")]
1289+
impl<'a> Extend<&'a usize> for BitSet {
1290+
fn extend<I: IntoIterator<Item=&'a usize>>(&mut self, iter: I) {
1291+
self.extend(iter.into_iter().cloned());
1292+
}
1293+
}
1294+
12811295
#[stable(feature = "rust1", since = "1.0.0")]
12821296
impl PartialOrd for BitSet {
12831297
#[inline]

branches/tmp/src/libcollections/btree/map.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,13 @@ impl<K: Ord, V> Extend<(K, V)> for BTreeMap<K, V> {
879879
}
880880
}
881881

882+
#[stable(feature = "extend_ref", since = "1.2.0")]
883+
impl<'a, K: Ord + Copy, V: Copy> Extend<(&'a K, &'a V)> for BTreeMap<K, V> {
884+
fn extend<I: IntoIterator<Item=(&'a K, &'a V)>>(&mut self, iter: I) {
885+
self.extend(iter.into_iter().map(|(&key, &value)| (key, value)));
886+
}
887+
}
888+
882889
#[stable(feature = "rust1", since = "1.0.0")]
883890
impl<K: Hash, V: Hash> Hash for BTreeMap<K, V> {
884891
fn hash<H: Hasher>(&self, state: &mut H) {

branches/tmp/src/libcollections/btree/set.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,13 @@ impl<T: Ord> Extend<T> for BTreeSet<T> {
509509
}
510510
}
511511

512+
#[stable(feature = "extend_ref", since = "1.2.0")]
513+
impl<'a, T: 'a + Ord + Copy> Extend<&'a T> for BTreeSet<T> {
514+
fn extend<I: IntoIterator<Item=&'a T>>(&mut self, iter: I) {
515+
self.extend(iter.into_iter().cloned());
516+
}
517+
}
518+
512519
#[stable(feature = "rust1", since = "1.0.0")]
513520
impl<T: Ord> Default for BTreeSet<T> {
514521
#[stable(feature = "rust1", since = "1.0.0")]

branches/tmp/src/libcollections/enum_set.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,3 +288,10 @@ impl<E:CLike> Extend<E> for EnumSet<E> {
288288
}
289289
}
290290
}
291+
292+
#[stable(feature = "extend_ref", since = "1.2.0")]
293+
impl<'a, E: 'a + CLike + Copy> Extend<&'a E> for EnumSet<E> {
294+
fn extend<I: IntoIterator<Item=&'a E>>(&mut self, iter: I) {
295+
self.extend(iter.into_iter().cloned());
296+
}
297+
}

branches/tmp/src/libcollections/linked_list.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,13 @@ impl<A> Extend<A> for LinkedList<A> {
904904
}
905905
}
906906

907+
#[stable(feature = "extend_ref", since = "1.2.0")]
908+
impl<'a, T: 'a + Copy> Extend<&'a T> for LinkedList<T> {
909+
fn extend<I: IntoIterator<Item=&'a T>>(&mut self, iter: I) {
910+
self.extend(iter.into_iter().cloned());
911+
}
912+
}
913+
907914
#[stable(feature = "rust1", since = "1.0.0")]
908915
impl<A: PartialEq> PartialEq for LinkedList<A> {
909916
fn eq(&self, other: &LinkedList<A>) -> bool {

branches/tmp/src/libcollections/str.rs

Lines changed: 28 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -640,17 +640,20 @@ impl str {
640640
///
641641
/// let v: Vec<&str> = "lion::tiger::leopard".split("::").collect();
642642
/// assert_eq!(v, ["lion", "tiger", "leopard"]);
643-
/// ```
644-
///
645-
/// More complex patterns with closures:
646643
///
647-
/// ```
648-
/// let v: Vec<&str> = "abc1def2ghi".split(|c: char| c.is_numeric()).collect();
644+
/// let v: Vec<&str> = "abc1def2ghi".split(char::is_numeric).collect();
649645
/// assert_eq!(v, ["abc", "def", "ghi"]);
650646
///
651647
/// let v: Vec<&str> = "lionXtigerXleopard".split(char::is_uppercase).collect();
652648
/// assert_eq!(v, ["lion", "tiger", "leopard"]);
653649
/// ```
650+
///
651+
/// A more complex pattern, using a closure:
652+
///
653+
/// ```
654+
/// let v: Vec<&str> = "abc1defXghi".split(|c| c == '1' || c == 'X').collect();
655+
/// assert_eq!(v, ["abc", "def", "ghi"]);
656+
/// ```
654657
#[stable(feature = "rust1", since = "1.0.0")]
655658
pub fn split<'a, P: Pattern<'a>>(&'a self, pat: P) -> Split<'a, P> {
656659
core_str::StrExt::split(&self[..], pat)
@@ -691,14 +694,11 @@ impl str {
691694
/// assert_eq!(v, ["leopard", "tiger", "lion"]);
692695
/// ```
693696
///
694-
/// More complex patterns with closures:
697+
/// A more complex pattern, using a closure:
695698
///
696-
/// ```rust
697-
/// let v: Vec<&str> = "abc1def2ghi".rsplit(|c: char| c.is_numeric()).collect();
699+
/// ```
700+
/// let v: Vec<&str> = "abc1defXghi".rsplit(|c| c == '1' || c == 'X').collect();
698701
/// assert_eq!(v, ["ghi", "def", "abc"]);
699-
///
700-
/// let v: Vec<&str> = "lionXtigerXleopard".rsplit(char::is_uppercase).collect();
701-
/// assert_eq!(v, ["leopard", "tiger", "lion"]);
702702
/// ```
703703
#[stable(feature = "rust1", since = "1.0.0")]
704704
pub fn rsplit<'a, P: Pattern<'a>>(&'a self, pat: P) -> RSplit<'a, P>
@@ -733,22 +733,13 @@ impl str {
733733
///
734734
/// # Examples
735735
///
736-
/// Simple patterns:
737-
///
738736
/// ```
739737
/// let v: Vec<&str> = "A.B.".split_terminator('.').collect();
740738
/// assert_eq!(v, ["A", "B"]);
741739
///
742740
/// let v: Vec<&str> = "A..B..".split_terminator(".").collect();
743741
/// assert_eq!(v, ["A", "", "B", ""]);
744742
/// ```
745-
///
746-
/// More complex patterns with closures:
747-
///
748-
/// ```
749-
/// let v: Vec<&str> = "abc1def2ghi3".split_terminator(|c: char| c.is_numeric()).collect();
750-
/// assert_eq!(v, ["abc", "def", "ghi"]);
751-
/// ```
752743
#[stable(feature = "rust1", since = "1.0.0")]
753744
pub fn split_terminator<'a, P: Pattern<'a>>(&'a self, pat: P) -> SplitTerminator<'a, P> {
754745
core_str::StrExt::split_terminator(&self[..], pat)
@@ -778,22 +769,13 @@ impl str {
778769
///
779770
/// # Examples
780771
///
781-
/// Simple patterns:
782-
///
783772
/// ```
784773
/// let v: Vec<&str> = "A.B.".rsplit_terminator('.').collect();
785774
/// assert_eq!(v, ["B", "A"]);
786775
///
787776
/// let v: Vec<&str> = "A..B..".rsplit_terminator(".").collect();
788777
/// assert_eq!(v, ["", "B", "", "A"]);
789778
/// ```
790-
///
791-
/// More complex patterns with closures:
792-
///
793-
/// ```
794-
/// let v: Vec<&str> = "abc1def2ghi3".rsplit_terminator(|c: char| c.is_numeric()).collect();
795-
/// assert_eq!(v, ["ghi", "def", "abc"]);
796-
/// ```
797779
#[stable(feature = "rust1", since = "1.0.0")]
798780
pub fn rsplit_terminator<'a, P: Pattern<'a>>(&'a self, pat: P) -> RSplitTerminator<'a, P>
799781
where P::Searcher: ReverseSearcher<'a>
@@ -837,11 +819,11 @@ impl str {
837819
/// assert_eq!(v, [""]);
838820
/// ```
839821
///
840-
/// More complex patterns with closures:
822+
/// A more complex pattern, using a closure:
841823
///
842824
/// ```
843-
/// let v: Vec<&str> = "abc1def2ghi".splitn(2, |c: char| c.is_numeric()).collect();
844-
/// assert_eq!(v, ["abc", "def2ghi"]);
825+
/// let v: Vec<&str> = "abc1defXghi".splitn(2, |c| c == '1' || c == 'X').collect();
826+
/// assert_eq!(v, ["abc", "defXghi"]);
845827
/// ```
846828
#[stable(feature = "rust1", since = "1.0.0")]
847829
pub fn splitn<'a, P: Pattern<'a>>(&'a self, count: usize, pat: P) -> SplitN<'a, P> {
@@ -882,10 +864,10 @@ impl str {
882864
/// assert_eq!(v, ["leopard", "lion::tiger"]);
883865
/// ```
884866
///
885-
/// More complex patterns with closures:
867+
/// A more complex pattern, using a closure:
886868
///
887869
/// ```
888-
/// let v: Vec<&str> = "abc1def2ghi".rsplitn(2, |c: char| c.is_numeric()).collect();
870+
/// let v: Vec<&str> = "abc1defXghi".rsplitn(2, |c| c == '1' || c == 'X').collect();
889871
/// assert_eq!(v, ["ghi", "abc1def"]);
890872
/// ```
891873
#[stable(feature = "rust1", since = "1.0.0")]
@@ -920,7 +902,7 @@ impl str {
920902
/// let v: Vec<&str> = "abcXXXabcYYYabc".matches("abc").collect();
921903
/// assert_eq!(v, ["abc", "abc", "abc"]);
922904
///
923-
/// let v: Vec<&str> = "1abc2abc3".matches(|c: char| c.is_numeric()).collect();
905+
/// let v: Vec<&str> = "1abc2abc3".matches(char::is_numeric).collect();
924906
/// assert_eq!(v, ["1", "2", "3"]);
925907
/// ```
926908
#[unstable(feature = "collections",
@@ -953,7 +935,7 @@ impl str {
953935
/// let v: Vec<&str> = "abcXXXabcYYYabc".rmatches("abc").collect();
954936
/// assert_eq!(v, ["abc", "abc", "abc"]);
955937
///
956-
/// let v: Vec<&str> = "1abc2abc3".rmatches(|c: char| c.is_numeric()).collect();
938+
/// let v: Vec<&str> = "1abc2abc3".rmatches(char::is_numeric).collect();
957939
/// assert_eq!(v, ["3", "2", "1"]);
958940
/// ```
959941
#[unstable(feature = "collections",
@@ -1199,15 +1181,16 @@ impl str {
11991181
///
12001182
/// ```
12011183
/// assert_eq!("11foo1bar11".trim_matches('1'), "foo1bar");
1184+
/// assert_eq!("123foo1bar123".trim_matches(char::is_numeric), "foo1bar");
12021185
///
12031186
/// let x: &[_] = &['1', '2'];
12041187
/// assert_eq!("12foo1bar12".trim_matches(x), "foo1bar");
12051188
/// ```
12061189
///
1207-
/// More complex patterns with closures:
1190+
/// A more complex pattern, using a closure:
12081191
///
12091192
/// ```
1210-
/// assert_eq!("123foo1bar123".trim_matches(|c: char| c.is_numeric()), "foo1bar");
1193+
/// assert_eq!("1foo1barXX".trim_matches(|c| c == '1' || c == 'X'), "foo1bar");
12111194
/// ```
12121195
#[stable(feature = "rust1", since = "1.0.0")]
12131196
pub fn trim_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str
@@ -1224,20 +1207,13 @@ impl str {
12241207
///
12251208
/// # Examples
12261209
///
1227-
/// Simple patterns:
1228-
///
12291210
/// ```
12301211
/// assert_eq!("11foo1bar11".trim_left_matches('1'), "foo1bar11");
1212+
/// assert_eq!("123foo1bar123".trim_left_matches(char::is_numeric), "foo1bar123");
12311213
///
12321214
/// let x: &[_] = &['1', '2'];
12331215
/// assert_eq!("12foo1bar12".trim_left_matches(x), "foo1bar12");
12341216
/// ```
1235-
///
1236-
/// More complex patterns with closures:
1237-
///
1238-
/// ```
1239-
/// assert_eq!("123foo1bar123".trim_left_matches(|c: char| c.is_numeric()), "foo1bar123");
1240-
/// ```
12411217
#[stable(feature = "rust1", since = "1.0.0")]
12421218
pub fn trim_left_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str {
12431219
core_str::StrExt::trim_left_matches(&self[..], pat)
@@ -1255,14 +1231,16 @@ impl str {
12551231
///
12561232
/// ```
12571233
/// assert_eq!("11foo1bar11".trim_right_matches('1'), "11foo1bar");
1234+
/// assert_eq!("123foo1bar123".trim_right_matches(char::is_numeric), "123foo1bar");
1235+
///
12581236
/// let x: &[_] = &['1', '2'];
12591237
/// assert_eq!("12foo1bar12".trim_right_matches(x), "12foo1bar");
12601238
/// ```
12611239
///
1262-
/// More complex patterns with closures:
1240+
/// A more complex pattern, using a closure:
12631241
///
12641242
/// ```
1265-
/// assert_eq!("123foo1bar123".trim_right_matches(|c: char| c.is_numeric()), "123foo1bar");
1243+
/// assert_eq!("1fooX".trim_left_matches(|c| c == '1' || c == 'X'), "fooX");
12661244
/// ```
12671245
#[stable(feature = "rust1", since = "1.0.0")]
12681246
pub fn trim_right_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str
@@ -1499,7 +1477,7 @@ impl str {
14991477
/// ```
15001478
/// let s = "Löwe 老虎 Léopard";
15011479
///
1502-
/// assert_eq!(s.find(|c: char| c.is_whitespace()), Some(5));
1480+
/// assert_eq!(s.find(char::is_whitespace), Some(5));
15031481
/// assert_eq!(s.find(char::is_lowercase), Some(1));
15041482
/// ```
15051483
///
@@ -1541,7 +1519,7 @@ impl str {
15411519
/// ```
15421520
/// let s = "Löwe 老虎 Léopard";
15431521
///
1544-
/// assert_eq!(s.rfind(|c: char| c.is_whitespace()), Some(12));
1522+
/// assert_eq!(s.rfind(char::is_whitespace), Some(12));
15451523
/// assert_eq!(s.rfind(char::is_lowercase), Some(20));
15461524
/// ```
15471525
///

branches/tmp/src/libcollections/string.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,13 @@ impl Extend<char> for String {
793793
}
794794
}
795795

796+
#[stable(feature = "extend_ref", since = "1.2.0")]
797+
impl<'a> Extend<&'a char> for String {
798+
fn extend<I: IntoIterator<Item=&'a char>>(&mut self, iter: I) {
799+
self.extend(iter.into_iter().cloned());
800+
}
801+
}
802+
796803
#[stable(feature = "rust1", since = "1.0.0")]
797804
impl<'a> Extend<&'a str> for String {
798805
fn extend<I: IntoIterator<Item=&'a str>>(&mut self, iterable: I) {

branches/tmp/src/libcollections/vec.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ use borrow::{Cow, IntoCow};
8383
use super::range::RangeArgument;
8484

8585
// FIXME- fix places which assume the max vector allowed has memory usize::MAX.
86-
static MAX_MEMORY_SIZE: usize = isize::MAX as usize;
86+
const MAX_MEMORY_SIZE: usize = isize::MAX as usize;
8787

8888
/// A growable list type, written `Vec<T>` but pronounced 'vector.'
8989
///
@@ -1578,6 +1578,13 @@ impl<T> Extend<T> for Vec<T> {
15781578
}
15791579
}
15801580

1581+
#[stable(feature = "extend_ref", since = "1.2.0")]
1582+
impl<'a, T: 'a + Copy> Extend<&'a T> for Vec<T> {
1583+
fn extend<I: IntoIterator<Item=&'a T>>(&mut self, iter: I) {
1584+
self.extend(iter.into_iter().cloned());
1585+
}
1586+
}
1587+
15811588
__impl_slice_eq1! { Vec<A>, Vec<B> }
15821589
__impl_slice_eq1! { Vec<A>, &'b [B] }
15831590
__impl_slice_eq1! { Vec<A>, &'b mut [B] }

branches/tmp/src/libcollections/vec_deque.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,6 +1785,13 @@ impl<A> Extend<A> for VecDeque<A> {
17851785
}
17861786
}
17871787

1788+
#[stable(feature = "extend_ref", since = "1.2.0")]
1789+
impl<'a, T: 'a + Copy> Extend<&'a T> for VecDeque<T> {
1790+
fn extend<I: IntoIterator<Item=&'a T>>(&mut self, iter: I) {
1791+
self.extend(iter.into_iter().cloned());
1792+
}
1793+
}
1794+
17881795
#[stable(feature = "rust1", since = "1.0.0")]
17891796
impl<T: fmt::Debug> fmt::Debug for VecDeque<T> {
17901797
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

0 commit comments

Comments
 (0)