Skip to content

Commit 808227d

Browse files
committed
---
yaml --- r: 152410 b: refs/heads/try2 c: 5bf5cc6 h: refs/heads/master v: v3
1 parent da1e080 commit 808227d

File tree

186 files changed

+2277
-1255
lines changed

Some content is hidden

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

186 files changed

+2277
-1255
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: 0eb858b4c913b531ae5ac915abbbe579b49b9df4
8+
refs/heads/try2: 5bf5cc605fd2732fa35b284a4401bfaa899dcae2
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/crates.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,16 @@ DEPS_uuid := std serialize
8383
DEPS_sync := std alloc
8484
DEPS_getopts := std
8585
DEPS_collections := core alloc
86-
DEPS_fourcc := syntax std
87-
DEPS_hexfloat := syntax std
86+
DEPS_fourcc := rustc syntax std
87+
DEPS_hexfloat := rustc syntax std
8888
DEPS_num := std
8989
DEPS_test := std getopts serialize term time regex native:rust_test_helpers
9090
DEPS_time := std serialize sync
9191
DEPS_rand := core
9292
DEPS_url := std
9393
DEPS_log := std sync
9494
DEPS_regex := std
95-
DEPS_regex_macros = syntax std regex
95+
DEPS_regex_macros = rustc syntax std regex
9696
DEPS_fmt_macros = std
9797

9898
TOOL_DEPS_compiletest := test green rustuv getopts

branches/try2/src/compiletest/compiletest.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,17 @@
1818

1919
extern crate test;
2020
extern crate getopts;
21-
#[phase(link, syntax)]
22-
extern crate log;
2321
extern crate green;
2422
extern crate rustuv;
2523

24+
#[cfg(stage0)]
25+
#[phase(syntax, link)]
26+
extern crate log;
27+
28+
#[cfg(not(stage0))]
29+
#[phase(plugin, link)]
30+
extern crate log;
31+
2632
extern crate regex;
2733

2834
use std::os;

branches/try2/src/doc/rust.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,9 +1819,8 @@ type int8_t = i8;
18191819

18201820
### Function-only attributes
18211821

1822-
- `macro_registrar` - when using loadable syntax extensions, mark this
1823-
function as the registration point for the current crate's syntax
1824-
extensions.
1822+
- `plugin_registrar` - mark this function as the registration point for
1823+
compiler plugins, such as loadable syntax extensions.
18251824
- `main` - indicates that this function should be passed to the entry point,
18261825
rather than the function in the crate root named `main`.
18271826
- `start` - indicates that this function should be used as the entry point,
@@ -4098,7 +4097,7 @@ that demonstrates all four of them:
40984097

40994098
~~~~
41004099
#![feature(phase)]
4101-
#[phase(syntax, link)] extern crate log;
4100+
#[phase(plugin, link)] extern crate log;
41024101
41034102
fn main() {
41044103
error!("This is an error log")

branches/try2/src/etc/licenseck.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@
4242
"libstd/sync/spsc_queue.rs", # BSD
4343
"libstd/sync/mpmc_bounded_queue.rs", # BSD
4444
"libsync/mpsc_intrusive.rs", # BSD
45+
"test/bench/shootout-fannkuch-redux.rs", # BSD
4546
"test/bench/shootout-meteor.rs", # BSD
47+
"test/bench/shootout-regex-dna.rs", # BSD
4648
]
4749

4850
def check_license(name, contents):

branches/try2/src/liballoc/lib.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,14 @@
7070
#![no_std]
7171
#![feature(phase)]
7272

73+
#[cfg(stage0)]
7374
#[phase(syntax, link)]
7475
extern crate core;
76+
77+
#[cfg(not(stage0))]
78+
#[phase(plugin, link)]
79+
extern crate core;
80+
7581
extern crate libc;
7682

7783

