Skip to content

Commit d80b99b

Browse files
committed
---
yaml --- r: 190715 b: refs/heads/master c: 73afbef h: refs/heads/master i: 190713: 3509f1e 190711: 2cbb0d9 v: v3
1 parent 5507462 commit d80b99b

File tree

139 files changed

+9903
-16557
lines changed

Some content is hidden

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

139 files changed

+9903
-16557
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 285cb8e6d8e4802c3c36d6c00d9c3752c2cc13bd
2+
refs/heads/master: 73afbef3aaf42288a766186628207d46fbde1ee0
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: c64d671671aea2e44ee7fc6eb00ee75fc30ed7b9
55
refs/heads/try: 1c28ab65017d74fc13d003f7c7a73d1a48e5406f

trunk/configure

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,10 +461,7 @@ case $CFG_CPUTYPE in
461461
CFG_CPUTYPE=aarch64
462462
;;
463463

464-
# At some point, when ppc64[le] support happens, this will need to do
465-
# something clever. For now it's safe to assume that we're only ever
466-
# interested in building 32 bit.
467-
powerpc | ppc | ppc64)
464+
powerpc)
468465
CFG_CPUTYPE=powerpc
469466
;;
470467

trunk/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 \

trunk/mk/target.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ $$(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)) \
7675
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
7776
| $$(TLIB$(1)_T_$(2)_H_$(3))/
7877
@$$(call E, rustc: $$(@D)/lib$(4))

trunk/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))

trunk/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)]

trunk/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

trunk/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;

trunk/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;

trunk/src/libcollectionstest/bench.rs renamed to trunk/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;

trunk/src/libcollections/binary_heap.rs

