Skip to content

Commit 65d8597

Browse files
committed
---
yaml --- r: 100865 b: refs/heads/snap-stage3 c: b36340b h: refs/heads/master i: 100863: 696ce11 v: v3
1 parent 9359c80 commit 65d8597

File tree

40 files changed

+512
-329
lines changed

40 files changed

+512
-329
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: e3b1f3c443c048913e2d573fcc5a9c2be3484a78
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: bea7862d9470c33b7b3e21a552a991e3b948aa29
4+
refs/heads/snap-stage3: b36340b6269e1b54fb4aa3ff49a90262fb2d953c
55
refs/heads/try: a97642026c18a624ff6ea01075dd9550f8ed07ff
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/mk/platform.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ CFG_GCCISH_DEF_FLAG_arm-unknown-linux-gnueabi := -Wl,--export-dynamic,--dynamic-
350350
CFG_GCCISH_PRE_LIB_FLAGS_arm-unknown-linux-gnueabi := -Wl,-whole-archive
351351
CFG_GCCISH_POST_LIB_FLAGS_arm-unknown-linux-gnueabi := -Wl,-no-whole-archive
352352
CFG_DEF_SUFFIX_arm-unknown-linux-gnueabi := .linux.def
353-
CFG_LLC_FLAGS_arm-unknown-linux-gnueabi := -arm-enable-ehabi -arm-enable-ehabi-descriptors
353+
CFG_LLC_FLAGS_arm-unknown-linux-gnueabi :=
354354
CFG_INSTALL_NAME_arm-unknown-linux-gnueabi =
355355
CFG_LIBUV_LINK_FLAGS_arm-unknown-linux-gnueabi =
356356
CFG_EXE_SUFFIX_arm-unknown-linux-gnueabi :=

branches/snap-stage3/src/doc/rustdoc.md

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -100,34 +100,29 @@ rustdoc --test crate.rs
100100

101101
## Defining tests
102102

103-
Rust documentation currently uses the markdown format, and code blocks can refer
104-
to any piece of code-related documentation, which isn't always rust. Because of
105-
this, only code blocks with the language of "rust" will be considered for
106-
testing.
103+
Rust documentation currently uses the markdown format, and rustdoc treats all
104+
code blocks as testable-by-default. In order to not run a test over a block of
105+
code, the `ignore` string can be added to the three-backtick form of markdown
106+
code block.
107107

108108
~~~
109-
```rust
109+
```
110110
// This is a testable code block
111111
```
112112
113-
```
113+
```ignore
114114
// This is not a testable code block
115115
```
116116
117-
// This is not a testable code block (4-space indent)
117+
// This is a testable code block (4-space indent)
118118
~~~
119119

120-
In addition to only testing "rust"-language code blocks, there are additional
121-
specifiers that can be used to dictate how a code block is tested:
120+
In addition to the `ignore` directive, you can specify that the test's execution
121+
should fail with the `should_fail` directive.
122122

123123
~~~
124-
```rust,ignore
125-
// This code block is ignored by rustdoc, but is passed through to the test
126-
// harness
127-
```
128-
129-
```rust,should_fail
130-
// This code block is expected to generate a failure
124+
```should_fail
125+
// This code block is expected to generate a failure when run
131126
```
132127
~~~
133128

@@ -143,7 +138,7 @@ that one can still write things like `#[deriving(Eq)]`).
143138
# the doc-generating tool. In order to display them anyway in this particular
144139
# case, the character following the leading '#' is not a usual space like in
145140
# these first five lines but a non breakable one.
146-
#
141+
#
147142
# // showing 'fib' in this documentation would just be tedious and detracts from
148143
# // what's actualy being documented.
149144
# fn fib(n: int) { n + 2 }
@@ -169,9 +164,6 @@ rustdoc --test lib.rs --test-args 'foo'
169164
170165
// See what's possible when running tests
171166
rustdoc --test lib.rs --test-args '--help'
172-
173-
// Run all ignored tests
174-
rustdoc --test lib.rs --test-args '--ignored'
175167
~~~
176168

