Skip to content

Commit 8dfa97e

Browse files
committed
---
yaml --- r: 193871 b: refs/heads/beta c: 4b75dc4 h: refs/heads/master i: 193869: 684dece 193867: 2b30eea 193863: e90e52e 193855: ba352ca v: v3
1 parent 613cf0f commit 8dfa97e

File tree

167 files changed

+10908
-17869
lines changed

Some content is hidden

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

167 files changed

+10908
-17869
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
3232
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34-
refs/heads/beta: e8889c94046c89e8d80e9218b000ab36b1271f47
34+
refs/heads/beta: 4b75dc464868e6800ee73911b50e440de45f783d
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3737
refs/heads/tmp: de8a23bbc3a7b9cbd7574b5b91a34af59bf030e6

branches/beta/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/beta/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))

branches/beta/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/beta/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/beta/src/doc/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ right at home if you've used tools like [Bundler](http://bundler.io/),
140140
[npm](https://www.npmjs.org/), or [pip](https://pip.pypa.io/en/latest/).
141141
There's no `Makefile`s or endless `autotools` output here. (Rust's tooling does
142142
[play nice with external libraries written in those
143-
tools](http://doc.crates.io/build-script.html), if you need to.)
143+
tools](http://crates.io/native-build.html), if you need to.)
144144

145145
Enough about tools, let's talk code!
146146

branches/beta/src/doc/reference.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,18 +1961,16 @@ module through the rules above. It essentially allows public access into the
19611961
re-exported item. For example, this program is valid:
19621962

19631963
```
1964-
pub use self::implementation::api;
1964+
pub use self::implementation as api;
19651965
19661966
mod implementation {
1967-
pub mod api {
1968-
pub fn f() {}
1969-
}
1967+
pub fn f() {}
19701968
}
19711969
19721970
# fn main() {}
19731971
```
19741972

1975-
This means that any external crate referencing `implementation::api::f` would
1973+
This means that any external crate referencing `implementation::f` would
19761974
receive a privacy violation, while the path `api::f` would be allowed.
19771975

19781976
When re-exporting a private item, it can be thought of as allowing the "privacy

branches/beta/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/beta/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/beta/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/beta/src/libcollectionstest/bench.rs renamed to branches/beta/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/beta/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)