Skip to content

Commit 6f401aa

Browse files
committed
---
yaml --- r: 152457 b: refs/heads/try2 c: 6dc0624 h: refs/heads/master i: 152455: 1ca2d0b v: v3
1 parent 64750ca commit 6f401aa

File tree

233 files changed

+3989
-3628
lines changed

Some content is hidden

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

233 files changed

+3989
-3628
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: ceaeb667b327cff7ad286255d68cb5a8ba8a4d7c
8+
refs/heads/try2: 6dc06249d78e7836ebe74e18c1924e879b3343d2
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: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,16 @@ DEPS_rlibc :=
6161
DEPS_alloc := core libc native:jemalloc
6262
DEPS_debug := std
6363
DEPS_rustrt := alloc core libc collections native:rustrt_native
64-
DEPS_std := core libc rand alloc collections rustrt sync \
64+
DEPS_std := core libc rand alloc collections rustrt \
6565
native:rust_builtin native:backtrace
6666
DEPS_graphviz := std
6767
DEPS_green := std native:context_switch
6868
DEPS_rustuv := std native:uv native:uv_support
6969
DEPS_native := std
7070
DEPS_syntax := std term serialize log fmt_macros debug
71-
DEPS_rustc := syntax native:rustllvm flate arena serialize getopts \
71+
DEPS_rustc := syntax native:rustllvm flate arena serialize sync getopts \
7272
time log graphviz debug
73-
DEPS_rustdoc := rustc native:hoedown serialize getopts \
73+
DEPS_rustdoc := rustc native:hoedown serialize sync getopts \
7474
test time debug
7575
DEPS_flate := std native:miniz
7676
DEPS_arena := std
@@ -80,17 +80,17 @@ DEPS_serialize := std log
8080
DEPS_term := std log
8181
DEPS_semver := std
8282
DEPS_uuid := std serialize
83-
DEPS_sync := core alloc rustrt collections
83+
DEPS_sync := std alloc
8484
DEPS_getopts := std
8585
DEPS_collections := core alloc
8686
DEPS_fourcc := rustc syntax std
8787
DEPS_hexfloat := rustc syntax std
8888
DEPS_num := std
8989
DEPS_test := std getopts serialize term time regex native:rust_test_helpers
90-
DEPS_time := std serialize
90+
DEPS_time := std serialize sync
9191
DEPS_rand := core
9292
DEPS_url := std
93-
DEPS_log := std
93+
DEPS_log := std sync
9494
DEPS_regex := std
9595
DEPS_regex_macros = rustc syntax std regex
9696
DEPS_fmt_macros = std

branches/try2/src/doc/guide-tasks.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ later.
269269
The basic example below illustrates this.
270270

271271
~~~
272-
use std::sync::Future;
272+
extern crate sync;
273273
274274
# fn main() {
275275
# fn make_a_sandwich() {};
@@ -278,7 +278,7 @@ fn fib(n: u64) -> u64 {
278278
12586269025
279279
}
280280
281-
let mut delayed_fib = Future::spawn(proc() fib(50));
281+
let mut delayed_fib = sync::Future::spawn(proc() fib(50));
282282
make_a_sandwich();
283283
println!("fib(50) = {}", delayed_fib.get())
284284
# }
@@ -294,7 +294,7 @@ Here is another example showing how futures allow you to background computations
294294
be distributed on the available cores.
295295

