Skip to content

Commit 0e1696f

Browse files
committed
---
yaml --- r: 191343 b: refs/heads/try c: b07a1df h: refs/heads/master i: 191341: 5064bd3 191339: 876b6c3 191335: c1916a4 191327: fb3ef19 v: v3
1 parent 0914b28 commit 0e1696f

Some content is hidden

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

114 files changed

+9563
-16108
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 809a554fca2d0ebc2ba50077016fe282a4064752
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: c64d671671aea2e44ee7fc6eb00ee75fc30ed7b9
5-
refs/heads/try: e46610966f798a083350724461648c6ffdd151f4
5+
refs/heads/try: b07a1dfcd12348541e81c809b59af9ff56fc1103
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/mk/dist.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ PKG_FILES := \
5353
driver \
5454
etc \
5555
$(foreach crate,$(CRATES),lib$(crate)) \
56-
libcollectionstest \
5756
libcoretest \
5857
libbacktrace \
5958
rt \

branches/try/mk/target.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): CFG_COMPILER_HOST_TRIPLE = $(2)
7272
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
7373
$$(CRATEFILE_$(4)) \
7474
$$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4)) \
75+
$$(LLVM_CONFIG_$(2)) \
7576
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
7677
| $$(TLIB$(1)_T_$(2)_H_$(3))/
7778
@$$(call E, rustc: $$(@D)/lib$(4))

branches/try/mk/tests.mk

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@
1919
DEPS_coretest :=
2020
$(eval $(call RUST_CRATE,coretest))
2121

22-
DEPS_collectionstest :=
23-
$(eval $(call RUST_CRATE,collectionstest))
24-
25-
TEST_TARGET_CRATES = $(filter-out core unicode,$(TARGET_CRATES)) collectionstest coretest
22+
TEST_TARGET_CRATES = $(filter-out core unicode,$(TARGET_CRATES)) coretest
2623
TEST_DOC_CRATES = $(DOC_CRATES)
2724
TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_resolve rustc_trans rustc_lint,\
2825
$(HOST_CRATES))

branches/try/src/compiletest/compiletest.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#![feature(std_misc)]
2121
#![feature(test)]
2222
#![feature(core)]
23+
#![feature(net)]
2324
#![feature(path_ext)]
2425

2526
#![deny(warnings)]

branches/try/src/liballoc/heap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#[cfg(stage0)]
1211
#[cfg(not(test))]
1312
use core::ptr::PtrExt;
1413

