Skip to content

Commit f52ad5a

Browse files
committed
---
yaml --- r: 212669 b: refs/heads/tmp c: d6c8028 h: refs/heads/master i: 212667: ef409fc v: v3
1 parent 3998e0b commit f52ad5a

Some content is hidden

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

61 files changed

+553
-132
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: e772818294fb19622b403358db27dc6e0f11f728
35+
refs/heads/tmp: d6c8028ce0eaf18abb67e4e2dafc5aae2e6e91de
3636
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3737
refs/tags/homu-tmp: bea1c4a78e5233ea6f85a2028a26e08c26635fca
3838
refs/heads/gate: 97c84447b65164731087ea82685580cc81424412

branches/tmp/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
651651

652652
// Write debugger script:
653653
// We don't want to hang when calling `quit` while the process is still running
654-
let mut script_str = String::from_str("settings set auto-confirm true\n");
654+
let mut script_str = String::from("settings set auto-confirm true\n");
655655

656656
// Make LLDB emit its version, so we have it documented in the test output
657657
script_str.push_str("version\n");

branches/tmp/src/grammar/verify.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ fn main() {
287287
let options = config::basic_options();
288288
let session = session::build_session(options, None,
289289
syntax::diagnostics::registry::Registry::new(&[]));
290-
let filemap = session.parse_sess.codemap().new_filemap(String::from_str("<n/a>"), code);
290+
let filemap = session.parse_sess.codemap().new_filemap(String::from("<n/a>"), code);
291291
let mut lexer = lexer::StringReader::new(session.diagnostic(), filemap);
292292
let cm = session.codemap();
293293

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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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/string.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ impl String {
8989
///
9090
/// ```
9191
/// # #![feature(collections)]
92-
/// let s = String::from_str("hello");
92+
/// let s = String::from("hello");
9393
/// assert_eq!(&s[..], "hello");
9494
/// ```
9595
#[inline]
96-
#[unstable(feature = "collections",
97-
reason = "needs investigation to see if to_string() can match perf")]
96+
#[unstable(feature = "collections", reason = "use `String::from` instead")]
97+
#[deprecated(since = "1.2.0", reason = "use `String::from` instead")]
9898
#[cfg(not(test))]
9999
pub fn from_str(string: &str) -> String {
100100
String { vec: <[_]>::to_vec(string.as_bytes()) }
@@ -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) {
@@ -1002,7 +1009,7 @@ pub fn as_string<'a>(x: &'a str) -> DerefString<'a> {
10021009
DerefString { x: as_vec(x.as_bytes()) }
10031010
}
10041011

1005-
/// Error returned from `String::from_str`
1012+
/// Error returned from `String::from`
10061013
#[unstable(feature = "str_parse_error", reason = "may want to be replaced with \
10071014
Void if it ever exists")]
10081015
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
@@ -1013,7 +1020,7 @@ impl FromStr for String {
10131020
type Err = ParseError;
10141021
#[inline]
10151022
fn from_str(s: &str) -> Result<String, ParseError> {
1016-
Ok(String::from_str(s))
1023+
Ok(String::from(s))
10171024
}
10181025
}
10191026

branches/tmp/src/libcollections/vec.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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 {

branches/tmp/src/libcollections/vec_map.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,13 @@ impl<V> Extend<(usize, V)> for VecMap<V> {
828828
}
829829
}
830830

831+
#[stable(feature = "extend_ref", since = "1.2.0")]
832+
impl<'a, V: Copy> Extend<(usize, &'a V)> for VecMap<V> {
833+
fn extend<I: IntoIterator<Item=(usize, &'a V)>>(&mut self, iter: I) {
834+
self.extend(iter.into_iter().map(|(key, &value)| (key, value)));
835+
}
836+
}
837+
831838
impl<V> Index<usize> for VecMap<V> {
832839
type Output = V;
833840

branches/tmp/src/libcollectionstest/binary_heap.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,3 +217,28 @@ fn test_drain() {
217217

218218
assert!(q.is_empty());
219219
}
220+
221+
#[test]
222+
fn test_extend_ref() {
223+
let mut a = BinaryHeap::new();
224+
a.push(1);
225+
a.push(2);
226+
227+
a.extend(&[3, 4, 5]);
228+
229+
assert_eq!(a.len(), 5);
230+
assert_eq!(a.into_sorted_vec(), [1, 2, 3, 4, 5]);
231+
232+
let mut a = BinaryHeap::new();
233+
a.push(1);
234+
a.push(2);
235+
let mut b = BinaryHeap::new();
236+
b.push(3);
237+
b.push(4);
238+
b.push(5);
239+
240+
a.extend(&b);
241+
242+
assert_eq!(a.len(), 5);
243+
assert_eq!(a.into_sorted_vec(), [1, 2, 3, 4, 5]);
244+
}

branches/tmp/src/libcollectionstest/bit/set.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,26 @@ fn test_bit_set_split_off() {
448448
0b00101011, 0b10101101])));
449449
}
450450

