File tree Expand file tree Collapse file tree 6 files changed +21
-27
lines changed
branches/snap-stage3/src/libstd Expand file tree Collapse file tree 6 files changed +21
-27
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
refs/heads/master: 296e60be6b027a52de58251848037a92f23a0878
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
- refs/heads/snap-stage3: 326f938730c1eaae48ed333907dce2cc92dc9aab
4
+ refs/heads/snap-stage3: c836ff46215b743c0f681d3e4d799cde1832cde3
5
5
refs/heads/try: 38201d7c6bf0c32b0e5bdc8ecd63976ebc1b3a4c
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ fn reset_helper(w: ~Writer:Send,
160
160
{
161
161
let mut t = Local :: borrow ( None :: < Task > ) ;
162
162
// Be sure to flush any pending output from the writer
163
- match f ( t . get ( ) , w) {
163
+ match f ( & mut * t , w) {
164
164
Some ( mut w) => {
165
165
drop ( t) ;
166
166
// FIXME: is failing right here?
@@ -230,9 +230,7 @@ fn with_task_stdout(f: |&mut Writer| -> IoResult<()> ) {
230
230
// To protect against this, we do a little dance in which we
231
231
// temporarily take the task, swap the handles, put the task in TLS,
232
232
// 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) ;
236
234
drop ( prev) ;
237
235
ret
238
236
}
Original file line number Diff line number Diff line change @@ -319,8 +319,7 @@ pub unsafe fn local_free(ptr: *u8) {
319
319
}
320
320
321
321
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
324
323
}
325
324
326
325
#[ cfg( test) ]
Original file line number Diff line number Diff line change 18
18
#![ allow( dead_code) ]
19
19
20
20
use cast;
21
- use ops:: Drop ;
21
+ use ops:: { Drop , Deref , DerefMut } ;
22
22
use ptr:: RawPtr ;
23
23
24
24
#[ cfg( windows) ] // mingw-w32 doesn't like thread_local things
@@ -48,13 +48,15 @@ impl<T> Drop for Borrowed<T> {
48
48
}
49
49
}
50
50
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 ) }
58
60
}
59
61
}
60
62
Original file line number Diff line number Diff line change @@ -127,8 +127,8 @@ impl Task {
127
127
#[ allow( unused_must_use) ]
128
128
fn close_outputs ( ) {
129
129
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 ( ) ;
132
132
drop ( task) ;
133
133
match stdout { Some ( mut w) => { w. flush ( ) ; } , None => { } }
134
134
match stderr { Some ( mut w) => { w. flush ( ) ; } , None => { } }
@@ -159,8 +159,7 @@ impl Task {
159
159
// be intertwined, and miraculously work for now...
160
160
let mut task = Local :: borrow ( None :: < Task > ) ;
161
161
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 ;
164
163
optmap. take ( )
165
164
} ;
166
165
drop ( task) ;
@@ -332,8 +331,7 @@ impl BlockedTask {
332
331
}
333
332
334
333
/// 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 > {
337
335
let arc = match self {
338
336
Owned ( task) => {
339
337
let flag = unsafe { AtomicUint :: new ( cast:: transmute ( task) ) } ;
Original file line number Diff line number Diff line change @@ -257,8 +257,8 @@ pub fn try<T:Send>(f: proc():Send -> T) -> Result<T, ~Any:Send> {
257
257
pub fn with_task_name < U > ( blk: |Option < & str > | -> U ) -> U {
258
258
use rt:: task:: Task ;
259
259
260
- let mut task = Local :: borrow ( None :: < Task > ) ;
261
- match task. get ( ) . name {
260
+ let task = Local :: borrow ( None :: < Task > ) ;
261
+ match task. name {
262
262
Some ( ref name) => blk ( Some ( name. as_slice ( ) ) ) ,
263
263
None => blk ( None )
264
264
}
@@ -276,11 +276,8 @@ pub fn deschedule() {
276
276
277
277
pub fn failing ( ) -> bool {
278
278
//! True if the running task has failed
279
-
280
279
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 ( )
284
281
}
285
282
286
283
// The following 8 tests test the following 2^3 combinations:
You can’t perform that action at this time.
0 commit comments