@@ -388,6 +387,7 @@ mod imp {
388387
mod test {
389388
extern crate test;
390389
use self::test::Bencher;
390+
use core::ptr::PtrExt;
391391
use boxed::Box;
392392
use heap;
393393

branches/try/src/liballoc/rc.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,7 @@ use core::nonzero::NonZero;
159159
use core::ops::{Deref, Drop};
160160
use core::option::Option;
161161
use core::option::Option::{Some, None};
162-
#[cfg(stage0)]
163162
use core::ptr::{self, PtrExt};
164-
#[cfg(not(stage0))]
165-
use core::ptr;
166163
use core::result::Result;
167164
use core::result::Result::{Ok, Err};
168165
use core::intrinsics::assume;

branches/try/src/libarena/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ use std::intrinsics::{TyDesc, get_tydesc};
4646
use std::intrinsics;
4747
use std::marker;
4848
use std::mem;
49-
#[cfg(stage0)]
5049
use std::num::{Int, UnsignedInt};
5150
use std::ptr;
5251
use std::rc::Rc;

branches/try/src/libcollectionstest/bench.rs renamed to branches/try/src/libcollections/bench.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ macro_rules! map_find_rand_bench {
6666
($name: ident, $n: expr, $map: ident) => (
6767
#[bench]
6868
pub fn $name(b: &mut ::test::Bencher) {
69+
use std::rand;
6970
use std::iter::IteratorExt;
7071
use std::rand::Rng;
71-
use std::rand;
72-
use std::vec::Vec;
7372
use test::black_box;
73+
use vec::Vec;
7474

7575
let mut map = $map::new();
7676
let n: usize = $n;

branches/try/src/libcollections/binary_heap.rs

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,3 +693,218 @@ impl<T: Ord> Extend<T> for BinaryHeap<T> {
693693
}
694694
}
695695
}
696+
697+
#[cfg(test)]
698+
mod tests {
699+
use prelude::*;
700+
701+
use super::BinaryHeap;
702+
703+
#[test]
704+
fn test_iterator() {
705+
let data = vec![5, 9, 3];
706+
let iterout = [9, 5, 3];
707+
let heap = BinaryHeap::from_vec(data);
708+
let mut i = 0;
709+
for el in &heap {
710+
assert_eq!(*el, iterout[i]);
711+
i += 1;
712+
}
713+
}
714+
715+
#[test]
716+
fn test_iterator_reverse() {
717+
let data = vec![5, 9, 3];
718+
let iterout = vec![3, 5, 9];
719+
let pq = BinaryHeap::from_vec(data);
720+
721+
let v: Vec<_> = pq.iter().rev().cloned().collect();
722+
assert_eq!(v, iterout);
723+
}
724+
725+
#[test]
726+
fn test_move_iter() {
727+
let data = vec![5, 9, 3];
728+
let iterout = vec![9, 5, 3];
729+
let pq = BinaryHeap::from_vec(data);
730+
731+
let v: Vec<_> = pq.into_iter().collect();
732+
assert_eq!(v, iterout);
733+
}
734+
735+
#[test]
736+
fn test_move_iter_size_hint() {
737+
let data = vec![5, 9];
738+
let pq = BinaryHeap::from_vec(data);
739+
740+
let mut it = pq.into_iter();
741+
742+
assert_eq!(it.size_hint(), (2, Some(2)));
743+
assert_eq!(it.next(), Some(9));
744+
745+
assert_eq!(it.size_hint(), (1, Some(1)));
746+
assert_eq!(it.next(), Some(5));
747+
748+
assert_eq!(it.size_hint(), (0, Some(0)));
749+
assert_eq!(it.next(), None);
750+
}
751+
752+
#[test]
753+
fn test_move_iter_reverse() {
754+
let data = vec![5, 9, 3];
755+
let iterout = vec![3, 5, 9];
756+
let pq = BinaryHeap::from_vec(data);
757+
758+
let v: Vec<_> = pq.into_iter().rev().collect();
759+
assert_eq!(v, iterout);
760+
}
761+
762+
#[test]
763+
fn test_peek_and_pop() {
764+
let data = vec![2, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1];
765+
let mut sorted = data.clone();
766+
sorted.sort();
767+
let mut heap = BinaryHeap::from_vec(data);
768+
while !heap.is_empty() {
769+
assert_eq!(heap.peek().unwrap(), sorted.last().unwrap());
770+
assert_eq!(heap.pop().unwrap(), sorted.pop().unwrap());
771+
}
772+
}
773+
774+
#[test]
775+
fn test_push() {
776+
let mut heap = BinaryHeap::from_vec(vec![2, 4, 9]);
777+
assert_eq!(heap.len(), 3);
778+
assert!(*heap.peek().unwrap() == 9);
779+
heap.push(11);
780+
assert_eq!(heap.len(), 4);
781+
assert!(*heap.peek().unwrap() == 11);
782+
heap.push(5);
783+
assert_eq!(heap.len(), 5);
784+
assert!(*heap.peek().unwrap() == 11);
785+
heap.push(27);
786+
assert_eq!(heap.len(), 6);
787+
assert!(*heap.peek().unwrap() == 27);
788+
heap.push(3);
789+
assert_eq!(heap.len(), 7);
790+
assert!(*heap.peek().unwrap() == 27);
791+
heap.push(103);
792+
assert_eq!(heap.len(), 8);
793+
assert!(*heap.peek().unwrap() == 103);
794+
}
795+
796+
#[test]
797+
fn test_push_unique() {
798+
let mut heap = BinaryHeap::<Box<_>>::from_vec(vec![box 2, box 4, box 9]);
799+
assert_eq!(heap.len(), 3);
800+
assert!(*heap.peek().unwrap() == box 9);
801+
heap.push(box 11);
802+
assert_eq!(heap.len(), 4);
803+
assert!(*heap.peek().unwrap() == box 11);
804+
heap.push(box 5);
805+
assert_eq!(heap.len(), 5);
806+
assert!(*heap.peek().unwrap() == box 11);
807+
heap.push(box 27);
808+
assert_eq!(heap.len(), 6);
809+
assert!(*heap.peek().unwrap() == box 27);
810+
heap.push(box 3);
811+
assert_eq!(heap.len(), 7);
812+
assert!(*heap.peek().unwrap() == box 27);
813+
heap.push(box 103);
814+
assert_eq!(heap.len(), 8);
815+
assert!(*heap.peek().unwrap() == box 103);
816+
}
817+
818+
#[test]
819+
fn test_push_pop() {
820+
let mut heap = BinaryHeap::from_vec(vec![5, 5, 2, 1, 3]);
821+
assert_eq!(heap.len(), 5);
822+
assert_eq!(heap.push_pop(6), 6);
823+
assert_eq!(heap.len(), 5);
824+
assert_eq!(heap.push_pop(0), 5);
825+
assert_eq!(heap.len(), 5);
826+
assert_eq!(heap.push_pop(4), 5);
827+
assert_eq!(heap.len(), 5);
828+
assert_eq!(heap.push_pop(1), 4);
829+
assert_eq!(heap.len(), 5);
830+
}
831+
832+
#[test]
833+
fn test_replace() {
834+
let mut heap = BinaryHeap::from_vec(vec![5, 5, 2, 1, 3]);
835+
assert_eq!(heap.len(), 5);
836+
assert_eq!(heap.replace(6).unwrap(), 5);
837+
assert_eq!(heap.len(), 5);
838+
assert_eq!(heap.replace(0).unwrap(), 6);
839+
assert_eq!(heap.len(), 5);
840+
assert_eq!(heap.replace(4).unwrap(), 5);
841+
assert_eq!(heap.len(), 5);
842+
assert_eq!(heap.replace(1).unwrap(), 4);
843+
assert_eq!(heap.len(), 5);
844+
}
845+
846+
fn check_to_vec(mut data: Vec<i32>) {
847+
let heap = BinaryHeap::from_vec(data.clone());
848+
let mut v = heap.clone().into_vec();
849+
v.sort();
850+
data.sort();
851+
852+
assert_eq!(v, data);
853+
assert_eq!(heap.into_sorted_vec(), data);
854+
}
855+
856+
#[test]
857+
fn test_to_vec() {
858+
check_to_vec(vec![]);
859+
check_to_vec(vec![5]);
860+
check_to_vec(vec![3, 2]);
861+
check_to_vec(vec![2, 3]);
862+
check_to_vec(vec![5, 1, 2]);
863+
check_to_vec(vec![1, 100, 2, 3]);
864+
check_to_vec(vec![1, 3, 5, 7, 9, 2, 4, 6, 8, 0]);
865+
check_to_vec(vec![2, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1]);
866+
check_to_vec(vec![9, 11, 9, 9, 9, 9, 11, 2, 3, 4, 11, 9, 0, 0, 0, 0]);
867+
check_to_vec(vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
868+
check_to_vec(vec![10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]);
869+
check_to_vec(vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 1, 2]);
870+
check_to_vec(vec![5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1]);
871+
}
872+
873+
#[test]
874+
fn test_empty_pop() {
875+
let mut heap = BinaryHeap::<i32>::new();
876+
assert!(heap.pop().is_none());
877+
}
878+
879+
#[test]
880+
fn test_empty_peek() {
881+
let empty = BinaryHeap::<i32>::new();
882+
assert!(empty.peek().is_none());
883+
}
884+
885+
#[test]
886+
fn test_empty_replace() {
887+
let mut heap = BinaryHeap::new();
888+
assert!(heap.replace(5).is_none());
889+
}
890+
891+
#[test]
892+
fn test_from_iter() {
893+
let xs = vec![9, 8, 7, 6, 5, 4, 3, 2, 1];
894+
895+
let mut q: BinaryHeap<_> = xs.iter().rev().cloned().collect();
896+
897+
for &x in &xs {
898+
assert_eq!(q.pop().unwrap(), x);
899+
}
900+
}
901+
902+
#[test]
903+
fn test_drain() {
904+
let mut q: BinaryHeap<_> = [9, 8, 7, 6, 5, 4, 3, 2, 1].iter().cloned().collect();
905+
906+
assert_eq!(q.drain().take(5).count(), 5);
907+
908+
assert!(q.is_empty());
909+
}
910+
}

0 commit comments

Comments
 (0)