Skip to content

Commit e04f09f

Browse files
committed
---
yaml --- r: 149548 b: refs/heads/try2 c: 3e531ed h: refs/heads/master v: v3
1 parent c129bf4 commit e04f09f

File tree

110 files changed

+812
-976
lines changed

Some content is hidden

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

110 files changed

+812
-976
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 27cc309a7f1cc89c35388eda48041d9880b4737c
8+
refs/heads/try2: 3e531ed0edd44c5af714fdeaa0cddb9d5c8154a2
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/.travis.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,10 @@ before_script:
3939
# manually disables bringing in these two libraries, but the stock LLVM was
4040
# apparently built with these options. We provide these options when building so
4141
# the `rustc` binary can successfully link.
42-
#
43-
# As a result of https://github.com/travis-ci/travis-ci/issues/1066, we run
44-
# everything in one large command instead of multiple commands.
45-
script: |
46-
make tidy &&
47-
RUSTFLAGS="-C link-args='-lffi -lncurses'" make -j4 rustc-stage1 &&
48-
make check-stage1-std check-stage1-rpass check-stage1-cfail check-stage1-rfail
42+
script:
43+
- make tidy
44+
- RUSTFLAGS="-C link-args='-lffi -lncurses'" make -j4 rustc-stage1
45+
- make check-stage1-std check-stage1-rpass check-stage1-cfail check-stage1-rfail
4946

5047
env:
5148
- NO_BENCH=1

branches/try2/mk/crates.mk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,18 @@ DEPS_rustc := syntax native:rustllvm flate arena serialize sync getopts \
6565
collections time extra
6666
DEPS_rustdoc := rustc native:sundown serialize sync getopts collections \
6767
test time
68-
DEPS_flate := std extra native:miniz
68+
DEPS_flate := std native:miniz
6969
DEPS_arena := std collections
7070
DEPS_glob := std
71-
DEPS_serialize := std collections
71+
DEPS_serialize := std
7272
DEPS_term := std collections
7373
DEPS_semver := std
7474
DEPS_uuid := std serialize
7575
DEPS_sync := std
7676
DEPS_getopts := std
77-
DEPS_collections := std
77+
DEPS_collections := std serialize
7878
DEPS_fourcc := syntax std
79-
DEPS_num := std
79+
DEPS_num := std extra
8080
DEPS_test := std extra collections getopts serialize term
8181
DEPS_time := std serialize
8282

branches/try2/mk/tests.mk

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,7 @@ endif
171171
# Main test targets
172172
######################################################################
173173

174-
check: cleantmptestlogs cleantestlibs tidy check-notidy
175-
176-
check-notidy: cleantmptestlogs cleantestlibs all check-stage2
174+
check: cleantestlibs cleantmptestlogs tidy all check-stage2
177175
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
178176

179177
check-lite: cleantestlibs cleantmptestlogs \

branches/try2/src/README.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,6 @@ Source layout:
1010
| `libgreen/` | The M:N runtime library |
1111
| `libnative/` | The 1:1 runtime library |
1212
| `libsyntax/` | The Rust parser and pretty-printer |
13-
| `libcollections/` | A collection of useful data structures and containers |
14-
| `libnum/` | Extended number support library (complex, rational, etc) |
15-
| `libtest/` | Rust's test-runner code |
16-
| ------------------- | --------------------------------------------------------- |
17-
| `libarena/` | The arena (a fast but limited) memory allocator |
18-
| `libflate/` | Simple compression library |
19-
| `libfourcc/` | Data format identifier library |
20-
| `libgetopts/` | Get command-line-options library |
21-
| `libglob/` | Unix glob patterns library |
22-
| `libsemver/` | Rust's semantic versioning library |
23-
| `libserialize/` | Encode-Decode types library |
24-
| `libsync/` | Concurrency mechanisms and primitives |
25-
| `libterm/` | ANSI color library for terminals |
26-
| `libtime/` | Time operations library |
27-
| `libuuid/` | UUID's handling code |
2813
| ------------------- | --------------------------------------------------------- |
2914
| `rt/` | The runtime system |
3015
| `rt/rust_*.c` | - Some of the runtime services |
@@ -46,13 +31,8 @@ Source layout:
4631
| ------------------- | --------------------------------------------------------- |
4732
| `librustdoc/` | The Rust API documentation tool |
4833
| `libuv/` | The libuv submodule |
49-
| `librustuv/` | Rust libuv support code |
5034
| ------------------- | --------------------------------------------------------- |
5135
| `llvm/` | The LLVM submodule |
5236
| `rustllvm/` | LLVM support code |
5337
| ------------------- | --------------------------------------------------------- |
5438
| `etc/` | Scripts, editors support, misc |
55-
56-
57-
NOTE: This list (especially the second part of the table which contains modules and libraries)
58-
is highly volatile and subject to change.

