diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-05-05 18:56:44 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-05-06 23:12:54 -0700 |
| commit | 090040bf4037a094e50b03d79e4baf5cd89c912b (patch) | |
| tree | 27fa91d623889d59260d3db167abdfa8c4288849 /src/libstd/io/stdio.rs | |
| parent | 24f6f26e633e50b5b59f9d0f6cca0b1e49e215d9 (diff) | |
| download | rust-090040bf4037a094e50b03d79e4baf5cd89c912b.tar.gz rust-090040bf4037a094e50b03d79e4baf5cd89c912b.zip | |
librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, except
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box<Type>`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change]
Diffstat (limited to 'src/libstd/io/stdio.rs')
| -rw-r--r-- | src/libstd/io/stdio.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index 7cb58e1ea48..613e9f027a4 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -34,6 +34,7 @@ use libc; use kinds::Send; use mem::replace; use option::{Option, Some, None}; +use owned::Box; use prelude::drop; use result::{Ok, Err}; use rt; @@ -71,8 +72,8 @@ use str::StrSlice; // tl;dr; TTY works on everything but when windows stdout is redirected, in that // case pipe also doesn't work, but magically file does! enum StdSource { - TTY(~RtioTTY:Send), - File(~RtioFileStream:Send), + TTY(Box<RtioTTY:Send>), + File(Box<RtioFileStream:Send>), } fn src<T>(fd: libc::c_int, readable: bool, f: |StdSource| -> T) -> T { @@ -153,10 +154,9 @@ pub fn stderr_raw() -> StdWriter { src(libc::STDERR_FILENO, false, |src| StdWriter { inner: src }) } -fn reset_helper(w: ~Writer:Send, - f: |&mut Task, ~Writer:Send| -> Option<~Writer:Send>) - -> Option<~Writer:Send> -{ +fn reset_helper(w: Box<Writer:Send>, + f: |&mut Task, Box<Writer:Send>| -> Option<Box<Writer:Send>>) + -> Option<Box<Writer:Send>> { let mut t = Local::borrow(None::<Task>); // Be sure to flush any pending output from the writer match f(&mut *t, w) { @@ -178,7 +178,7 @@ fn reset_helper(w: ~Writer:Send, /// /// Note that this does not need to be called for all new tasks; the default /// output handle is to the process's stdout stream. -pub fn set_stdout(stdout: ~Writer:Send) -> Option<~Writer:Send> { +pub fn set_stdout(stdout: Box<Writer:Send>) -> Option<Box<Writer:Send>> { reset_helper(stdout, |t, w| replace(&mut t.stdout, Some(w))) } @@ -190,7 +190,7 @@ pub fn set_stdout(stdout: ~Writer:Send) -> Option<~Writer:Send> { /// /// Note that this does not need to be called for all new tasks; the default /// output handle is to the process's stderr stream. -pub fn set_stderr(stderr: ~Writer:Send) -> Option<~Writer:Send> { +pub fn set_stderr(stderr: Box<Writer:Send>) -> Option<Box<Writer:Send>> { reset_helper(stderr, |t, w| replace(&mut t.stderr, Some(w))) } @@ -205,7 +205,7 @@ pub fn set_stderr(stderr: ~Writer:Send) -> Option<~Writer:Send> { // }) // }) fn with_task_stdout(f: |&mut Writer| -> IoResult<()> ) { - let task: Option<~Task> = Local::try_take(); + let task: Option<Box<Task>> = Local::try_take(); let result = match task { Some(mut task) => { // Printing may run arbitrary code, so ensure that the task is in @@ -216,7 +216,7 @@ fn with_task_stdout(f: |&mut Writer| -> IoResult<()> ) { Local::put(task); if my_stdout.is_none() { - my_stdout = Some(box stdout() as ~Writer:Send); + my_stdout = Some(box stdout() as Box<Writer:Send>); } let ret = f(*my_stdout.get_mut_ref()); |