@@ -80,8 +86,10 @@ extern crate libc;
8086
#[cfg(test)] extern crate debug;
8187
#[cfg(test)] extern crate sync;
8288
#[cfg(test)] extern crate native;
83-
#[cfg(test)] #[phase(syntax, link)] extern crate std;
84-
#[cfg(test)] #[phase(syntax, link)] extern crate log;
89+
#[cfg(test, stage0)] #[phase(syntax, link)] extern crate std;
90+
#[cfg(test, stage0)] #[phase(syntax, link)] extern crate log;
91+
#[cfg(test, not(stage0))] #[phase(plugin, link)] extern crate std;
92+
#[cfg(test, not(stage0))] #[phase(plugin, link)] extern crate log;
8593

8694
// Heaps provided for low-level allocation strategies
8795

branches/try2/src/libcollections/bitv.rs

Lines changed: 51 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ use core::iter::{Enumerate, Repeat, Map, Zip};
1818
use core::ops;
1919
use core::slice;
2020
use core::uint;
21+
use std::hash;
2122

23+
use {Collection, Mutable, Set, MutableSet};
2224
use vec::Vec;
2325

2426
#[deriving(Clone)]
@@ -34,12 +36,12 @@ fn small_mask(nbits: uint) -> uint {
3436
}
3537