296296
~~~
297-
# use std::sync::Future;
297+
# extern crate sync;
298298
fn partial_sum(start: uint) -> f64 {
299299
let mut local_sum = 0f64;
300300
for num in range(start*100000, (start+1)*100000) {
@@ -304,7 +304,7 @@ fn partial_sum(start: uint) -> f64 {
304304
}
305305
306306
fn main() {
307-
let mut futures = Vec::from_fn(1000, |ind| Future::spawn( proc() { partial_sum(ind) }));
307+
let mut futures = Vec::from_fn(1000, |ind| sync::Future::spawn( proc() { partial_sum(ind) }));
308308
309309
let mut final_res = 0f64;
310310
for ft in futures.mut_iter() {
@@ -329,8 +329,10 @@ Here is a small example showing how to use Arcs. We wish to run concurrently sev
329329
a single large vector of floats. Each task needs the full vector to perform its duty.
330330

331331
~~~
332+
extern crate sync;
333+
334+
use sync::Arc;
332335
use std::rand;
333-
use std::sync::Arc;
334336
335337
fn pnorm(nums: &[f64], p: uint) -> f64 {
336338
nums.iter().fold(0.0, |a, b| a + b.powf(p as f64)).powf(1.0 / (p as f64))
@@ -355,8 +357,9 @@ at the power given as argument and takes the inverse power of this value). The A
355357
created by the line
356358

357359
~~~
360+
# extern crate sync;
358361
# use std::rand;
359-
# use std::sync::Arc;
362+
# use sync::Arc;
360363
# fn main() {
361364
# let numbers = Vec::from_fn(1000000, |_| rand::random::<f64>());
362365
let numbers_arc=Arc::new(numbers);
@@ -368,8 +371,9 @@ it's contents. Within the task's procedure, the captured Arc reference can be us
368371
reference to the underlying vector as if it were local.
369372

370373
~~~
374+
# extern crate sync;
371375
# use std::rand;
372-
# use std::sync::Arc;
376+
# use sync::Arc;
373377
# fn pnorm(nums: &[f64], p: uint) -> f64 { 4.0 }
374378
# fn main() {
375379
# let numbers=Vec::from_fn(1000000, |_| rand::random::<f64>());
@@ -457,9 +461,9 @@ the string in response. The child terminates when it receives `0`.
457461
Here is the function that implements the child task:
458462

459463
~~~
460-
use std::comm::DuplexStream;
464+
extern crate sync;
461465
# fn main() {
462-
fn stringifier(channel: &DuplexStream<String, uint>) {
466+
fn stringifier(channel: &sync::DuplexStream<String, uint>) {
463467
let mut value: uint;
464468
loop {
465469
value = channel.recv();
@@ -481,10 +485,10 @@ response itself is simply the stringified version of the received value,
481485
Here is the code for the parent task:
482486

483487
~~~
484-
use std::comm::duplex;
488+
extern crate sync;
485489
# use std::task::spawn;
486-
# use std::comm::DuplexStream;
487-
# fn stringifier(channel: &DuplexStream<String, uint>) {
490+
# use sync::DuplexStream;
491+
# fn stringifier(channel: &sync::DuplexStream<String, uint>) {
488492
# let mut value: uint;
489493
# loop {
490494
# value = channel.recv();
@@ -494,7 +498,7 @@ use std::comm::duplex;
494498
# }
495499
# fn main() {
496500
497-
let (from_child, to_child) = duplex();
501+
let (from_child, to_child) = sync::duplex();
498502
499503
spawn(proc() {
500504
stringifier(&to_child);

branches/try2/src/doc/intro.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ an atomically reference counted box ("A.R.C." == "atomically reference counted")
297297
Here's some code:
298298

299299
```
300-
use std::sync::Arc;
300+
extern crate sync;
301+
use sync::Arc;
301302
302303
fn main() {
303304
let numbers = vec![1,2,3];
@@ -343,7 +344,8 @@ Let's take the same example yet again,
343344
and modify it to mutate the shared state:
344345

345346
```
346-
use std::sync::{Arc, Mutex};
347+
extern crate sync;
348+
use sync::{Arc, Mutex};
347349
348350
fn main() {
349351
let numbers = vec![1,2,3];

branches/try2/src/doc/tutorial.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,14 +1710,14 @@ having ownership of the box. It allows the creation of cycles, and the individua
17101710
not have a destructor.
17111711

17121712
~~~
1713-
use std::gc::GC;
1713+
use std::gc::Gc;
17141714
17151715
// A fixed-size array allocated in a garbage-collected box
1716-
let x = box(GC) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
1716+
let x = Gc::new([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
17171717
let y = x; // does not perform a move, unlike with `Rc`
17181718
let z = x;
17191719
1720-
assert!(*z == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
1720+
assert!(*z.borrow() == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
17211721
~~~
17221722

17231723
With shared ownership, mutability cannot be inherited so the boxes are always immutable. However,

branches/try2/src/etc/licenseck.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
"rt/isaac/randport.cpp", # public domain
3939
"rt/isaac/rand.h", # public domain
4040
"rt/isaac/standard.h", # public domain
41-
"libsync/mpsc_queue.rs", # BSD
42-
"libsync/spsc_queue.rs", # BSD
43-
"libsync/mpmc_bounded_queue.rs", # BSD
41+
"libstd/sync/mpsc_queue.rs", # BSD
42+
"libstd/sync/spsc_queue.rs", # BSD
43+
"libstd/sync/mpmc_bounded_queue.rs", # BSD
4444
"libsync/mpsc_intrusive.rs", # BSD
4545
"test/bench/shootout-fannkuch-redux.rs", # BSD
4646
"test/bench/shootout-meteor.rs", # BSD

branches/try2/src/liballoc/arc.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ use heap::deallocate;
3333
/// task.
3434
///
3535
/// ```rust
36-
/// use std::sync::Arc;
36+
/// extern crate sync;
37+
///
38+
/// use sync::Arc;
3739
///
3840
/// fn main() {
3941
/// let numbers = Vec::from_fn(100, |i| i as f32);
@@ -274,7 +276,7 @@ mod tests {
274276
use std::task;
275277
use std::vec::Vec;
276278
use super::{Arc, Weak};
277-
use std::sync::Mutex;
279+
use sync::Mutex;
278280

279281
struct Canary(*mut atomics::AtomicUint);
280282

branches/try2/src/liballoc/heap.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,24 @@ unsafe fn closure_exchange_malloc(drop_glue: fn(*mut u8), size: uint, align: uin
155155
alloc as *mut u8
156156
}
157157

158+
// hack for libcore
159+
#[no_mangle]
160+
#[doc(hidden)]
161+
#[deprecated]
162+
#[cfg(not(test))]
163+
pub unsafe extern "C" fn rust_allocate(size: uint, align: uint) -> *mut u8 {
164+
allocate(size, align)
165+
}
166+
167+
// hack for libcore
168+
#[no_mangle]
169+
#[doc(hidden)]
170+
#[deprecated]
171+
#[cfg(not(test))]
172+
pub unsafe extern "C" fn rust_deallocate(ptr: *mut u8, size: uint, align: uint) {
173+
deallocate(ptr, size, align)
174+
}
175+
158176
#[cfg(test)]
159177
mod bench {
160178
extern crate test;
@@ -166,4 +184,11 @@ mod bench {
166184
box 10
167185
})
168186
}
187+
188+
#[bench]
189+
fn alloc_owned_big(b: &mut Bencher) {
190+
b.iter(|| {
191+
box [10, ..1000]
192+
})
193+
}
169194
}

branches/try2/src/liballoc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ extern crate libc;
8484
// Allow testing this library
8585

8686
#[cfg(test)] extern crate debug;
87+
#[cfg(test)] extern crate sync;
8788
#[cfg(test)] extern crate native;
8889
#[cfg(test, stage0)] #[phase(syntax, link)] extern crate std;
8990
#[cfg(test, stage0)] #[phase(syntax, link)] extern crate log;

branches/try2/src/liballoc/rc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,8 @@ mod tests {
320320
#[test]
321321
fn gc_inside() {
322322
// see issue #11532
323-
use std::gc::GC;
324-
let a = Rc::new(RefCell::new(box(GC) 1));
323+
use std::gc::Gc;
324+
let a = Rc::new(RefCell::new(Gc::new(1)));
325325
assert!(a.try_borrow_mut().is_some());
326326
}
327327

branches/try2/src/libcollections/hash/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,13 @@ impl<'a, S: Writer, T: Hash<S>> Hash<S> for &'a mut [T] {
213213
}
214214
}
215215

216+
impl<S: Writer, T: Hash<S>> Hash<S> for ~[T] {
217+
#[inline]
218+
fn hash(&self, state: &mut S) {
219+
self.as_slice().hash(state);
220+
}
221+
}
222+
216223
impl<S: Writer, T: Hash<S>> Hash<S> for Vec<T> {
217224
#[inline]
218225
fn hash(&self, state: &mut S) {
@@ -241,6 +248,13 @@ impl<S: Writer, T: Hash<S>> Hash<S> for Box<T> {
241248
}
242249
}
243250

251+
impl<S: Writer, T: Hash<S>> Hash<S> for @T {
252+
#[inline]
253+
fn hash(&self, state: &mut S) {
254+
(**self).hash(state);
255+
}
256+
}
257+
244258
impl<S: Writer, T: Hash<S>> Hash<S> for Rc<T> {
245259
#[inline]
246260
fn hash(&self, state: &mut S) {

branches/try2/src/libcollections/hash/sip.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@ mod tests {
276276
use str::Str;
277277
use string::String;
278278
use slice::{Vector, ImmutableVector};
279-
use vec::Vec;
280279

281280
use super::super::{Hash, Writer};
282281
use super::{SipState, hash, hash_with_keys};
@@ -377,8 +376,8 @@ mod tests {
377376
s
378377
}
379378

380-
fn result_bytes(h: u64) -> Vec<u8> {
381-
vec![(h >> 0) as u8,
379+
fn result_bytes(h: u64) -> ~[u8] {
380+
box [(h >> 0) as u8,
382381
(h >> 8) as u8,
383382
(h >> 16) as u8,
384383
(h >> 24) as u8,

branches/try2/src/libcollections/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,8 @@ pub use enum_set::EnumSet;
5252
pub use priority_queue::PriorityQueue;
5353
pub use ringbuf::RingBuf;
5454
pub use smallintmap::SmallIntMap;
55-
pub use string::String;
5655
pub use treemap::{TreeMap, TreeSet};
5756
pub use trie::{TrieMap, TrieSet};
58-
pub use vec::Vec;
5957

6058
mod macros;
6159

0 commit comments

Comments
 (0)