Skip to content

Commit 8bc6ade

Browse files
committed
---
yaml --- r: 111031 b: refs/heads/snap-stage3 c: c836ff4 h: refs/heads/master i: 111029: bf02b6b 111027: 7b74024 111023: 677f278 v: v3
1 parent c783160 commit 8bc6ade

File tree

6 files changed

+21
-27
lines changed

6 files changed

+21
-27
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: 296e60be6b027a52de58251848037a92f23a0878
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 326f938730c1eaae48ed333907dce2cc92dc9aab
4+
refs/heads/snap-stage3: c836ff46215b743c0f681d3e4d799cde1832cde3
55
refs/heads/try: 38201d7c6bf0c32b0e5bdc8ecd63976ebc1b3a4c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libstd/io/stdio.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ fn reset_helper(w: ~Writer:Send,
160160
{
161161
let mut t = Local::borrow(None::<Task>);
162162
// Be sure to flush any pending output from the writer
163-
match f(t.get(), w) {
163+
match f(&mut *t, w) {
164164
Some(mut w) => {
165165
drop(t);
166166
// FIXME: is failing right here?
@@ -230,9 +230,7 @@ fn with_task_stdout(f: |&mut Writer| -> IoResult<()> ) {
230230
// To protect against this, we do a little dance in which we
231231
// temporarily take the task, swap the handles, put the task in TLS,
232232
// and only then drop the previous handle.
233-
let mut t = Local::borrow(None::<Task>);
234-
let prev = replace(&mut t.get().stdout, my_stdout);
235-
drop(t);
233+
let prev = replace(&mut Local::borrow(None::<Task>).stdout, my_stdout);
236234
drop(prev);
237235
ret
238236
}

branches/snap-stage3/src/libstd/rt/local_heap.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,7 @@ pub unsafe fn local_free(ptr: *u8) {
319319
}
320320

321321
pub fn live_allocs() -> *mut Box {
322-
let mut task = Local::borrow(None::<Task>);
323-
task.get().heap.live_allocs
322+
Local::borrow(None::<Task>).heap.live_allocs
324323
}
325324

326325
#[cfg(test)]

branches/snap-stage3/src/libstd/rt/local_ptr.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#![allow(dead_code)]
1919

2020
use cast;
21-
use ops::Drop;
21+
use ops::{Drop, Deref, DerefMut};
2222
use ptr::RawPtr;
2323

2424
#[cfg(windows)] // mingw-w32 doesn't like thread_local things
@@ -48,13 +48,15 @@ impl<T> Drop for Borrowed<T> {
4848
}
4949
}
5050

51-
impl<T> Borrowed<T> {
52-
pub fn get<'a>(&'a mut self) -> &'a mut T {
53-
unsafe {
54-
let val_ptr: &mut ~T = cast::transmute(&mut self.val);
55-
let val_ptr: &'a mut T = *val_ptr;
56-
val_ptr
57-
}
51+
impl<T> Deref<T> for Borrowed<T> {
52+
fn deref<'a>(&'a self) -> &'a T {
53+
unsafe { &*(self.val as *T) }
54+
}
55+
}
56+
57+
impl<T> DerefMut<T> for Borrowed<T> {
58+
fn deref_mut<'a>(&'a mut self) -> &'a mut T {
59+
unsafe { &mut *(self.val as *mut T) }
5860
}
5961
}
6062

branches/snap-stage3/src/libstd/rt/task.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ impl Task {
127127
#[allow(unused_must_use)]
128128
fn close_outputs() {
129129
let mut task = Local::borrow(None::<Task>);
130-
let stderr = task.get().stderr.take();
131-
let stdout = task.get().stdout.take();
130+
let stderr = task.stderr.take();
131+
let stdout = task.stdout.take();
132132
drop(task);
133133
match stdout { Some(mut w) => { w.flush(); }, None => {} }
134134
match stderr { Some(mut w) => { w.flush(); }, None => {} }
@@ -159,8 +159,7 @@ impl Task {
159159
// be intertwined, and miraculously work for now...
160160
let mut task = Local::borrow(None::<Task>);
161161
let storage_map = {
162-
let task = task.get();
163-
let LocalStorage(ref mut optmap) = task.storage;
162+
let &LocalStorage(ref mut optmap) = &mut task.storage;
164163
optmap.take()
165164
};
166165
drop(task);
@@ -332,8 +331,7 @@ impl BlockedTask {
332331
}
333332

334333
/// Converts one blocked task handle to a list of many handles to the same.
335-
pub fn make_selectable(self, num_handles: uint) -> Take<BlockedTasks>
336-
{
334+
pub fn make_selectable(self, num_handles: uint) -> Take<BlockedTasks> {
337335
let arc = match self {
338336
Owned(task) => {
339337
let flag = unsafe { AtomicUint::new(cast::transmute(task)) };

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ pub fn try<T:Send>(f: proc():Send -> T) -> Result<T, ~Any:Send> {
257257
pub fn with_task_name<U>(blk: |Option<&str>| -> U) -> U {
258258
use rt::task::Task;
259259

260-
let mut task = Local::borrow(None::<Task>);
261-
match task.get().name {
260+
let task = Local::borrow(None::<Task>);
261+
match task.name {
262262
Some(ref name) => blk(Some(name.as_slice())),
263263
None => blk(None)
264264
}
@@ -276,11 +276,8 @@ pub fn deschedule() {
276276

277277
pub fn failing() -> bool {
278278
//! True if the running task has failed
279-
280279
use rt::task::Task;
281-
282-
let mut local = Local::borrow(None::<Task>);
283-
local.get().unwinder.unwinding()
280+
Local::borrow(None::<Task>).unwinder.unwinding()
284281
}
285282

286283
// The following 8 tests test the following 2^3 combinations:

0 commit comments

Comments
 (0)