branches/try2/src/doc/rust.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -875,16 +875,16 @@ An example of what will and will not work for `use` items:
875875

876876
~~~~
877877
# #[allow(unused_imports)];
878-
use foo::native::start; // good: foo is at the root of the crate
878+
use foo::extra::json; // good: foo is at the root of the crate
879879
use foo::baz::foobaz; // good: foo is at the root of the crate
880880
881881
mod foo {
882-
extern crate native;
882+
extern crate extra;
883883
884-
use foo::native::start; // good: foo is at crate root
885-
// use native::start; // bad: native is not at the crate root
886-
use self::baz::foobaz; // good: self refers to module 'foo'
887-
use foo::bar::foobar; // good: foo is at crate root
884+
use foo::extra::json; // good: foo is at crate root
885+
// use extra::json::*; // bad: extra is not at the crate root
886+
use self::baz::foobaz; // good: self refers to module 'foo'
887+
use foo::bar::foobar; // good: foo is at crate root
888888
889889
pub mod bar {
890890
pub fn foobar() { }

branches/try2/src/doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1420,8 +1420,8 @@ bad, but often copies are expensive. So we’d like to define a function
14201420
that takes the points by pointer. We can use references to do this:
14211421
14221422
~~~
1423-
use std::num::sqrt;
14241423
# struct Point { x: f64, y: f64 }
1424+
# fn sqrt(f: f64) -> f64 { 0.0 }
14251425
fn compute_distance(p1: &Point, p2: &Point) -> f64 {
14261426
let x_d = p1.x - p2.x;
14271427
let y_d = p1.y - p2.y;

branches/try2/src/libarena/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,13 @@ unsafe fn destroy_chunk(chunk: &Chunk) {
167167
// is necessary in order to properly do cleanup if a failure occurs
168168
// during an initializer.
169169
#[inline]
170-
fn bitpack_tydesc_ptr(p: *TyDesc, is_done: bool) -> uint {
171-
p as uint | (is_done as uint)
170+
unsafe fn bitpack_tydesc_ptr(p: *TyDesc, is_done: bool) -> uint {
171+
let p_bits: uint = transmute(p);
172+
p_bits | (is_done as uint)
172173
}
173174
#[inline]
174-
fn un_bitpack_tydesc_ptr(p: uint) -> (*TyDesc, bool) {
175-
((p & !1) as *TyDesc, p & 1 == 1)
175+
unsafe fn un_bitpack_tydesc_ptr(p: uint) -> (*TyDesc, bool) {
176+
(transmute(p & !1), p & 1 == 1)
176177
}
177178

178179
impl Arena {

branches/try2/src/libcollections/dlist.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ use std::iter;
3030

3131
use deque::Deque;
3232

33+
use serialize::{Encodable, Decodable, Encoder, Decoder};
34+
3335
/// A doubly-linked list.
3436
pub struct DList<T> {
3537
priv length: uint,
@@ -628,6 +630,31 @@ impl<A: Clone> Clone for DList<A> {
628630
}
629631
}
630632

633+
impl<
634+
S: Encoder,
635+
T: Encodable<S>
636+
> Encodable<S> for DList<T> {
637+
fn encode(&self, s: &mut S) {
638+
s.emit_seq(self.len(), |s| {
639+
for (i, e) in self.iter().enumerate() {
640+
s.emit_seq_elt(i, |s| e.encode(s));
641+
}
642+
})
643+
}
644+
}
645+
646+
impl<D:Decoder,T:Decodable<D>> Decodable<D> for DList<T> {
647+
fn decode(d: &mut D) -> DList<T> {
648+
let mut list = DList::new();
649+
d.read_seq(|d, len| {
650+
for i in range(0u, len) {
651+
list.push_back(d.read_seq_elt(i, |d| Decodable::decode(d)));
652+
}
653+
});
654+
list
655+
}
656+
}
657+
631658
#[cfg(test)]
632659
mod tests {
633660
extern crate test;

branches/try2/src/libcollections/enum_set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
1616
use std::num::Bitwise;
1717

18-
#[deriving(Clone, Eq, Hash, Show)]
18+
#[deriving(Clone, Eq, Hash, Show, Encodable, Decodable)]
1919
/// A specialized Set implementation to use enum types.
2020
pub struct EnumSet<E> {
2121
// We must maintain the invariant that no bits are set

branches/try2/src/libcollections/hashmap.rs

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
//! ```
5454
5555
use std::cmp::max;
56-
use std::default::Default;
5756
use std::fmt;
5857
use std::hash::{Hash, Hasher, sip};
5958
use std::iter::{FilterMap, Chain, Repeat, Zip};
@@ -66,6 +65,8 @@ use std::vec::{Items, MutItems};
6665
use std::vec_ng::Vec;
6766
use std::vec_ng;
6867

68+
use serialize::{Encodable, Decodable, Encoder, Decoder};
69+
6970
static INITIAL_CAPACITY: uint = 32u; // 2^5
7071

7172
struct Bucket<K,V> {
@@ -911,6 +912,71 @@ pub type SetAlgebraItems<'a, T> =
911912
FilterMap<'static,(&'a HashSet<T>, &'a T), &'a T,
912913
Zip<Repeat<&'a HashSet<T>>,SetItems<'a,T>>>;
913914

915+
impl<
916+
E: Encoder,
917+
K: Encodable<E> + Hash + Eq,
918+
V: Encodable<E>
919+
> Encodable<E> for HashMap<K, V> {
920+
fn encode(&self, e: &mut E) {
921+
e.emit_map(self.len(), |e| {
922+
let mut i = 0;
923+
for (key, val) in self.iter() {
924+
e.emit_map_elt_key(i, |e| key.encode(e));
925+
e.emit_map_elt_val(i, |e| val.encode(e));
926+
i += 1;
927+
}
928+
})
929+
}
930+
}
931+
932+
impl<
933+
D: Decoder,
934+
K: Decodable<D> + Hash + Eq,
935+
V: Decodable<D>
936+
> Decodable<D> for HashMap<K, V> {
937+
fn decode(d: &mut D) -> HashMap<K, V> {
938+
d.read_map(|d, len| {
939+
let mut map = HashMap::with_capacity(len);
940+
for i in range(0u, len) {
941+
let key = d.read_map_elt_key(i, |d| Decodable::decode(d));
942+
let val = d.read_map_elt_val(i, |d| Decodable::decode(d));
943+
map.insert(key, val);
944+
}
945+
map
946+
})
947+
}
948+
}
949+
950+
impl<
951+
S: Encoder,
952+
T: Encodable<S> + Hash + Eq
953+
> Encodable<S> for HashSet<T> {
954+
fn encode(&self, s: &mut S) {
955+
s.emit_seq(self.len(), |s| {
956+
let mut i = 0;
957+
for e in self.iter() {
958+
s.emit_seq_elt(i, |s| e.encode(s));
959+
i += 1;
960+
}
961+
})
962+
}
963+
}
964+
965+
impl<
966+
D: Decoder,
967+
T: Decodable<D> + Hash + Eq
968+
> Decodable<D> for HashSet<T> {
969+
fn decode(d: &mut D) -> HashSet<T> {
970+
d.read_seq(|d, len| {
971+
let mut set = HashSet::with_capacity(len);
972+
for i in range(0u, len) {
973+
set.insert(d.read_seq_elt(i, |d| Decodable::decode(d)));
974+
}
975+
set
976+
})
977+
}
978+
}
979+
914980
#[cfg(test)]
915981
mod test_map {
916982
use super::{HashMap, HashSet};

branches/try2/src/libcollections/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#[feature(macro_rules, managed_boxes)];
2121

22+
extern crate serialize;
2223
#[cfg(test)] extern crate test;
2324

2425
pub use bitv::Bitv;

branches/try2/src/libcollections/ringbuf.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ use std::iter::{Rev, RandomAccessIterator};
1919

2020
use deque::Deque;
2121

22+
use serialize::{Encodable, Decodable, Encoder, Decoder};
23+
2224
static INITIAL_CAPACITY: uint = 8u; // 2^3
2325
static MINIMUM_CAPACITY: uint = 2u;
2426

@@ -402,6 +404,31 @@ impl<A> Extendable<A> for RingBuf<A> {
402404
}
403405
}
404406

407+
impl<
408+
S: Encoder,
409+
T: Encodable<S>
410+
> Encodable<S> for RingBuf<T> {
411+
fn encode(&self, s: &mut S) {
412+
s.emit_seq(self.len(), |s| {
413+
for (i, e) in self.iter().enumerate() {
414+
s.emit_seq_elt(i, |s| e.encode(s));
415+
}
416+
})
417+
}
418+
}
419+
420+
impl<D:Decoder,T:Decodable<D>> Decodable<D> for RingBuf<T> {
421+
fn decode(d: &mut D) -> RingBuf<T> {
422+
let mut deque = RingBuf::new();
423+
d.read_seq(|d, len| {
424+
for i in range(0u, len) {
425+
deque.push_back(d.read_seq_elt(i, |d| Decodable::decode(d)));
426+
}
427+
});
428+
deque
429+
}
430+
}
431+
405432
#[cfg(test)]
406433
mod tests {
407434
extern crate test;

0 commit comments

Comments
 (0)