3638
impl SmallBitv {
37-
pub fn new(bits: uint) -> SmallBitv {
39+
fn new(bits: uint) -> SmallBitv {
3840
SmallBitv {bits: bits}
3941
}
4042

4143
#[inline]
42-
pub fn bits_op(&mut self,
44+
fn bits_op(&mut self,
4345
right_bits: uint,
4446
nbits: uint,
4547
f: |uint, uint| -> uint)
@@ -52,32 +54,32 @@ impl SmallBitv {
5254
}
5355

5456
#[inline]
55-
pub fn union(&mut self, s: &SmallBitv, nbits: uint) -> bool {
57+
fn union(&mut self, s: &SmallBitv, nbits: uint) -> bool {
5658
self.bits_op(s.bits, nbits, |u1, u2| u1 | u2)
5759
}
5860

5961
#[inline]
60-
pub fn intersect(&mut self, s: &SmallBitv, nbits: uint) -> bool {
62+
fn intersect(&mut self, s: &SmallBitv, nbits: uint) -> bool {
6163
self.bits_op(s.bits, nbits, |u1, u2| u1 & u2)
6264
}
6365

6466
#[inline]
65-
pub fn become(&mut self, s: &SmallBitv, nbits: uint) -> bool {
67+
fn become(&mut self, s: &SmallBitv, nbits: uint) -> bool {
6668
self.bits_op(s.bits, nbits, |_u1, u2| u2)
6769
}
6870

6971
#[inline]
70-
pub fn difference(&mut self, s: &SmallBitv, nbits: uint) -> bool {
72+
fn difference(&mut self, s: &SmallBitv, nbits: uint) -> bool {
7173
self.bits_op(s.bits, nbits, |u1, u2| u1 & !u2)
7274
}
7375

7476
#[inline]
75-
pub fn get(&self, i: uint) -> bool {
77+
fn get(&self, i: uint) -> bool {
7678
(self.bits & (1 << i)) != 0
7779
}
7880

7981
#[inline]
80-
pub fn set(&mut self, i: uint, x: bool) {
82+
fn set(&mut self, i: uint, x: bool) {
8183
if x {
8284
self.bits |= 1<<i;
8385
}
@@ -87,29 +89,29 @@ impl SmallBitv {
8789
}
8890

8991
#[inline]
90-
pub fn equals(&self, b: &SmallBitv, nbits: uint) -> bool {
92+
fn equals(&self, b: &SmallBitv, nbits: uint) -> bool {
9193
let mask = small_mask(nbits);
9294
mask & self.bits == mask & b.bits
9395
}
9496

9597
#[inline]
96-
pub fn clear(&mut self) { self.bits = 0; }
98+
fn clear(&mut self) { self.bits = 0; }
9799

98100
#[inline]
99-
pub fn set_all(&mut self) { self.bits = !0; }
101+
fn set_all(&mut self) { self.bits = !0; }
100102

101103
#[inline]
102-
pub fn all(&self, nbits: uint) -> bool {
104+
fn all(&self, nbits: uint) -> bool {
103105
small_mask(nbits) & !self.bits == 0
104106
}
105107

106108
#[inline]
107-
pub fn none(&self, nbits: uint) -> bool {
109+
fn none(&self, nbits: uint) -> bool {
108110
small_mask(nbits) & self.bits == 0
109111
}
110112

111113
#[inline]
112-
pub fn negate(&mut self) { self.bits = !self.bits; }
114+
fn negate(&mut self) { self.bits = !self.bits; }
113115
}
114116

115117
#[deriving(Clone)]
@@ -134,12 +136,12 @@ fn big_mask(nbits: uint, elem: uint) -> uint {
134136
}
135137

136138
impl BigBitv {
137-
pub fn new(storage: Vec<uint>) -> BigBitv {
139+
fn new(storage: Vec<uint>) -> BigBitv {
138140
BigBitv {storage: storage}
139141
}
140142

141143
#[inline]
142-
pub fn process(&mut self,
144+
fn process(&mut self,
143145
b: &BigBitv,
144146
nbits: uint,
145147
op: |uint, uint| -> uint)
@@ -163,45 +165,45 @@ impl BigBitv {
163165
}
164166

165167
#[inline]
166-
pub fn each_storage(&mut self, op: |v: &mut uint| -> bool) -> bool {
168+
fn each_storage(&mut self, op: |v: &mut uint| -> bool) -> bool {
167169
self.storage.mut_iter().advance(|elt| op(elt))
168170
}
169171

170172
#[inline]
171-
pub fn negate(&mut self) {
173+
fn negate(&mut self) {
172174
self.each_storage(|w| { *w = !*w; true });
173175
}
174176

175177
#[inline]
176-
pub fn union(&mut self, b: &BigBitv, nbits: uint) -> bool {
178+
fn union(&mut self, b: &BigBitv, nbits: uint) -> bool {
177179
self.process(b, nbits, |w1, w2| w1 | w2)
178180
}
179181

180182
#[inline]
181-
pub fn intersect(&mut self, b: &BigBitv, nbits: uint) -> bool {
183+
fn intersect(&mut self, b: &BigBitv, nbits: uint) -> bool {
182184
self.process(b, nbits, |w1, w2| w1 & w2)
183185
}
184186

185187
#[inline]
186-
pub fn become(&mut self, b: &BigBitv, nbits: uint) -> bool {
188+
fn become(&mut self, b: &BigBitv, nbits: uint) -> bool {
187189
self.process(b, nbits, |_, w| w)
188190
}
189191

190192
#[inline]
191-
pub fn difference(&mut self, b: &BigBitv, nbits: uint) -> bool {
193+
fn difference(&mut self, b: &BigBitv, nbits: uint) -> bool {
192194
self.process(b, nbits, |w1, w2| w1 & !w2)
193195
}
194196

195197
#[inline]
196-
pub fn get(&self, i: uint) -> bool {
198+
fn get(&self, i: uint) -> bool {
197199
let w = i / uint::BITS;
198200
let b = i % uint::BITS;
199201
let x = 1 & self.storage.get(w) >> b;
200202
x == 1
201203
}
202204

203205
#[inline]
204-
pub fn set(&mut self, i: uint, x: bool) {
206+
fn set(&mut self, i: uint, x: bool) {
205207
let w = i / uint::BITS;
206208
let b = i % uint::BITS;
207209
let flag = 1 << b;
@@ -210,7 +212,7 @@ impl BigBitv {
210212
}
211213

212214
#[inline]
213-
pub fn equals(&self, b: &BigBitv, nbits: uint) -> bool {
215+
fn equals(&self, b: &BigBitv, nbits: uint) -> bool {
214216
for (i, elt) in b.storage.iter().enumerate() {
215217
let mask = big_mask(nbits, i);
216218
if mask & *self.storage.get(i) != mask & *elt {
@@ -596,6 +598,20 @@ impl fmt::Show for Bitv {
596598
}
597599
}
598600

601+
impl<S: hash::Writer> hash::Hash<S> for Bitv {
602+
fn hash(&self, state: &mut S) {
603+
self.nbits.hash(state);
604+
match self.rep {
605+
Small(ref s) => (s.bits & small_mask(self.nbits)).hash(state),
606+
Big(ref b) => {
607+
for (i, ele) in b.storage.iter().enumerate() {
608+
(ele & big_mask(self.nbits, i)).hash(state);
609+
}
610+
}
611+
}
612+
}
613+
}
614+
599615
#[inline]
600616
fn iterate_bits(base: uint, bits: uint, f: |uint| -> bool) -> bool {
601617
if bits == 0 {
@@ -834,7 +850,15 @@ impl fmt::Show for BitvSet {
834850
}
835851
}
836852

837-
impl Container for BitvSet {
853+
impl<S: hash::Writer> hash::Hash<S> for BitvSet {
854+
fn hash(&self, state: &mut S) {
855+
for pos in self.iter() {
856+
pos.hash(state);
857+
}
858+
}
859+
}
860+
861+
impl Collection for BitvSet {
838862
#[inline]
839863
fn len(&self) -> uint { self.size }
840864
}
@@ -985,6 +1009,7 @@ mod tests {
9851009
use std::rand::Rng;
9861010
use test::Bencher;
9871011

1012+
use {Set, Mutable, MutableSet};
9881013
use bitv::{Bitv, SmallBitv, BigBitv, BitvSet, from_bools, from_fn,
9891014
from_bytes};
9901015
use bitv;

branches/try2/src/libcollections/btree.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use alloc::owned::Box;
2424
use core::fmt;
2525
use core::fmt::Show;
2626

27+
use Collection;
2728
use vec::Vec;
2829

2930
#[allow(missing_doc)]

branches/try2/src/libcollections/deque.rs

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,13 @@
1010

1111
//! Container traits for collections
1212
13-
use core::prelude::*;
14-
15-
/// A double-ended sequence that allows querying, insertion and deletion at both ends.
16-
pub trait Deque<T> : Mutable {
17-
/// Provide a reference to the front element, or None if the sequence is empty
18-
fn front<'a>(&'a self) -> Option<&'a T>;
19-
20-
/// Provide a mutable reference to the front element, or None if the sequence is empty
21-
fn front_mut<'a>(&'a mut self) -> Option<&'a mut T>;
22-
23-
/// Provide a reference to the back element, or None if the sequence is empty
24-
fn back<'a>(&'a self) -> Option<&'a T>;
25-
26-
/// Provide a mutable reference to the back element, or None if the sequence is empty
27-
fn back_mut<'a>(&'a mut self) -> Option<&'a mut T>;
28-
29-
/// Insert an element first in the sequence
30-
fn push_front(&mut self, elt: T);
31-
32-
/// Insert an element last in the sequence
33-
fn push_back(&mut self, elt: T);
34-
35-
/// Remove the last element and return it, or None if the sequence is empty
36-
fn pop_back(&mut self) -> Option<T>;
37-
38-
/// Remove the first element and return it, or None if the sequence is empty
39-
fn pop_front(&mut self) -> Option<T>;
40-
}
41-
4213
#[cfg(test)]
4314
pub mod bench {
4415
use std::prelude::*;
4516
use std::rand;
4617
use std::rand::Rng;
4718
use test::Bencher;
19+
use MutableMap;
4820

4921
pub fn insert_rand_n<M:MutableMap<uint,uint>>(n: uint,
5022
map: &mut M,
@@ -121,3 +93,4 @@ pub mod bench {
12193
})
12294
}
12395
}
96+

0 commit comments

Comments
 (0)