177169
When testing a library, code examples will often show how functions are used,

branches/snap-stage3/src/libextra/json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ An object is a series of string keys mapping to values, in `"key": value` format
3030
Arrays are enclosed in square brackets ([ ... ]) and objects in curly brackets ({ ... }).
3131
A simple JSON document encoding a person, his/her age, address and phone numbers could look like:
3232
33-
```
33+
```ignore
3434
{
3535
"FirstName": "John",
3636
"LastName": "Doe",

branches/snap-stage3/src/libextra/stats.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ pub fn write_5_number_summary(w: &mut io::Writer,
341341
/// As an example, the summary with 5-number-summary `(min=15, q1=17, med=20, q3=24, max=31)` might
342342
/// display as:
343343
///
344-
/// ~~~~
344+
/// ~~~~ignore
345345
/// 10 | [--****#******----------] | 40
346346
/// ~~~~
347347

branches/snap-stage3/src/libglob/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub struct Paths {
6767
///
6868
/// The above code will print:
6969
///
70-
/// ```
70+
/// ```ignore
7171
/// /media/pictures/kittens.jpg
7272
/// /media/pictures/puppies.jpg
7373
/// ```

branches/snap-stage3/src/libgreen/sched.rs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use std::rt::rtio::{RemoteCallback, PausableIdleCallback, Callback, EventLoop};
1515
use std::rt::task::BlockedTask;
1616
use std::rt::task::Task;
1717
use std::sync::deque;
18-
use std::unstable::mutex::Mutex;
18+
use std::unstable::mutex::NativeMutex;
1919
use std::unstable::raw;
2020

2121
use TaskState;
@@ -669,8 +669,7 @@ impl Scheduler {
669669
// is acquired here. This is the resumption points and the "bounce"
670670
// that it is referring to.
671671
unsafe {
672-
current_task.nasty_deschedule_lock.lock();
673-
current_task.nasty_deschedule_lock.unlock();
672+
let _guard = current_task.nasty_deschedule_lock.lock();
674673
}
675674
return current_task;
676675
}
@@ -765,10 +764,11 @@ impl Scheduler {
765764
// to it, but we're guaranteed that the task won't exit until we've
766765
// unlocked the lock so there's no worry of this memory going away.
767766
let cur = self.change_task_context(cur, next, |sched, mut task| {
768-
let lock: *mut Mutex = &mut task.nasty_deschedule_lock;
769-
unsafe { (*lock).lock() }
770-
f(sched, BlockedTask::block(task.swap()));
771-
unsafe { (*lock).unlock() }
767+
let lock: *mut NativeMutex = &mut task.nasty_deschedule_lock;
768+
unsafe {
769+
let _guard = (*lock).lock();
770+
f(sched, BlockedTask::block(task.swap()));
771+
}
772772
});
773773
cur.put();
774774
}
@@ -1453,8 +1453,8 @@ mod test {
14531453

14541454
#[test]
14551455
fn test_spawn_sched_blocking() {
1456-
use std::unstable::mutex::{Mutex, MUTEX_INIT};
1457-
static mut LOCK: Mutex = MUTEX_INIT;
1456+
use std::unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
1457+
static mut LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
14581458

14591459
// Testing that a task in one scheduler can block in foreign code
14601460
// without affecting other schedulers
@@ -1466,12 +1466,11 @@ mod test {
14661466
let mut handle = pool.spawn_sched();
14671467
handle.send(PinnedTask(pool.task(TaskOpts::new(), proc() {
14681468
unsafe {
1469-
LOCK.lock();
1469+
let mut guard = LOCK.lock();
14701470

14711471
start_ch.send(());
1472-
LOCK.wait(); // block the scheduler thread
1473-
LOCK.signal(); // let them know we have the lock
1474-
LOCK.unlock();
1472+
guard.wait(); // block the scheduler thread
1473+
guard.signal(); // let them know we have the lock
14751474
}
14761475

14771476
fin_ch.send(());
@@ -1503,10 +1502,9 @@ mod test {
15031502
child_ch.send(20);
15041503
pingpong(&parent_po, &child_ch);
15051504
unsafe {
1506-
LOCK.lock();
1507-
LOCK.signal(); // wakeup waiting scheduler
1508-
LOCK.wait(); // wait for them to grab the lock
1509-
LOCK.unlock();
1505+
let mut guard = LOCK.lock();
1506+
guard.signal(); // wakeup waiting scheduler
1507+
guard.wait(); // wait for them to grab the lock
15101508
}
15111509
})));
15121510
drop(handle);

branches/snap-stage3/src/libgreen/simple.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ use std::rt::local::Local;
1717
use std::rt::rtio;
1818
use std::rt::task::{Task, BlockedTask};
1919
use std::task::TaskOpts;
20-
use std::unstable::sync::LittleLock;
20+
use std::unstable::mutex::NativeMutex;
2121

2222
struct SimpleTask {
23-
lock: LittleLock,
23+
lock: NativeMutex,
2424
awoken: bool,
2525
}
2626

@@ -59,9 +59,9 @@ impl Runtime for SimpleTask {
5959
to_wake.put_runtime(self as ~Runtime);
6060
unsafe {
6161
cast::forget(to_wake);
62-
let _l = (*me).lock.lock();
62+
let mut guard = (*me).lock.lock();
6363
(*me).awoken = true;
64-
(*me).lock.signal();
64+
guard.signal();
6565
}
6666
}
6767

@@ -83,7 +83,7 @@ impl Runtime for SimpleTask {
8383
pub fn task() -> ~Task {
8484
let mut task = ~Task::new();
8585
task.put_runtime(~SimpleTask {
86-
lock: LittleLock::new(),
86+
lock: unsafe {NativeMutex::new()},
8787
awoken: false,
8888
} as ~Runtime);
8989
return task;

branches/snap-stage3/src/libgreen/task.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use std::rt::local::Local;
2525
use std::rt::rtio;
2626
use std::rt::task::{Task, BlockedTask, SendMessage};
2727
use std::task::TaskOpts;
28-
use std::unstable::mutex::Mutex;
28+
use std::unstable::mutex::NativeMutex;
2929
use std::unstable::raw;
3030

3131
use context::Context;
@@ -65,7 +65,7 @@ pub struct GreenTask {
6565
pool_id: uint,
6666

6767
// See the comments in the scheduler about why this is necessary
68-
nasty_deschedule_lock: Mutex,
68+
nasty_deschedule_lock: NativeMutex,
6969
}
7070

7171
pub enum TaskType {
@@ -163,7 +163,7 @@ impl GreenTask {
163163
task_type: task_type,
164164
sched: None,
165165
handle: None,
166-
nasty_deschedule_lock: unsafe { Mutex::new() },
166+
nasty_deschedule_lock: unsafe { NativeMutex::new() },
167167
task: Some(~Task::new()),
168168
}
169169
}
@@ -322,11 +322,10 @@ impl GreenTask {
322322
// uncontended except for when the task is rescheduled).
323323
fn reawaken_remotely(mut ~self) {
324324
unsafe {
325-
let mtx = &mut self.nasty_deschedule_lock as *mut Mutex;
325+
let mtx = &mut self.nasty_deschedule_lock as *mut NativeMutex;
326326
let handle = self.handle.get_mut_ref() as *mut SchedHandle;
327-
(*mtx).lock();
327+
let _guard = (*mtx).lock();
328328
(*handle).send(RunOnce(self));
329-
(*mtx).unlock();
330329
}
331330
}
332331
}
@@ -479,12 +478,6 @@ impl Runtime for GreenTask {
479478
fn wrap(~self) -> ~Any { self as ~Any }
480479
}
481480

482-
impl Drop for GreenTask {
483-
fn drop(&mut self) {
484-
unsafe { self.nasty_deschedule_lock.destroy(); }
485-
}
486-
}
487-
488481
#[cfg(test)]
489482
mod tests {
490483
use std::rt::Runtime;

branches/snap-stage3/src/libnative/bookkeeping.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
//! The green counterpart for this is bookkeeping on sched pools.
1818
1919
use std::sync::atomics;
20-
use std::unstable::mutex::{Mutex, MUTEX_INIT};
20+
use std::unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
2121

2222
static mut TASK_COUNT: atomics::AtomicUint = atomics::INIT_ATOMIC_UINT;
23-
static mut TASK_LOCK: Mutex = MUTEX_INIT;
23+
static mut TASK_LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
2424

2525
pub fn increment() {
2626
let _ = unsafe { TASK_COUNT.fetch_add(1, atomics::SeqCst) };
@@ -29,9 +29,8 @@ pub fn increment() {
2929
pub fn decrement() {
3030
unsafe {
3131
if TASK_COUNT.fetch_sub(1, atomics::SeqCst) == 1 {
32-
TASK_LOCK.lock();
33-
TASK_LOCK.signal();
34-
TASK_LOCK.unlock();
32+
let mut guard = TASK_LOCK.lock();
33+
guard.signal();
3534
}
3635
}
3736
}
@@ -40,11 +39,12 @@ pub fn decrement() {
4039
/// the entry points of native programs
4140
pub fn wait_for_other_tasks() {
4241
unsafe {
43-
TASK_LOCK.lock();
44-
while TASK_COUNT.load(atomics::SeqCst) > 0 {
45-
TASK_LOCK.wait();
42+
{
43+
let mut guard = TASK_LOCK.lock();
44+
while TASK_COUNT.load(atomics::SeqCst) > 0 {
45+
guard.wait();
46+
}
4647
}
47-
TASK_LOCK.unlock();
4848
TASK_LOCK.destroy();
4949
}
5050
}

branches/snap-stage3/src/libnative/io/net.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,19 +218,18 @@ pub fn init() {
218218
}
219219

220220
unsafe {
221-
use std::unstable::mutex::{Mutex, MUTEX_INIT};
221+
use std::unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
222222
static mut INITIALIZED: bool = false;
223-
static mut LOCK: Mutex = MUTEX_INIT;
223+
static mut LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
224224

225-
LOCK.lock();
225+
let _guard = LOCK.lock();
226226
if !INITIALIZED {
227227
let mut data: WSADATA = mem::init();
228228
let ret = WSAStartup(0x202, // version 2.2
229229
&mut data);
230230
assert_eq!(ret, 0);
231231
INITIALIZED = true;
232232
}
233-
LOCK.unlock();
234233
}
235234
}
236235

branches/snap-stage3/src/libnative/io/timer_helper.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
2323
use std::cast;
2424
use std::rt;
25-
use std::unstable::mutex::{Mutex, MUTEX_INIT};
25+
use std::unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
2626

2727
use bookkeeping;
2828
use io::timer::{Req, Shutdown};
@@ -37,11 +37,11 @@ static mut HELPER_CHAN: *mut Chan<Req> = 0 as *mut Chan<Req>;
3737
static mut HELPER_SIGNAL: imp::signal = 0 as imp::signal;
3838

3939
pub fn boot(helper: fn(imp::signal, Port<Req>)) {
40-
static mut LOCK: Mutex = MUTEX_INIT;
40+
static mut LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
4141
static mut INITIALIZED: bool = false;
4242

4343
unsafe {
44-
LOCK.lock();
44+
let mut _guard = LOCK.lock();
4545
if !INITIALIZED {
4646
let (msgp, msgc) = Chan::new();
4747
// promote this to a shared channel
@@ -58,7 +58,6 @@ pub fn boot(helper: fn(imp::signal, Port<Req>)) {
5858
rt::at_exit(proc() { shutdown() });
5959
INITIALIZED = true;
6060
}
61-
LOCK.unlock();
6261
}
6362
}
6463

0 commit comments

Comments
 (0)