summary refs log tree commit diff
path: root/src/libstd/io
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-04-13 14:39:04 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-04-15 19:45:00 -0700
commitc836ff46215b743c0f681d3e4d799cde1832cde3 (patch)
treed2d65dfca8f0683102c85ef3a287be374b1cf647 /src/libstd/io
parent326f938730c1eaae48ed333907dce2cc92dc9aab (diff)
downloadrust-c836ff46215b743c0f681d3e4d799cde1832cde3.tar.gz
rust-c836ff46215b743c0f681d3e4d799cde1832cde3.zip
std: Impl Deref/DerefMut for a borrowed task
Diffstat (limited to 'src/libstd/io')
-rw-r--r--src/libstd/io/stdio.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs
index 5f47e227901..34a57884398 100644
--- a/src/libstd/io/stdio.rs
+++ b/src/libstd/io/stdio.rs
@@ -160,7 +160,7 @@ fn reset_helper(w: ~Writer:Send,
 {
     let mut t = Local::borrow(None::<Task>);
     // Be sure to flush any pending output from the writer
-    match f(t.get(), w) {
+    match f(&mut *t, w) {
         Some(mut w) => {
             drop(t);
             // FIXME: is failing right here?
@@ -230,9 +230,7 @@ fn with_task_stdout(f: |&mut Writer| -> IoResult<()> ) {
             // To protect against this, we do a little dance in which we
             // temporarily take the task, swap the handles, put the task in TLS,
             // and only then drop the previous handle.
-            let mut t = Local::borrow(None::<Task>);
-            let prev = replace(&mut t.get().stdout, my_stdout);
-            drop(t);
+            let prev = replace(&mut Local::borrow(None::<Task>).stdout, my_stdout);
             drop(prev);
             ret
         }