Lines changed: 215 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,6 @@ use vec::{self, Vec};
163163
/// A priority queue implemented with a binary heap.
164164
///
165165
/// This will be a max-heap.
166-
///
167-
/// It is a logic error for an item to be modified in such a way that the
168-
/// item's ordering relative to any other item, as determined by the `Ord`
169-
/// trait, changes while it is in the heap. This is normally only possible
170-
/// through `Cell`, `RefCell`, global state, I/O, or unsafe code.
171166
#[derive(Clone)]
172167
#[stable(feature = "rust1", since = "1.0.0")]
173168
pub struct BinaryHeap<T> {
@@ -693,3 +688,218 @@ impl<T: Ord> Extend<T> for BinaryHeap<T> {
693688
}
694689
}
695690
}
691+
692+
#[cfg(test)]
693+
mod tests {
694+
use prelude::*;
695+
696+
use super::BinaryHeap;
697+
698+
#[test]
699+
fn test_iterator() {
700+
let data = vec![5, 9, 3];
701+
let iterout = [9, 5, 3];
702+
let heap = BinaryHeap::from_vec(data);
703+
let mut i = 0;
704+
for el in &heap {
705+
assert_eq!(*el, iterout[i]);
706+
i += 1;
707+
}
708+
}
709+
710+
#[test]
711+
fn test_iterator_reverse() {
712+
let data = vec![5, 9, 3];
713+
let iterout = vec![3, 5, 9];
714+
let pq = BinaryHeap::from_vec(data);
715+
716+
let v: Vec<_> = pq.iter().rev().cloned().collect();
717+
assert_eq!(v, iterout);
718+
}
719+
720+
#[test]
721+
fn test_move_iter() {
722+
let data = vec![5, 9, 3];
723+
let iterout = vec![9, 5, 3];
724+
let pq = BinaryHeap::from_vec(data);
725+
726+
let v: Vec<_> = pq.into_iter().collect();
727+
assert_eq!(v, iterout);
728+
}
729+
730+
#[test]
731+
fn test_move_iter_size_hint() {
732+
let data = vec![5, 9];
733+
let pq = BinaryHeap::from_vec(data);
734+
735+
let mut it = pq.into_iter();
736+
737+
assert_eq!(it.size_hint(), (2, Some(2)));
738+
assert_eq!(it.next(), Some(9));
739+
740+
assert_eq!(it.size_hint(), (1, Some(1)));
741+
assert_eq!(it.next(), Some(5));
742+
743+
assert_eq!(it.size_hint(), (0, Some(0)));
744+
assert_eq!(it.next(), None);
745+
}
746+
747+
#[test]
748+
fn test_move_iter_reverse() {
749+
let data = vec![5, 9, 3];
750+
let iterout = vec![3, 5, 9];
751+
let pq = BinaryHeap::from_vec(data);
752+
753+
let v: Vec<_> = pq.into_iter().rev().collect();
754+
assert_eq!(v, iterout);
755+
}
756+
757+
#[test]
758+
fn test_peek_and_pop() {
759+
let data = vec![2, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1];
760+
let mut sorted = data.clone();
761+
sorted.sort();
762+
let mut heap = BinaryHeap::from_vec(data);
763+
while !heap.is_empty() {
764+
assert_eq!(heap.peek().unwrap(), sorted.last().unwrap());
765+
assert_eq!(heap.pop().unwrap(), sorted.pop().unwrap());
766+
}
767+
}
768+
769+
#[test]
770+
fn test_push() {
771+
let mut heap = BinaryHeap::from_vec(vec![2, 4, 9]);
772+
assert_eq!(heap.len(), 3);
773+
assert!(*heap.peek().unwrap() == 9);
774+
heap.push(11);
775+
assert_eq!(heap.len(), 4);
776+
assert!(*heap.peek().unwrap() == 11);
777+
heap.push(5);
778+
assert_eq!(heap.len(), 5);
779+
assert!(*heap.peek().unwrap() == 11);
780+
heap.push(27);
781+
assert_eq!(heap.len(), 6);
782+
assert!(*heap.peek().unwrap() == 27);
783+
heap.push(3);
784+
assert_eq!(heap.len(), 7);
785+
assert!(*heap.peek().unwrap() == 27);
786+
heap.push(103);
787+
assert_eq!(heap.len(), 8);
788+
assert!(*heap.peek().unwrap() == 103);
789+
}
790+
791+
#[test]
792+
fn test_push_unique() {
793+
let mut heap = BinaryHeap::<Box<_>>::from_vec(vec![box 2, box 4, box 9]);
794+
assert_eq!(heap.len(), 3);
795+
assert!(*heap.peek().unwrap() == box 9);
796+
heap.push(box 11);
797+
assert_eq!(heap.len(), 4);
798+
assert!(*heap.peek().unwrap() == box 11);
799+
heap.push(box 5);
800+
assert_eq!(heap.len(), 5);
801+
assert!(*heap.peek().unwrap() == box 11);
802+
heap.push(box 27);
803+
assert_eq!(heap.len(), 6);
804+
assert!(*heap.peek().unwrap() == box 27);
805+
heap.push(box 3);
806+
assert_eq!(heap.len(), 7);
807+
assert!(*heap.peek().unwrap() == box 27);
808+
heap.push(box 103);
809+
assert_eq!(heap.len(), 8);
810+
assert!(*heap.peek().unwrap() == box 103);
811+
}
812+
813+
#[test]
814+
fn test_push_pop() {
815+
let mut heap = BinaryHeap::from_vec(vec![5, 5, 2, 1, 3]);
816+
assert_eq!(heap.len(), 5);
817+
assert_eq!(heap.push_pop(6), 6);
818+
assert_eq!(heap.len(), 5);
819+
assert_eq!(heap.push_pop(0), 5);
820+
assert_eq!(heap.len(), 5);
821+
assert_eq!(heap.push_pop(4), 5);
822+
assert_eq!(heap.len(), 5);
823+
assert_eq!(heap.push_pop(1), 4);
824+
assert_eq!(heap.len(), 5);
825+
}
826+
827+
#[test]
828+
fn test_replace() {
829+
let mut heap = BinaryHeap::from_vec(vec![5, 5, 2, 1, 3]);
830+
assert_eq!(heap.len(), 5);
831+
assert_eq!(heap.replace(6).unwrap(), 5);
832+
assert_eq!(heap.len(), 5);
833+
assert_eq!(heap.replace(0).unwrap(), 6);
834+
assert_eq!(heap.len(), 5);
835+
assert_eq!(heap.replace(4).unwrap(), 5);
836+
assert_eq!(heap.len(), 5);
837+
assert_eq!(heap.replace(1).unwrap(), 4);
838+
assert_eq!(heap.len(), 5);
839+
}
840+
841+
fn check_to_vec(mut data: Vec<i32>) {
842+
let heap = BinaryHeap::from_vec(data.clone());
843+
let mut v = heap.clone().into_vec();
844+
v.sort();
845+
data.sort();
846+
847+
assert_eq!(v, data);
848+
assert_eq!(heap.into_sorted_vec(), data);
849+
}
850+
851+
#[test]
852+
fn test_to_vec() {
853+
check_to_vec(vec![]);
854+
check_to_vec(vec![5]);
855+
check_to_vec(vec![3, 2]);
856+
check_to_vec(vec![2, 3]);
857+
check_to_vec(vec![5, 1, 2]);
858+
check_to_vec(vec![1, 100, 2, 3]);
859+
check_to_vec(vec![1, 3, 5, 7, 9, 2, 4, 6, 8, 0]);
860+
check_to_vec(vec![2, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1]);
861+
check_to_vec(vec![9, 11, 9, 9, 9, 9, 11, 2, 3, 4, 11, 9, 0, 0, 0, 0]);
862+
check_to_vec(vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
863+
check_to_vec(vec![10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]);
864+
check_to_vec(vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 1, 2]);
865+
check_to_vec(vec![5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1]);
866+
}
867+
868+
#[test]
869+
fn test_empty_pop() {
870+
let mut heap = BinaryHeap::<i32>::new();
871+
assert!(heap.pop().is_none());
872+
}
873+
874+
#[test]
875+
fn test_empty_peek() {
876+
let empty = BinaryHeap::<i32>::new();
877+
assert!(empty.peek().is_none());
878+
}
879+
880+
#[test]
881+
fn test_empty_replace() {
882+
let mut heap = BinaryHeap::new();
883+
assert!(heap.replace(5).is_none());
884+
}
885+
886+
#[test]
887+
fn test_from_iter() {
888+
let xs = vec![9, 8, 7, 6, 5, 4, 3, 2, 1];
889+
890+
let mut q: BinaryHeap<_> = xs.iter().rev().cloned().collect();
891+
892+
for &x in &xs {
893+
assert_eq!(q.pop().unwrap(), x);
894+
}
895+
}
896+
897+
#[test]
898+
fn test_drain() {
899+
let mut q: BinaryHeap<_> = [9, 8, 7, 6, 5, 4, 3, 2, 1].iter().cloned().collect();
900+
901+
assert_eq!(q.drain().take(5).count(), 5);
902+
903+
assert!(q.is_empty());
904+
}
905+
}

0 commit comments

Comments
 (0)