From c836ff46215b743c0f681d3e4d799cde1832cde3 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 13 Apr 2014 14:39:04 -0700 Subject: std: Impl Deref/DerefMut for a borrowed task --- src/libstd/io/stdio.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/libstd/io') 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::); // 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::); - let prev = replace(&mut t.get().stdout, my_stdout); - drop(t); + let prev = replace(&mut Local::borrow(None::).stdout, my_stdout); drop(prev); ret } -- cgit 1.4.1-3-g733a5