451+
#[test]
452+
fn test_bit_set_extend_ref() {
453+
let mut a = BitSet::new();
454+
a.insert(3);
455+
456+
a.extend(&[5, 7, 10]);
457+
458+
assert_eq!(a.len(), 4);
459+
assert_eq!(a, BitSet::from_bit_vec(BitVec::from_bytes(&[0b00010101,0b00100000])));
460+
461+
let mut b = BitSet::new();
462+
b.insert(11);
463+
b.insert(15);
464+
465+
a.extend(&b);
466+
467+
assert_eq!(a.len(), 6);
468+
assert_eq!(a, BitSet::from_bit_vec(BitVec::from_bytes(&[0b00010101,0b00110001])));
469+
}
470+
451471
mod bench {
452472
use std::collections::{BitSet, BitVec};
453473
use std::__rand::{Rng, thread_rng, ThreadRng};

branches/tmp/src/libcollectionstest/bit/vec.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,24 @@ fn test_bit_vec_extend() {
630630
0b01001001, 0b10010010, 0b10111101]));
631631
}
632632

633+
#[test]
634+
fn test_bit_vecextend_ref() {
635+
let mut bv = BitVec::from_bytes(&[0b10100011]);
636+
bv.extend(&[true, false, true]);
637+
638+
assert_eq!(bv.len(), 11);
639+
assert!(bv.eq_vec(&[true, false, true, false, false, false, true, true,
640+
true, false, true]));
641+
642+
let bw = BitVec::from_bytes(&[0b00010001]);
643+
bv.extend(&bw);
644+
645+
assert_eq!(bv.len(), 19);
646+
assert!(bv.eq_vec(&[true, false, true, false, false, false, true, true,
647+
true, false, true, false, false, false, true, false,
648+
false, false, true]));
649+
}
650+
633651
#[test]
634652
fn test_bit_vec_append() {
635653
// Append to BitVec that holds a multiple of u32::BITS bits

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,22 @@ fn test_entry(){
249249
assert_eq!(map.len(), 6);
250250
}
251251

252+
#[test]
253+
fn test_extend_ref() {
254+
let mut a = BTreeMap::new();
255+
a.insert(1, "one");
256+
let mut b = BTreeMap::new();
257+
b.insert(2, "two");
258+
b.insert(3, "three");
259+
260+
a.extend(&b);
261+
262+
assert_eq!(a.len(), 3);
263+
assert_eq!(a[&1], "one");
264+
assert_eq!(a[&2], "two");
265+
assert_eq!(a[&3], "three");
266+
}
267+
252268
mod bench {
253269
use std::collections::BTreeMap;
254270
use std::__rand::{Rng, thread_rng};

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,31 @@ fn test_show() {
184184
assert_eq!(set_str, "{1, 2}");
185185
assert_eq!(format!("{:?}", empty), "{}");
186186
}
187+
188+
#[test]
189+
fn test_extend_ref() {
190+
let mut a = BTreeSet::new();
191+
a.insert(1);
192+
193+
a.extend(&[2, 3, 4]);
194+
195+
assert_eq!(a.len(), 4);
196+
assert!(a.contains(&1));
197+
assert!(a.contains(&2));
198+
assert!(a.contains(&3));
199+
assert!(a.contains(&4));
200+
201+
let mut b = BTreeSet::new();
202+
b.insert(5);
203+
b.insert(6);
204+
205+
a.extend(&b);
206+
207+
assert_eq!(a.len(), 6);
208+
assert!(a.contains(&1));
209+
assert!(a.contains(&2));
210+
assert!(a.contains(&3));
211+
assert!(a.contains(&4));
212+
assert!(a.contains(&5));
213+
assert!(a.contains(&6));
214+
}

branches/tmp/src/libcollectionstest/enum_set.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,3 +242,25 @@ fn test_overflow() {
242242
let mut set = EnumSet::new();
243243
set.insert(Bar::V64);
244244
}
245+
246+
#[test]
247+
fn test_extend_ref() {
248+
let mut a = EnumSet::new();
249+
a.insert(A);
250+
251+
a.extend(&[A, C]);
252+
253+
assert_eq!(a.len(), 2);
254+
assert!(a.contains(&A));
255+
assert!(a.contains(&C));
256+
257+
let mut b = EnumSet::new();
258+
b.insert(B);
259+
260+
a.extend(&b);
261+
262+
assert_eq!(a.len(), 3);
263+
assert!(a.contains(&A));
264+
assert!(a.contains(&B));
265+
assert!(a.contains(&C));
266+
}

branches/tmp/src/libcollectionstest/linked_list.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,25 @@ fn test_show() {
321321
assert_eq!(format!("{:?}", list), "[\"just\", \"one\", \"test\", \"more\"]");
322322
}
323323

324+
#[test]
325+
fn test_extend_ref() {
326+
let mut a = LinkedList::new();
327+
a.push_back(1);
328+
329+
a.extend(&[2, 3, 4]);
330+
331+
assert_eq!(a.len(), 4);
332+
assert_eq!(a, list_from(&[1, 2, 3, 4]));
333+
334+
let mut b = LinkedList::new();
335+
b.push_back(5);
336+
b.push_back(6);
337+
a.extend(&b);
338+
339+
assert_eq!(a.len(), 6);
340+
assert_eq!(a, list_from(&[1, 2, 3, 4, 5, 6]));
341+
}
342+
324343
#[bench]
325344
fn bench_collect_into(b: &mut test::Bencher) {
326345
let v = &[0; 64];

0 commit comments

Comments
 (0)