1
Fork 0

Fallout of io => old_io

This commit is contained in:
Alex Crichton 2015-01-22 16:31:00 -08:00
parent f72b164510
commit 3a07f859b8
158 changed files with 607 additions and 605 deletions

View file

@ -24,8 +24,8 @@ extern crate getopts;
extern crate log; extern crate log;
use std::os; use std::os;
use std::io; use std::old_io;
use std::io::fs; use std::old_io::fs;
use std::str::FromStr; use std::str::FromStr;
use std::thunk::Thunk; use std::thunk::Thunk;
use getopts::{optopt, optflag, reqopt}; use getopts::{optopt, optflag, reqopt};
@ -237,7 +237,7 @@ pub fn run_tests(config: &Config) {
// sadly osx needs some file descriptor limits raised for running tests in // sadly osx needs some file descriptor limits raised for running tests in
// parallel (especially when we have lots and lots of child processes). // parallel (especially when we have lots and lots of child processes).
// For context, see #8904 // For context, see #8904
io::test::raise_fd_limit(); old_io::test::raise_fd_limit();
// Prevent issue #21352 UAC blocking .exe containing 'patch' etc. on Windows // Prevent issue #21352 UAC blocking .exe containing 'patch' etc. on Windows
// If #11207 is resolved (adding manifest to .exe) this becomes unnecessary // If #11207 is resolved (adding manifest to .exe) this becomes unnecessary
os::setenv("__COMPAT_LAYER", "RunAsInvoker"); os::setenv("__COMPAT_LAYER", "RunAsInvoker");

View file

@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
use self::WhichLine::*; use self::WhichLine::*;
use std::io::{BufferedReader, File}; use std::old_io::{BufferedReader, File};
pub struct ExpectedError { pub struct ExpectedError {
pub line: uint, pub line: uint,

View file

@ -223,7 +223,7 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool {
fn iter_header<F>(testfile: &Path, mut it: F) -> bool where fn iter_header<F>(testfile: &Path, mut it: F) -> bool where
F: FnMut(&str) -> bool, F: FnMut(&str) -> bool,
{ {
use std::io::{BufferedReader, File}; use std::old_io::{BufferedReader, File};
let mut rdr = BufferedReader::new(File::open(testfile).unwrap()); let mut rdr = BufferedReader::new(File::open(testfile).unwrap());
for ln in rdr.lines() { for ln in rdr.lines() {

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::io::process::{ProcessExit, Command, Process, ProcessOutput}; use std::old_io::process::{ProcessExit, Command, Process, ProcessOutput};
use std::dynamic_lib::DynamicLibrary; use std::dynamic_lib::DynamicLibrary;
fn add_target_env(cmd: &mut Command, lib_path: &str, aux_path: Option<&str>) { fn add_target_env(cmd: &mut Command, lib_path: &str, aux_path: Option<&str>) {

View file

@ -23,14 +23,14 @@ use util;
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
use std::io::File; use std::old_io::File;
use std::io::fs::PathExtensions; use std::old_io::fs::PathExtensions;
use std::io::fs; use std::old_io::fs;
use std::io::net::tcp; use std::old_io::net::tcp;
use std::io::process::ProcessExit; use std::old_io::process::ProcessExit;
use std::io::process; use std::old_io::process;
use std::io::timer; use std::old_io::timer;
use std::io; use std::old_io;
use std::os; use std::os;
use std::iter::repeat; use std::iter::repeat;
use std::str; use std::str;
@ -619,7 +619,7 @@ fn find_rust_src_root(config: &Config) -> Option<Path> {
} }
fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path) { fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path) {
use std::io::process::{Command, ProcessOutput}; use std::old_io::process::{Command, ProcessOutput};
if config.lldb_python_dir.is_none() { if config.lldb_python_dir.is_none() {
fatal("Can't run LLDB test because LLDB's python path is not set."); fatal("Can't run LLDB test because LLDB's python path is not set.");
@ -764,7 +764,7 @@ struct DebuggerCommands {
fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str) fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
-> DebuggerCommands { -> DebuggerCommands {
use std::io::{BufferedReader, File}; use std::old_io::{BufferedReader, File};
let command_directive = format!("{}-command", debugger_prefix); let command_directive = format!("{}-command", debugger_prefix);
let check_directive = format!("{}-check", debugger_prefix); let check_directive = format!("{}-check", debugger_prefix);
@ -1224,7 +1224,7 @@ fn compose_and_run_compiler(
fn ensure_dir(path: &Path) { fn ensure_dir(path: &Path) {
if path.is_dir() { return; } if path.is_dir() { return; }
fs::mkdir(path, io::USER_RWX).unwrap(); fs::mkdir(path, old_io::USER_RWX).unwrap();
} }
fn compose_and_run(config: &Config, testfile: &Path, fn compose_and_run(config: &Config, testfile: &Path,

View file

@ -75,14 +75,14 @@ Let's get to it! The first thing we need to do for our guessing game is
allow our player to input a guess. Put this in your `src/main.rs`: allow our player to input a guess. Put this in your `src/main.rs`:
```{rust,no_run} ```{rust,no_run}
use std::io; use std::old_io;
fn main() { fn main() {
println!("Guess the number!"); println!("Guess the number!");
println!("Please input your guess."); println!("Please input your guess.");
let input = io::stdin().read_line() let input = old_io::stdin().read_line()
.ok() .ok()
.expect("Failed to read line"); .expect("Failed to read line");
@ -121,7 +121,7 @@ explanatory text, and then an example. Let's try to modify our code to add in th
`random` function and see what happens: `random` function and see what happens:
```{rust,ignore} ```{rust,ignore}
use std::io; use std::old_io;
use std::rand; use std::rand;
fn main() { fn main() {
@ -133,7 +133,7 @@ fn main() {
println!("Please input your guess."); println!("Please input your guess.");
let input = io::stdin().read_line() let input = old_io::stdin().read_line()
.ok() .ok()
.expect("Failed to read line"); .expect("Failed to read line");
@ -180,7 +180,7 @@ This says "please give me a random `i32` value." We can change our code to use
this hint: this hint:
```{rust,no_run} ```{rust,no_run}
use std::io; use std::old_io;
use std::rand; use std::rand;
fn main() { fn main() {
@ -192,7 +192,7 @@ fn main() {
println!("Please input your guess."); println!("Please input your guess.");
let input = io::stdin().read_line() let input = old_io::stdin().read_line()
.ok() .ok()
.expect("Failed to read line"); .expect("Failed to read line");
@ -233,7 +233,7 @@ unsigned integer approach. If we want a random positive number, we should ask fo
a random positive number. Our code looks like this now: a random positive number. Our code looks like this now:
```{rust,no_run} ```{rust,no_run}
use std::io; use std::old_io;
use std::rand; use std::rand;
fn main() { fn main() {
@ -245,7 +245,7 @@ fn main() {
println!("Please input your guess."); println!("Please input your guess.");
let input = io::stdin().read_line() let input = old_io::stdin().read_line()
.ok() .ok()
.expect("Failed to read line"); .expect("Failed to read line");
@ -276,7 +276,7 @@ two numbers. Let's add that in, along with a `match` statement to compare our
guess to the secret number: guess to the secret number:
```{rust,ignore} ```{rust,ignore}
use std::io; use std::old_io;
use std::rand; use std::rand;
use std::cmp::Ordering; use std::cmp::Ordering;
@ -289,7 +289,7 @@ fn main() {
println!("Please input your guess."); println!("Please input your guess.");
let input = io::stdin().read_line() let input = old_io::stdin().read_line()
.ok() .ok()
.expect("Failed to read line"); .expect("Failed to read line");
@ -331,7 +331,7 @@ but we've given it unsigned integers. In this case, the fix is easy, because
we wrote the `cmp` function! Let's change it to take `u32`s: we wrote the `cmp` function! Let's change it to take `u32`s:
```{rust,ignore} ```{rust,ignore}
use std::io; use std::old_io;
use std::rand; use std::rand;
use std::cmp::Ordering; use std::cmp::Ordering;
@ -344,7 +344,7 @@ fn main() {
println!("Please input your guess."); println!("Please input your guess.");
let input = io::stdin().read_line() let input = old_io::stdin().read_line()
.ok() .ok()
.expect("Failed to read line"); .expect("Failed to read line");
@ -397,7 +397,7 @@ Anyway, we have a `String`, but we need a `u32`. What to do? Well, there's
a function for that: a function for that:
```{rust,ignore} ```{rust,ignore}
let input = io::stdin().read_line() let input = old_io::stdin().read_line()
.ok() .ok()
.expect("Failed to read line"); .expect("Failed to read line");
let input_num: Option<u32> = input.parse(); let input_num: Option<u32> = input.parse();
@ -429,7 +429,7 @@ let input_num: Option<u32> = "5".parse(); // input_num: Option<u32>
Anyway, with us now converting our input to a number, our code looks like this: Anyway, with us now converting our input to a number, our code looks like this:
```{rust,ignore} ```{rust,ignore}
use std::io; use std::old_io;
use std::rand; use std::rand;
use std::cmp::Ordering; use std::cmp::Ordering;
@ -442,7 +442,7 @@ fn main() {
println!("Please input your guess."); println!("Please input your guess.");
let input = io::stdin().read_line() let input = old_io::stdin().read_line()
.ok() .ok()
.expect("Failed to read line"); .expect("Failed to read line");
let input_num: Option<u32> = input.parse(); let input_num: Option<u32> = input.parse();
@ -479,7 +479,7 @@ need to unwrap the Option. If you remember from before, `match` is a great way
to do that. Try this code: to do that. Try this code:
```{rust,no_run} ```{rust,no_run}
use std::io; use std::old_io;
use std::rand; use std::rand;
use std::cmp::Ordering; use std::cmp::Ordering;
@ -492,7 +492,7 @@ fn main() {
println!("Please input your guess."); println!("Please input your guess.");
let input = io::stdin().read_line() let input = old_io::stdin().read_line()
.ok() .ok()
.expect("Failed to read line"); .expect("Failed to read line");
let input_num: Option<u32> = input.parse(); let input_num: Option<u32> = input.parse();
@ -546,7 +546,7 @@ method we can use defined on them: `trim()`. One small modification, and our
code looks like this: code looks like this:
```{rust,no_run} ```{rust,no_run}
use std::io; use std::old_io;
use std::rand; use std::rand;
use std::cmp::Ordering; use std::cmp::Ordering;
@ -559,7 +559,7 @@ fn main() {
println!("Please input your guess."); println!("Please input your guess.");
let input = io::stdin().read_line() let input = old_io::stdin().read_line()
.ok() .ok()
.expect("Failed to read line"); .expect("Failed to read line");
let input_num: Option<u32> = input.trim().parse(); let input_num: Option<u32> = input.trim().parse();
@ -620,7 +620,7 @@ As we already discussed, the `loop` keyword gives us an infinite loop.
Let's add that in: Let's add that in:
```{rust,no_run} ```{rust,no_run}
use std::io; use std::old_io;
use std::rand; use std::rand;
use std::cmp::Ordering; use std::cmp::Ordering;
@ -635,7 +635,7 @@ fn main() {
println!("Please input your guess."); println!("Please input your guess.");
let input = io::stdin().read_line() let input = old_io::stdin().read_line()
.ok() .ok()
.expect("Failed to read line"); .expect("Failed to read line");
let input_num: Option<u32> = input.trim().parse(); let input_num: Option<u32> = input.trim().parse();
@ -696,7 +696,7 @@ Ha! `quit` actually quits. As does any other non-number input. Well, this is
suboptimal to say the least. First, let's actually quit when you win the game: suboptimal to say the least. First, let's actually quit when you win the game:
```{rust,no_run} ```{rust,no_run}
use std::io; use std::old_io;
use std::rand; use std::rand;
use std::cmp::Ordering; use std::cmp::Ordering;
@ -711,7 +711,7 @@ fn main() {
println!("Please input your guess."); println!("Please input your guess.");
let input = io::stdin().read_line() let input = old_io::stdin().read_line()
.ok() .ok()
.expect("Failed to read line"); .expect("Failed to read line");
let input_num: Option<u32> = input.trim().parse(); let input_num: Option<u32> = input.trim().parse();
@ -752,7 +752,7 @@ we don't want to quit, we just want to ignore it. Change that `return` to
```{rust,no_run} ```{rust,no_run}
use std::io; use std::old_io;
use std::rand; use std::rand;
use std::cmp::Ordering; use std::cmp::Ordering;
@ -767,7 +767,7 @@ fn main() {
println!("Please input your guess."); println!("Please input your guess.");
let input = io::stdin().read_line() let input = old_io::stdin().read_line()
.ok() .ok()
.expect("Failed to read line"); .expect("Failed to read line");
let input_num: Option<u32> = input.trim().parse(); let input_num: Option<u32> = input.trim().parse();
@ -831,7 +831,7 @@ think of what it is? That's right, we don't want to print out the secret number.
It was good for testing, but it kind of ruins the game. Here's our final source: It was good for testing, but it kind of ruins the game. Here's our final source:
```{rust,no_run} ```{rust,no_run}
use std::io; use std::old_io;
use std::rand; use std::rand;
use std::cmp::Ordering; use std::cmp::Ordering;
@ -844,7 +844,7 @@ fn main() {
println!("Please input your guess."); println!("Please input your guess.");
let input = io::stdin().read_line() let input = old_io::stdin().read_line()
.ok() .ok()
.expect("Failed to read line"); .expect("Failed to read line");
let input_num: Option<u32> = input.trim().parse(); let input_num: Option<u32> = input.trim().parse();

View file

@ -8,7 +8,7 @@ and then prints it back out:
fn main() { fn main() {
println!("Type something!"); println!("Type something!");
let input = std::io::stdin().read_line().ok().expect("Failed to read line"); let input = std::old_io::stdin().read_line().ok().expect("Failed to read line");
println!("{}", input); println!("{}", input);
} }
@ -17,7 +17,7 @@ fn main() {
Let's go over these chunks, one by one: Let's go over these chunks, one by one:
```{rust,ignore} ```{rust,ignore}
std::io::stdin(); std::old_io::stdin();
``` ```
This calls a function, `stdin()`, that lives inside the `std::io` module. As This calls a function, `stdin()`, that lives inside the `std::io` module. As
@ -28,7 +28,7 @@ Since writing the fully qualified name all the time is annoying, we can use
the `use` statement to import it in: the `use` statement to import it in:
```{rust} ```{rust}
use std::io::stdin; use std::old_io::stdin;
stdin(); stdin();
``` ```
@ -37,20 +37,20 @@ However, it's considered better practice to not import individual functions, but
to import the module, and only use one level of qualification: to import the module, and only use one level of qualification:
```{rust} ```{rust}
use std::io; use std::old_io;
io::stdin(); old_io::stdin();
``` ```
Let's update our example to use this style: Let's update our example to use this style:
```{rust,ignore} ```{rust,ignore}
use std::io; use std::old_io;
fn main() { fn main() {
println!("Type something!"); println!("Type something!");
let input = io::stdin().read_line().ok().expect("Failed to read line"); let input = old_io::stdin().read_line().ok().expect("Failed to read line");
println!("{}", input); println!("{}", input);
} }
@ -121,12 +121,12 @@ For now, this gives you enough of a basic understanding to work with.
Back to the code we were working on! Here's a refresher: Back to the code we were working on! Here's a refresher:
```{rust,ignore} ```{rust,ignore}
use std::io; use std::old_io;
fn main() { fn main() {
println!("Type something!"); println!("Type something!");
let input = io::stdin().read_line().ok().expect("Failed to read line"); let input = old_io::stdin().read_line().ok().expect("Failed to read line");
println!("{}", input); println!("{}", input);
} }
@ -136,14 +136,14 @@ With long lines like this, Rust gives you some flexibility with the whitespace.
We _could_ write the example like this: We _could_ write the example like this:
```{rust,ignore} ```{rust,ignore}
use std::io; use std::old_io;
fn main() { fn main() {
println!("Type something!"); println!("Type something!");
// here, we'll show the types at each step // here, we'll show the types at each step
let input = io::stdin() // std::io::stdio::StdinReader let input = old_io::stdin() // std::old_io::stdio::StdinReader
.read_line() // IoResult<String> .read_line() // IoResult<String>
.ok() // Option<String> .ok() // Option<String>
.expect("Failed to read line"); // String .expect("Failed to read line"); // String

View file

@ -49,7 +49,7 @@
//! //!
//! ``` //! ```
//! use std::error::FromError; //! use std::error::FromError;
//! use std::io::{File, IoError}; //! use std::old_io::{File, IoError};
//! use std::os::{MemoryMap, MapError}; //! use std::os::{MemoryMap, MapError};
//! use std::path::Path; //! use std::path::Path;
//! //!

View file

@ -95,7 +95,7 @@
//! by the [`Writer`](../io/trait.Writer.html) trait: //! by the [`Writer`](../io/trait.Writer.html) trait:
//! //!
//! ``` //! ```
//! use std::io::IoError; //! use std::old_io::IoError;
//! //!
//! trait Writer { //! trait Writer {
//! fn write_line(&mut self, s: &str) -> Result<(), IoError>; //! fn write_line(&mut self, s: &str) -> Result<(), IoError>;
@ -110,7 +110,7 @@
//! something like this: //! something like this:
//! //!
//! ```{.ignore} //! ```{.ignore}
//! use std::io::{File, Open, Write}; //! use std::old_io::{File, Open, Write};
//! //!
//! let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write); //! let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write);
//! // If `write_line` errors, then we'll never know, because the return //! // If `write_line` errors, then we'll never know, because the return
@ -128,7 +128,7 @@
//! a marginally useful message indicating why: //! a marginally useful message indicating why:
//! //!
//! ```{.no_run} //! ```{.no_run}
//! use std::io::{File, Open, Write}; //! use std::old_io::{File, Open, Write};
//! //!
//! let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write); //! let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write);
//! file.write_line("important message").ok().expect("failed to write message"); //! file.write_line("important message").ok().expect("failed to write message");
@ -138,7 +138,7 @@
//! You might also simply assert success: //! You might also simply assert success:
//! //!
//! ```{.no_run} //! ```{.no_run}
//! # use std::io::{File, Open, Write}; //! # use std::old_io::{File, Open, Write};
//! //!
//! # let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write); //! # let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write);
//! assert!(file.write_line("important message").is_ok()); //! assert!(file.write_line("important message").is_ok());
@ -148,7 +148,7 @@
//! Or propagate the error up the call stack with `try!`: //! Or propagate the error up the call stack with `try!`:
//! //!
//! ``` //! ```
//! # use std::io::{File, Open, Write, IoError}; //! # use std::old_io::{File, Open, Write, IoError};
//! fn write_message() -> Result<(), IoError> { //! fn write_message() -> Result<(), IoError> {
//! let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write); //! let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write);
//! try!(file.write_line("important message")); //! try!(file.write_line("important message"));
@ -167,7 +167,7 @@
//! It replaces this: //! It replaces this:
//! //!
//! ``` //! ```
//! use std::io::{File, Open, Write, IoError}; //! use std::old_io::{File, Open, Write, IoError};
//! //!
//! struct Info { //! struct Info {
//! name: String, //! name: String,
@ -191,7 +191,7 @@
//! With this: //! With this:
//! //!
//! ``` //! ```
//! use std::io::{File, Open, Write, IoError}; //! use std::old_io::{File, Open, Write, IoError};
//! //!
//! struct Info { //! struct Info {
//! name: String, //! name: String,
@ -444,7 +444,7 @@ impl<T, E> Result<T, E> {
/// ignoring I/O and parse errors: /// ignoring I/O and parse errors:
/// ///
/// ``` /// ```
/// use std::io::IoResult; /// use std::old_io::IoResult;
/// ///
/// let mut buffer = &mut b"1\n2\n3\n4\n"; /// let mut buffer = &mut b"1\n2\n3\n4\n";
/// ///

View file

@ -96,7 +96,7 @@
//! ```no_run //! ```no_run
//! # pub fn render_to<W:Writer>(output: &mut W) { unimplemented!() } //! # pub fn render_to<W:Writer>(output: &mut W) { unimplemented!() }
//! pub fn main() { //! pub fn main() {
//! use std::io::File; //! use std::old_io::File;
//! let mut f = File::create(&Path::new("example1.dot")); //! let mut f = File::create(&Path::new("example1.dot"));
//! render_to(&mut f) //! render_to(&mut f)
//! } //! }
@ -188,7 +188,7 @@
//! ```no_run //! ```no_run
//! # pub fn render_to<W:Writer>(output: &mut W) { unimplemented!() } //! # pub fn render_to<W:Writer>(output: &mut W) { unimplemented!() }
//! pub fn main() { //! pub fn main() {
//! use std::io::File; //! use std::old_io::File;
//! let mut f = File::create(&Path::new("example2.dot")); //! let mut f = File::create(&Path::new("example2.dot"));
//! render_to(&mut f) //! render_to(&mut f)
//! } //! }
@ -252,7 +252,7 @@
//! ```no_run //! ```no_run
//! # pub fn render_to<W:Writer>(output: &mut W) { unimplemented!() } //! # pub fn render_to<W:Writer>(output: &mut W) { unimplemented!() }
//! pub fn main() { //! pub fn main() {
//! use std::io::File; //! use std::old_io::File;
//! let mut f = File::create(&Path::new("example3.dot")); //! let mut f = File::create(&Path::new("example3.dot"));
//! render_to(&mut f) //! render_to(&mut f)
//! } //! }
@ -279,7 +279,7 @@
use self::LabelText::*; use self::LabelText::*;
use std::borrow::IntoCow; use std::borrow::IntoCow;
use std::io; use std::old_io;
use std::string::CowString; use std::string::CowString;
use std::vec::CowVec; use std::vec::CowVec;
@ -532,7 +532,7 @@ pub fn default_options() -> Vec<RenderOption> { vec![] }
/// (Simple wrapper around `render_opts` that passes a default set of options.) /// (Simple wrapper around `render_opts` that passes a default set of options.)
pub fn render<'a, N:Clone+'a, E:Clone+'a, G:Labeller<'a,N,E>+GraphWalk<'a,N,E>, W:Writer>( pub fn render<'a, N:Clone+'a, E:Clone+'a, G:Labeller<'a,N,E>+GraphWalk<'a,N,E>, W:Writer>(
g: &'a G, g: &'a G,
w: &mut W) -> io::IoResult<()> { w: &mut W) -> old_io::IoResult<()> {
render_opts(g, w, &[]) render_opts(g, w, &[])
} }
@ -541,14 +541,14 @@ pub fn render<'a, N:Clone+'a, E:Clone+'a, G:Labeller<'a,N,E>+GraphWalk<'a,N,E>,
pub fn render_opts<'a, N:Clone+'a, E:Clone+'a, G:Labeller<'a,N,E>+GraphWalk<'a,N,E>, W:Writer>( pub fn render_opts<'a, N:Clone+'a, E:Clone+'a, G:Labeller<'a,N,E>+GraphWalk<'a,N,E>, W:Writer>(
g: &'a G, g: &'a G,
w: &mut W, w: &mut W,
options: &[RenderOption]) -> io::IoResult<()> options: &[RenderOption]) -> old_io::IoResult<()>
{ {
fn writeln<W:Writer>(w: &mut W, arg: &[&str]) -> io::IoResult<()> { fn writeln<W:Writer>(w: &mut W, arg: &[&str]) -> old_io::IoResult<()> {
for &s in arg.iter() { try!(w.write_str(s)); } for &s in arg.iter() { try!(w.write_str(s)); }
w.write_char('\n') w.write_char('\n')
} }
fn indent<W:Writer>(w: &mut W) -> io::IoResult<()> { fn indent<W:Writer>(w: &mut W) -> old_io::IoResult<()> {
w.write_str(" ") w.write_str(" ")
} }
@ -590,7 +590,7 @@ mod tests {
use self::NodeLabels::*; use self::NodeLabels::*;
use super::{Id, Labeller, Nodes, Edges, GraphWalk, render}; use super::{Id, Labeller, Nodes, Edges, GraphWalk, render};
use super::LabelText::{self, LabelStr, EscStr}; use super::LabelText::{self, LabelStr, EscStr};
use std::io::IoResult; use std::old_io::IoResult;
use std::borrow::IntoCow; use std::borrow::IntoCow;
use std::iter::repeat; use std::iter::repeat;

View file

@ -174,8 +174,8 @@
use std::cell::RefCell; use std::cell::RefCell;
use std::fmt; use std::fmt;
use std::io::LineBufferedWriter; use std::old_io::LineBufferedWriter;
use std::io; use std::old_io;
use std::mem; use std::mem;
use std::os; use std::os;
use std::ptr; use std::ptr;
@ -232,7 +232,7 @@ pub trait Logger {
} }
struct DefaultLogger { struct DefaultLogger {
handle: LineBufferedWriter<io::stdio::StdWriter>, handle: LineBufferedWriter<old_io::stdio::StdWriter>,
} }
/// Wraps the log level with fmt implementations. /// Wraps the log level with fmt implementations.
@ -294,7 +294,7 @@ pub fn log(level: u32, loc: &'static LogLocation, args: fmt::Arguments) {
let mut logger = LOCAL_LOGGER.with(|s| { let mut logger = LOCAL_LOGGER.with(|s| {
s.borrow_mut().take() s.borrow_mut().take()
}).unwrap_or_else(|| { }).unwrap_or_else(|| {
box DefaultLogger { handle: io::stderr() } as Box<Logger + Send> box DefaultLogger { handle: old_io::stderr() } as Box<Logger + Send>
}); });
logger.log(&LogRecord { logger.log(&LogRecord {
level: LogLevel(level), level: LogLevel(level),

View file

@ -8,8 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::io::{IoError, IoResult, SeekStyle}; use std::old_io::{IoError, IoResult, SeekStyle};
use std::io; use std::old_io;
use std::slice; use std::slice;
use std::iter::repeat; use std::iter::repeat;
@ -18,14 +18,14 @@ static BUF_CAPACITY: uint = 128;
fn combine(seek: SeekStyle, cur: uint, end: uint, offset: i64) -> IoResult<u64> { fn combine(seek: SeekStyle, cur: uint, end: uint, offset: i64) -> IoResult<u64> {
// compute offset as signed and clamp to prevent overflow // compute offset as signed and clamp to prevent overflow
let pos = match seek { let pos = match seek {
io::SeekSet => 0, old_io::SeekSet => 0,
io::SeekEnd => end, old_io::SeekEnd => end,
io::SeekCur => cur, old_io::SeekCur => cur,
} as i64; } as i64;
if offset + pos < 0 { if offset + pos < 0 {
Err(IoError { Err(IoError {
kind: io::InvalidInput, kind: old_io::InvalidInput,
desc: "invalid seek to a negative offset", desc: "invalid seek to a negative offset",
detail: None detail: None
}) })
@ -132,7 +132,7 @@ impl Seek for SeekableMemWriter {
mod tests { mod tests {
extern crate test; extern crate test;
use super::SeekableMemWriter; use super::SeekableMemWriter;
use std::io; use std::old_io;
use std::iter::repeat; use std::iter::repeat;
use test::Bencher; use test::Bencher;
@ -148,23 +148,23 @@ mod tests {
let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7]; let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7];
assert_eq!(writer.get_ref(), b); assert_eq!(writer.get_ref(), b);
writer.seek(0, io::SeekSet).unwrap(); writer.seek(0, old_io::SeekSet).unwrap();
assert_eq!(writer.tell(), Ok(0)); assert_eq!(writer.tell(), Ok(0));
writer.write(&[3, 4]).unwrap(); writer.write(&[3, 4]).unwrap();
let b: &[_] = &[3, 4, 2, 3, 4, 5, 6, 7]; let b: &[_] = &[3, 4, 2, 3, 4, 5, 6, 7];
assert_eq!(writer.get_ref(), b); assert_eq!(writer.get_ref(), b);
writer.seek(1, io::SeekCur).unwrap(); writer.seek(1, old_io::SeekCur).unwrap();
writer.write(&[0, 1]).unwrap(); writer.write(&[0, 1]).unwrap();
let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 7]; let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 7];
assert_eq!(writer.get_ref(), b); assert_eq!(writer.get_ref(), b);
writer.seek(-1, io::SeekEnd).unwrap(); writer.seek(-1, old_io::SeekEnd).unwrap();
writer.write(&[1, 2]).unwrap(); writer.write(&[1, 2]).unwrap();
let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 1, 2]; let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 1, 2];
assert_eq!(writer.get_ref(), b); assert_eq!(writer.get_ref(), b);
writer.seek(1, io::SeekEnd).unwrap(); writer.seek(1, old_io::SeekEnd).unwrap();
writer.write(&[1]).unwrap(); writer.write(&[1]).unwrap();
let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 1, 2, 0, 1]; let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 1, 2, 0, 1];
assert_eq!(writer.get_ref(), b); assert_eq!(writer.get_ref(), b);
@ -173,14 +173,14 @@ mod tests {
#[test] #[test]
fn seek_past_end() { fn seek_past_end() {
let mut r = SeekableMemWriter::new(); let mut r = SeekableMemWriter::new();
r.seek(10, io::SeekSet).unwrap(); r.seek(10, old_io::SeekSet).unwrap();
assert!(r.write(&[3]).is_ok()); assert!(r.write(&[3]).is_ok());
} }
#[test] #[test]
fn seek_before_0() { fn seek_before_0() {
let mut r = SeekableMemWriter::new(); let mut r = SeekableMemWriter::new();
assert!(r.seek(-1, io::SeekSet).is_err()); assert!(r.seek(-1, old_io::SeekSet).is_err());
} }
fn do_bench_seekable_mem_writer(b: &mut Bencher, times: uint, len: uint) { fn do_bench_seekable_mem_writer(b: &mut Bencher, times: uint, len: uint) {

View file

@ -111,7 +111,7 @@ pub enum EbmlEncoderTag {
pub enum Error { pub enum Error {
IntTooBig(uint), IntTooBig(uint),
Expected(String), Expected(String),
IoError(std::io::IoError), IoError(std::old_io::IoError),
ApplicationError(String) ApplicationError(String)
} }
@ -127,7 +127,7 @@ pub mod reader {
use std::char; use std::char;
use std::int; use std::int;
use std::io::extensions::u64_from_be_bytes; use std::old_io::extensions::u64_from_be_bytes;
use std::mem::transmute; use std::mem::transmute;
use std::num::Int; use std::num::Int;
use std::option::Option; use std::option::Option;
@ -685,9 +685,9 @@ pub mod reader {
pub mod writer { pub mod writer {
use std::clone::Clone; use std::clone::Clone;
use std::io::extensions::u64_to_be_bytes; use std::old_io::extensions::u64_to_be_bytes;
use std::io::{Writer, Seek}; use std::old_io::{Writer, Seek};
use std::io; use std::old_io;
use std::mem; use std::mem;
use super::{ EsVec, EsMap, EsEnum, EsVecLen, EsVecElt, EsMapLen, EsMapKey, use super::{ EsVec, EsMap, EsEnum, EsVecLen, EsVecElt, EsMapLen, EsMapKey,
@ -698,7 +698,7 @@ pub mod writer {
use serialize; use serialize;
pub type EncodeResult = io::IoResult<()>; pub type EncodeResult = old_io::IoResult<()>;
// rbml writing // rbml writing
pub struct Encoder<'a, W:'a> { pub struct Encoder<'a, W:'a> {
@ -714,8 +714,8 @@ pub mod writer {
n as u8]), n as u8]),
4u => w.write(&[0x10u8 | ((n >> 24_u) as u8), (n >> 16_u) as u8, 4u => w.write(&[0x10u8 | ((n >> 24_u) as u8), (n >> 16_u) as u8,
(n >> 8_u) as u8, n as u8]), (n >> 8_u) as u8, n as u8]),
_ => Err(io::IoError { _ => Err(old_io::IoError {
kind: io::OtherIoError, kind: old_io::OtherIoError,
desc: "int too big", desc: "int too big",
detail: Some(format!("{}", n)) detail: Some(format!("{}", n))
}) })
@ -727,8 +727,8 @@ pub mod writer {
if n < 0x4000_u { return write_sized_vuint(w, n, 2u); } if n < 0x4000_u { return write_sized_vuint(w, n, 2u); }
if n < 0x200000_u { return write_sized_vuint(w, n, 3u); } if n < 0x200000_u { return write_sized_vuint(w, n, 3u); }
if n < 0x10000000_u { return write_sized_vuint(w, n, 4u); } if n < 0x10000000_u { return write_sized_vuint(w, n, 4u); }
Err(io::IoError { Err(old_io::IoError {
kind: io::OtherIoError, kind: old_io::OtherIoError,
desc: "int too big", desc: "int too big",
detail: Some(format!("{}", n)) detail: Some(format!("{}", n))
}) })
@ -766,10 +766,10 @@ pub mod writer {
pub fn end_tag(&mut self) -> EncodeResult { pub fn end_tag(&mut self) -> EncodeResult {
let last_size_pos = self.size_positions.pop().unwrap(); let last_size_pos = self.size_positions.pop().unwrap();
let cur_pos = try!(self.writer.tell()); let cur_pos = try!(self.writer.tell());
try!(self.writer.seek(last_size_pos as i64, io::SeekSet)); try!(self.writer.seek(last_size_pos as i64, old_io::SeekSet));
let size = cur_pos as uint - last_size_pos - 4; let size = cur_pos as uint - last_size_pos - 4;
try!(write_sized_vuint(self.writer, size, 4u)); try!(write_sized_vuint(self.writer, size, 4u));
let r = try!(self.writer.seek(cur_pos as i64, io::SeekSet)); let r = try!(self.writer.seek(cur_pos as i64, old_io::SeekSet));
debug!("End tag (size = {:?})", size); debug!("End tag (size = {:?})", size);
Ok(r) Ok(r)
@ -883,7 +883,7 @@ pub mod writer {
} }
impl<'a, W: Writer + Seek> serialize::Encoder for Encoder<'a, W> { impl<'a, W: Writer + Seek> serialize::Encoder for Encoder<'a, W> {
type Error = io::IoError; type Error = old_io::IoError;
fn emit_nil(&mut self) -> EncodeResult { fn emit_nil(&mut self) -> EncodeResult {
Ok(()) Ok(())

View file

@ -34,8 +34,8 @@ use middle::astencode::vtable_decoder_helpers;
use std::collections::HashMap; use std::collections::HashMap;
use std::hash::{self, Hash, SipHasher}; use std::hash::{self, Hash, SipHasher};
use std::io::extensions::u64_from_be_bytes; use std::old_io::extensions::u64_from_be_bytes;
use std::io; use std::old_io;
use std::num::FromPrimitive; use std::num::FromPrimitive;
use std::rc::Rc; use std::rc::Rc;
use std::str; use std::str;
@ -1178,7 +1178,7 @@ fn get_attributes(md: rbml::Doc) -> Vec<ast::Attribute> {
} }
fn list_crate_attributes(md: rbml::Doc, hash: &Svh, fn list_crate_attributes(md: rbml::Doc, hash: &Svh,
out: &mut io::Writer) -> io::IoResult<()> { out: &mut old_io::Writer) -> old_io::IoResult<()> {
try!(write!(out, "=Crate Attributes ({})=\n", *hash)); try!(write!(out, "=Crate Attributes ({})=\n", *hash));
let r = get_attributes(md); let r = get_attributes(md);
@ -1223,7 +1223,7 @@ pub fn get_crate_deps(data: &[u8]) -> Vec<CrateDep> {
return deps; return deps;
} }
fn list_crate_deps(data: &[u8], out: &mut io::Writer) -> io::IoResult<()> { fn list_crate_deps(data: &[u8], out: &mut old_io::Writer) -> old_io::IoResult<()> {
try!(write!(out, "=External Dependencies=\n")); try!(write!(out, "=External Dependencies=\n"));
for dep in get_crate_deps(data).iter() { for dep in get_crate_deps(data).iter() {
try!(write!(out, "{} {}-{}\n", dep.cnum, dep.name, dep.hash)); try!(write!(out, "{} {}-{}\n", dep.cnum, dep.name, dep.hash));
@ -1262,7 +1262,7 @@ pub fn get_crate_name(data: &[u8]) -> String {
maybe_get_crate_name(data).expect("no crate name in crate") maybe_get_crate_name(data).expect("no crate name in crate")
} }
pub fn list_crate_metadata(bytes: &[u8], out: &mut io::Writer) -> io::IoResult<()> { pub fn list_crate_metadata(bytes: &[u8], out: &mut old_io::Writer) -> old_io::IoResult<()> {
let hash = get_crate_hash(bytes); let hash = get_crate_hash(bytes);
let md = rbml::Doc::new(bytes); let md = rbml::Doc::new(bytes);
try!(list_crate_attributes(md, &hash, out)); try!(list_crate_attributes(md, &hash, out));

View file

@ -13,8 +13,8 @@
pub use self::FileMatch::*; pub use self::FileMatch::*;
use std::collections::HashSet; use std::collections::HashSet;
use std::io::fs::PathExtensions; use std::old_io::fs::PathExtensions;
use std::io::fs; use std::old_io::fs;
use std::os; use std::os;
use util::fs as myfs; use util::fs as myfs;

View file

@ -231,8 +231,8 @@ use rustc_back::target::Target;
use std::ffi::CString; use std::ffi::CString;
use std::cmp; use std::cmp;
use std::collections::HashMap; use std::collections::HashMap;
use std::io::fs::PathExtensions; use std::old_io::fs::PathExtensions;
use std::io; use std::old_io;
use std::ptr; use std::ptr;
use std::slice; use std::slice;
use std::time::Duration; use std::time::Duration;
@ -796,7 +796,7 @@ pub fn read_meta_section_name(is_osx: bool) -> &'static str {
// A diagnostic function for dumping crate metadata to an output stream // A diagnostic function for dumping crate metadata to an output stream
pub fn list_file_metadata(is_osx: bool, path: &Path, pub fn list_file_metadata(is_osx: bool, path: &Path,
out: &mut io::Writer) -> io::IoResult<()> { out: &mut old_io::Writer) -> old_io::IoResult<()> {
match get_metadata_section(is_osx, path) { match get_metadata_section(is_osx, path) {
Ok(bytes) => decoder::list_crate_metadata(bytes.as_slice(), out), Ok(bytes) => decoder::list_crate_metadata(bytes.as_slice(), out),
Err(msg) => { Err(msg) => {

View file

@ -37,7 +37,7 @@ use syntax::parse::token;
use syntax::ptr::P; use syntax::ptr::P;
use syntax; use syntax;
use std::io::Seek; use std::old_io::Seek;
use std::rc::Rc; use std::rc::Rc;
use rbml::io::SeekableMemWriter; use rbml::io::SeekableMemWriter;

View file

@ -19,7 +19,7 @@ pub use self::EntryOrExit::*;
use middle::cfg; use middle::cfg;
use middle::cfg::CFGIndex; use middle::cfg::CFGIndex;
use middle::ty; use middle::ty;
use std::io; use std::old_io;
use std::uint; use std::uint;
use std::iter::repeat; use std::iter::repeat;
use syntax::ast; use syntax::ast;
@ -105,7 +105,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
impl<'a, 'tcx, O:DataFlowOperator> pprust::PpAnn for DataFlowContext<'a, 'tcx, O> { impl<'a, 'tcx, O:DataFlowOperator> pprust::PpAnn for DataFlowContext<'a, 'tcx, O> {
fn pre(&self, fn pre(&self,
ps: &mut pprust::State, ps: &mut pprust::State,
node: pprust::AnnNode) -> io::IoResult<()> { node: pprust::AnnNode) -> old_io::IoResult<()> {
let id = match node { let id = match node {
pprust::NodeIdent(_) | pprust::NodeName(_) => 0, pprust::NodeIdent(_) | pprust::NodeName(_) => 0,
pprust::NodeExpr(expr) => expr.id, pprust::NodeExpr(expr) => expr.id,
@ -457,13 +457,13 @@ impl<'a, 'tcx, O:DataFlowOperator+Clone+'static> DataFlowContext<'a, 'tcx, O> {
debug!("Dataflow result for {}:", self.analysis_name); debug!("Dataflow result for {}:", self.analysis_name);
debug!("{}", { debug!("{}", {
self.pretty_print_to(box io::stderr(), blk).unwrap(); self.pretty_print_to(box old_io::stderr(), blk).unwrap();
"" ""
}); });
} }
fn pretty_print_to(&self, wr: Box<io::Writer+'static>, fn pretty_print_to(&self, wr: Box<old_io::Writer+'static>,
blk: &ast::Block) -> io::IoResult<()> { blk: &ast::Block) -> old_io::IoResult<()> {
let mut ps = pprust::rust_printer_annotated(wr, self); let mut ps = pprust::rust_printer_annotated(wr, self);
try!(ps.cbox(pprust::indent_unit)); try!(ps.cbox(pprust::indent_unit));
try!(ps.ibox(0u)); try!(ps.ibox(0u));

View file

@ -26,7 +26,7 @@ use util::nodemap::{FnvHashMap, FnvHashSet};
use util::ppaux::Repr; use util::ppaux::Repr;
use std::collections::hash_map::Entry::Vacant; use std::collections::hash_map::Entry::Vacant;
use std::io::{self, File}; use std::old_io::{self, File};
use std::os; use std::os;
use std::sync::atomic::{AtomicBool, Ordering, ATOMIC_BOOL_INIT}; use std::sync::atomic::{AtomicBool, Ordering, ATOMIC_BOOL_INIT};
use syntax::ast; use syntax::ast;
@ -217,7 +217,7 @@ pub type ConstraintMap<'tcx> = FnvHashMap<Constraint, SubregionOrigin<'tcx>>;
fn dump_region_constraints_to<'a, 'tcx:'a >(tcx: &'a ty::ctxt<'tcx>, fn dump_region_constraints_to<'a, 'tcx:'a >(tcx: &'a ty::ctxt<'tcx>,
map: &ConstraintMap<'tcx>, map: &ConstraintMap<'tcx>,
path: &str) -> io::IoResult<()> { path: &str) -> old_io::IoResult<()> {
debug!("dump_region_constraints map (len: {}) path: {}", map.len(), path); debug!("dump_region_constraints map (len: {}) path: {}", map.len(), path);
let g = ConstraintGraph::new(tcx, format!("region_constraints"), map); let g = ConstraintGraph::new(tcx, format!("region_constraints"), map);
let mut f = File::create(&Path::new(path)); let mut f = File::create(&Path::new(path));

View file

@ -118,7 +118,7 @@ use middle::ty::ClosureTyper;
use lint; use lint;
use util::nodemap::NodeMap; use util::nodemap::NodeMap;
use std::{fmt, io, uint}; use std::{fmt, old_io, uint};
use std::rc::Rc; use std::rc::Rc;
use std::iter::repeat; use std::iter::repeat;
use syntax::ast::{self, NodeId, Expr}; use syntax::ast::{self, NodeId, Expr};
@ -693,10 +693,10 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
} }
fn write_vars<F>(&self, fn write_vars<F>(&self,
wr: &mut io::Writer, wr: &mut old_io::Writer,
ln: LiveNode, ln: LiveNode,
mut test: F) mut test: F)
-> io::IoResult<()> where -> old_io::IoResult<()> where
F: FnMut(uint) -> LiveNode, F: FnMut(uint) -> LiveNode,
{ {
let node_base_idx = self.idx(ln, Variable(0)); let node_base_idx = self.idx(ln, Variable(0));
@ -740,7 +740,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
fn ln_str(&self, ln: LiveNode) -> String { fn ln_str(&self, ln: LiveNode) -> String {
let mut wr = Vec::new(); let mut wr = Vec::new();
{ {
let wr = &mut wr as &mut io::Writer; let wr = &mut wr as &mut old_io::Writer;
write!(wr, "[ln({:?}) of kind {:?} reads", ln.get(), self.ir.lnk(ln)); write!(wr, "[ln({:?}) of kind {:?} reads", ln.get(), self.ir.lnk(ln));
self.write_vars(wr, ln, |idx| self.users[idx].reader); self.write_vars(wr, ln, |idx| self.users[idx].reader);
write!(wr, " writes"); write!(wr, " writes");

View file

@ -10,10 +10,10 @@
//! A helper class for dealing with static archives //! A helper class for dealing with static archives
use std::io::fs::PathExtensions; use std::old_io::fs::PathExtensions;
use std::io::process::{Command, ProcessOutput}; use std::old_io::process::{Command, ProcessOutput};
use std::io::{fs, TempDir}; use std::old_io::{fs, TempDir};
use std::io; use std::old_io;
use std::os; use std::os;
use std::str; use std::str;
use syntax::diagnostic::Handler as ErrorHandler; use syntax::diagnostic::Handler as ErrorHandler;
@ -172,7 +172,7 @@ impl<'a> ArchiveBuilder<'a> {
/// Adds all of the contents of a native library to this archive. This will /// Adds all of the contents of a native library to this archive. This will
/// search in the relevant locations for a library named `name`. /// search in the relevant locations for a library named `name`.
pub fn add_native_library(&mut self, name: &str) -> io::IoResult<()> { pub fn add_native_library(&mut self, name: &str) -> old_io::IoResult<()> {
let location = find_library(name, let location = find_library(name,
&self.archive.slib_prefix[], &self.archive.slib_prefix[],
&self.archive.slib_suffix[], &self.archive.slib_suffix[],
@ -187,7 +187,7 @@ impl<'a> ArchiveBuilder<'a> {
/// This ignores adding the bytecode from the rlib, and if LTO is enabled /// This ignores adding the bytecode from the rlib, and if LTO is enabled
/// then the object file also isn't added. /// then the object file also isn't added.
pub fn add_rlib(&mut self, rlib: &Path, name: &str, pub fn add_rlib(&mut self, rlib: &Path, name: &str,
lto: bool) -> io::IoResult<()> { lto: bool) -> old_io::IoResult<()> {
// Ignoring obj file starting with the crate name // Ignoring obj file starting with the crate name
// as simple comparison is not enough - there // as simple comparison is not enough - there
// might be also an extra name suffix // might be also an extra name suffix
@ -205,7 +205,7 @@ impl<'a> ArchiveBuilder<'a> {
} }
/// Adds an arbitrary file to this archive /// Adds an arbitrary file to this archive
pub fn add_file(&mut self, file: &Path) -> io::IoResult<()> { pub fn add_file(&mut self, file: &Path) -> old_io::IoResult<()> {
let filename = Path::new(file.filename().unwrap()); let filename = Path::new(file.filename().unwrap());
let new_file = self.work_dir.path().join(&filename); let new_file = self.work_dir.path().join(&filename);
try!(fs::copy(file, &new_file)); try!(fs::copy(file, &new_file));
@ -274,8 +274,9 @@ impl<'a> ArchiveBuilder<'a> {
self.archive self.archive
} }
fn add_archive<F>(&mut self, archive: &Path, name: &str, mut skip: F) -> io::IoResult<()> where fn add_archive<F>(&mut self, archive: &Path, name: &str,
F: FnMut(&str) -> bool, mut skip: F) -> old_io::IoResult<()>
where F: FnMut(&str) -> bool,
{ {
let loc = TempDir::new("rsar").unwrap(); let loc = TempDir::new("rsar").unwrap();

View file

@ -8,13 +8,13 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::io; use std::old_io;
use std::io::fs; use std::old_io::fs;
use std::os; use std::os;
/// Returns an absolute path in the filesystem that `path` points to. The /// Returns an absolute path in the filesystem that `path` points to. The
/// returned path does not contain any symlinks in its hierarchy. /// returned path does not contain any symlinks in its hierarchy.
pub fn realpath(original: &Path) -> io::IoResult<Path> { pub fn realpath(original: &Path) -> old_io::IoResult<Path> {
static MAX_LINKS_FOLLOWED: uint = 256; static MAX_LINKS_FOLLOWED: uint = 256;
let original = os::make_absolute(original).unwrap(); let original = os::make_absolute(original).unwrap();
@ -32,12 +32,12 @@ pub fn realpath(original: &Path) -> io::IoResult<Path> {
loop { loop {
if followed == MAX_LINKS_FOLLOWED { if followed == MAX_LINKS_FOLLOWED {
return Err(io::standard_error(io::InvalidInput)) return Err(old_io::standard_error(old_io::InvalidInput))
} }
match fs::lstat(&result) { match fs::lstat(&result) {
Err(..) => break, Err(..) => break,
Ok(ref stat) if stat.kind != io::FileType::Symlink => break, Ok(ref stat) if stat.kind != old_io::FileType::Symlink => break,
Ok(..) => { Ok(..) => {
followed += 1; followed += 1;
let path = try!(fs::readlink(&result)); let path = try!(fs::readlink(&result));
@ -53,10 +53,10 @@ pub fn realpath(original: &Path) -> io::IoResult<Path> {
#[cfg(all(not(windows), test))] #[cfg(all(not(windows), test))]
mod test { mod test {
use std::io; use std::old_io;
use std::io::fs::{File, symlink, mkdir, mkdir_recursive}; use std::old_io::fs::{File, symlink, mkdir, mkdir_recursive};
use super::realpath; use super::realpath;
use std::io::TempDir; use std::old_io::TempDir;
#[test] #[test]
fn realpath_works() { fn realpath_works() {
@ -68,7 +68,7 @@ mod test {
let linkdir = tmpdir.join("test3"); let linkdir = tmpdir.join("test3");
File::create(&file).unwrap(); File::create(&file).unwrap();
mkdir(&dir, io::USER_RWX).unwrap(); mkdir(&dir, old_io::USER_RWX).unwrap();
symlink(&file, &link).unwrap(); symlink(&file, &link).unwrap();
symlink(&dir, &linkdir).unwrap(); symlink(&dir, &linkdir).unwrap();
@ -91,8 +91,8 @@ mod test {
let e = d.join("e"); let e = d.join("e");
let f = a.join("f"); let f = a.join("f");
mkdir_recursive(&b, io::USER_RWX).unwrap(); mkdir_recursive(&b, old_io::USER_RWX).unwrap();
mkdir_recursive(&d, io::USER_RWX).unwrap(); mkdir_recursive(&d, old_io::USER_RWX).unwrap();
File::create(&f).unwrap(); File::create(&f).unwrap();
symlink(&Path::new("../d/e"), &c).unwrap(); symlink(&Path::new("../d/e"), &c).unwrap();
symlink(&Path::new("../f"), &e).unwrap(); symlink(&Path::new("../f"), &e).unwrap();

View file

@ -11,7 +11,7 @@
use std::collections::HashSet; use std::collections::HashSet;
use std::os; use std::os;
use std::io::IoError; use std::old_io::IoError;
use syntax::ast; use syntax::ast;
pub struct RPathConfig<F, G> where pub struct RPathConfig<F, G> where

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::io::{Command, IoError, OtherIoError}; use std::old_io::{Command, IoError, OtherIoError};
use target::TargetOptions; use target::TargetOptions;
use self::Arch::*; use self::Arch::*;

View file

@ -48,7 +48,7 @@
use serialize::json::Json; use serialize::json::Json;
use syntax::{diagnostic, abi}; use syntax::{diagnostic, abi};
use std::default::Default; use std::default::Default;
use std::io::fs::PathExtensions; use std::old_io::fs::PathExtensions;
mod windows_base; mod windows_base;
mod linux_base; mod linux_base;
@ -302,7 +302,7 @@ impl Target {
/// JSON decoding. /// JSON decoding.
pub fn search(target: &str) -> Result<Target, String> { pub fn search(target: &str) -> Result<Target, String> {
use std::os; use std::os;
use std::io::File; use std::old_io::File;
use std::path::Path; use std::path::Path;
use serialize::json; use serialize::json;

View file

@ -30,8 +30,8 @@ use rustc_privacy;
use serialize::json; use serialize::json;
use std::io; use std::old_io;
use std::io::fs; use std::old_io::fs;
use std::os; use std::os;
use syntax::ast; use syntax::ast;
use syntax::ast_map; use syntax::ast_map;
@ -787,14 +787,14 @@ fn write_out_deps(sess: &Session,
_ => return, _ => return,
}; };
let result = (|&:| -> io::IoResult<()> { let result = (|&:| -> old_io::IoResult<()> {
// Build a list of files used to compile the output and // Build a list of files used to compile the output and
// write Makefile-compatible dependency rules // write Makefile-compatible dependency rules
let files: Vec<String> = sess.codemap().files.borrow() let files: Vec<String> = sess.codemap().files.borrow()
.iter().filter(|fmap| fmap.is_real_file()) .iter().filter(|fmap| fmap.is_real_file())
.map(|fmap| escape_dep_filename(&fmap.name[])) .map(|fmap| escape_dep_filename(&fmap.name[]))
.collect(); .collect();
let mut file = try!(io::File::create(&deps_filename)); let mut file = try!(old_io::File::create(&deps_filename));
for path in out_filenames.iter() { for path in out_filenames.iter() {
try!(write!(&mut file as &mut Writer, try!(write!(&mut file as &mut Writer,
"{}: {}\n\n", path.display(), files.connect(" "))); "{}: {}\n\n", path.display(), files.connect(" ")));

View file

@ -64,7 +64,7 @@ use rustc::metadata::creader::CrateOrString::Str;
use rustc::util::common::time; use rustc::util::common::time;
use std::cmp::Ordering::Equal; use std::cmp::Ordering::Equal;
use std::io; use std::old_io;
use std::iter::repeat; use std::iter::repeat;
use std::os; use std::os;
use std::sync::mpsc::channel; use std::sync::mpsc::channel;
@ -133,7 +133,7 @@ fn run_compiler(args: &[String]) {
1u => { 1u => {
let ifile = &matches.free[0][]; let ifile = &matches.free[0][];
if ifile == "-" { if ifile == "-" {
let contents = io::stdin().read_to_end().unwrap(); let contents = old_io::stdin().read_to_end().unwrap();
let src = String::from_utf8(contents).unwrap(); let src = String::from_utf8(contents).unwrap();
(Input::Str(src), None) (Input::Str(src), None)
} else { } else {
@ -187,7 +187,7 @@ fn run_compiler(args: &[String]) {
if r.contains(&("ls".to_string())) { if r.contains(&("ls".to_string())) {
match input { match input {
Input::File(ref ifile) => { Input::File(ref ifile) => {
let mut stdout = io::stdout(); let mut stdout = old_io::stdout();
list_metadata(&sess, &(*ifile), &mut stdout).unwrap(); list_metadata(&sess, &(*ifile), &mut stdout).unwrap();
} }
Input::Str(_) => { Input::Str(_) => {
@ -590,7 +590,7 @@ fn parse_crate_attrs(sess: &Session, input: &Input) ->
} }
pub fn list_metadata(sess: &Session, path: &Path, pub fn list_metadata(sess: &Session, path: &Path,
out: &mut io::Writer) -> io::IoResult<()> { out: &mut old_io::Writer) -> old_io::IoResult<()> {
metadata::loader::list_file_metadata(sess.target.target.options.is_like_osx, path, out) metadata::loader::list_file_metadata(sess.target.target.options.is_like_osx, path, out)
} }
@ -603,8 +603,8 @@ pub fn monitor<F:FnOnce()+Send>(f: F) {
static STACK_SIZE: uint = 8 * 1024 * 1024; // 8MB static STACK_SIZE: uint = 8 * 1024 * 1024; // 8MB
let (tx, rx) = channel(); let (tx, rx) = channel();
let w = io::ChanWriter::new(tx); let w = old_io::ChanWriter::new(tx);
let mut r = io::ChanReader::new(rx); let mut r = old_io::ChanReader::new(rx);
let mut cfg = thread::Builder::new().name("rustc".to_string()); let mut cfg = thread::Builder::new().name("rustc".to_string());
@ -614,7 +614,7 @@ pub fn monitor<F:FnOnce()+Send>(f: F) {
cfg = cfg.stack_size(STACK_SIZE); cfg = cfg.stack_size(STACK_SIZE);
} }
match cfg.scoped(move || { std::io::stdio::set_stderr(box w); f() }).join() { match cfg.scoped(move || { std::old_io::stdio::set_stderr(box w); f() }).join() {
Ok(()) => { /* fallthrough */ } Ok(()) => { /* fallthrough */ }
Err(value) => { Err(value) => {
// Thread panicked without emitting a fatal diagnostic // Thread panicked without emitting a fatal diagnostic
@ -656,7 +656,7 @@ pub fn monitor<F:FnOnce()+Send>(f: F) {
// Panic so the process returns a failure code, but don't pollute the // Panic so the process returns a failure code, but don't pollute the
// output with some unnecessary panic messages, we've already // output with some unnecessary panic messages, we've already
// printed everything that we needed to. // printed everything that we needed to.
io::stdio::set_stderr(box io::util::NullWriter); old_io::stdio::set_stderr(box old_io::util::NullWriter);
panic!(); panic!();
} }
} }

View file

@ -38,7 +38,7 @@ use syntax::ptr::P;
use graphviz as dot; use graphviz as dot;
use std::io::{self, MemReader}; use std::old_io::{self, MemReader};
use std::option; use std::option;
use std::str::FromStr; use std::str::FromStr;
@ -208,7 +208,7 @@ impl<'ast> PrinterSupport<'ast> for IdentifiedAnnotation<'ast> {
impl<'ast> pprust::PpAnn for IdentifiedAnnotation<'ast> { impl<'ast> pprust::PpAnn for IdentifiedAnnotation<'ast> {
fn pre(&self, fn pre(&self,
s: &mut pprust::State, s: &mut pprust::State,
node: pprust::AnnNode) -> io::IoResult<()> { node: pprust::AnnNode) -> old_io::IoResult<()> {
match node { match node {
pprust::NodeExpr(_) => s.popen(), pprust::NodeExpr(_) => s.popen(),
_ => Ok(()) _ => Ok(())
@ -216,7 +216,7 @@ impl<'ast> pprust::PpAnn for IdentifiedAnnotation<'ast> {
} }
fn post(&self, fn post(&self,
s: &mut pprust::State, s: &mut pprust::State,
node: pprust::AnnNode) -> io::IoResult<()> { node: pprust::AnnNode) -> old_io::IoResult<()> {
match node { match node {
pprust::NodeIdent(_) | pprust::NodeName(_) => Ok(()), pprust::NodeIdent(_) | pprust::NodeName(_) => Ok(()),
@ -259,7 +259,7 @@ impl<'ast> PrinterSupport<'ast> for HygieneAnnotation<'ast> {
impl<'ast> pprust::PpAnn for HygieneAnnotation<'ast> { impl<'ast> pprust::PpAnn for HygieneAnnotation<'ast> {
fn post(&self, fn post(&self,
s: &mut pprust::State, s: &mut pprust::State,
node: pprust::AnnNode) -> io::IoResult<()> { node: pprust::AnnNode) -> old_io::IoResult<()> {
match node { match node {
pprust::NodeIdent(&ast::Ident { name: ast::Name(nm), ctxt }) => { pprust::NodeIdent(&ast::Ident { name: ast::Name(nm), ctxt }) => {
try!(pp::space(&mut s.s)); try!(pp::space(&mut s.s));
@ -294,7 +294,7 @@ impl<'tcx> PrinterSupport<'tcx> for TypedAnnotation<'tcx> {
impl<'tcx> pprust::PpAnn for TypedAnnotation<'tcx> { impl<'tcx> pprust::PpAnn for TypedAnnotation<'tcx> {
fn pre(&self, fn pre(&self,
s: &mut pprust::State, s: &mut pprust::State,
node: pprust::AnnNode) -> io::IoResult<()> { node: pprust::AnnNode) -> old_io::IoResult<()> {
match node { match node {
pprust::NodeExpr(_) => s.popen(), pprust::NodeExpr(_) => s.popen(),
_ => Ok(()) _ => Ok(())
@ -302,7 +302,7 @@ impl<'tcx> pprust::PpAnn for TypedAnnotation<'tcx> {
} }
fn post(&self, fn post(&self,
s: &mut pprust::State, s: &mut pprust::State,
node: pprust::AnnNode) -> io::IoResult<()> { node: pprust::AnnNode) -> old_io::IoResult<()> {
let tcx = &self.analysis.ty_cx; let tcx = &self.analysis.ty_cx;
match node { match node {
pprust::NodeExpr(expr) => { pprust::NodeExpr(expr) => {
@ -548,9 +548,9 @@ pub fn pretty_print_input(sess: Session,
let mut rdr = MemReader::new(src); let mut rdr = MemReader::new(src);
let out = match ofile { let out = match ofile {
None => box io::stdout() as Box<Writer+'static>, None => box old_io::stdout() as Box<Writer+'static>,
Some(p) => { Some(p) => {
let r = io::File::create(&p); let r = old_io::File::create(&p);
match r { match r {
Ok(w) => box w as Box<Writer+'static>, Ok(w) => box w as Box<Writer+'static>,
Err(e) => panic!("print-print failed to open {} due to {}", Err(e) => panic!("print-print failed to open {} due to {}",
@ -643,11 +643,11 @@ pub fn pretty_print_input(sess: Session,
}.unwrap() }.unwrap()
} }
fn print_flowgraph<W:io::Writer>(variants: Vec<borrowck_dot::Variant>, fn print_flowgraph<W:old_io::Writer>(variants: Vec<borrowck_dot::Variant>,
analysis: ty::CrateAnalysis, analysis: ty::CrateAnalysis,
code: blocks::Code, code: blocks::Code,
mode: PpFlowGraphMode, mode: PpFlowGraphMode,
mut out: W) -> io::IoResult<()> { mut out: W) -> old_io::IoResult<()> {
let ty_cx = &analysis.ty_cx; let ty_cx = &analysis.ty_cx;
let cfg = match code { let cfg = match code {
blocks::BlockCode(block) => cfg::CFG::new(ty_cx, &*block), blocks::BlockCode(block) => cfg::CFG::new(ty_cx, &*block),
@ -687,11 +687,11 @@ fn print_flowgraph<W:io::Writer>(variants: Vec<borrowck_dot::Variant>,
} }
} }
fn expand_err_details(r: io::IoResult<()>) -> io::IoResult<()> { fn expand_err_details(r: old_io::IoResult<()>) -> old_io::IoResult<()> {
r.map_err(|ioerr| { r.map_err(|ioerr| {
let orig_detail = ioerr.detail.clone(); let orig_detail = ioerr.detail.clone();
let m = "graphviz::render failed"; let m = "graphviz::render failed";
io::IoError { old_io::IoError {
detail: Some(match orig_detail { detail: Some(match orig_detail {
None => m.to_string(), None => m.to_string(),
Some(d) => format!("{}: {}", m, d) Some(d) => format!("{}: {}", m, d)

View file

@ -27,9 +27,9 @@ use util::common::time;
use util::ppaux; use util::ppaux;
use util::sha2::{Digest, Sha256}; use util::sha2::{Digest, Sha256};
use std::io::fs::PathExtensions; use std::old_io::fs::PathExtensions;
use std::io::{fs, TempDir, Command}; use std::old_io::{fs, TempDir, Command};
use std::io; use std::old_io;
use std::mem; use std::mem;
use std::str; use std::str;
use std::string::String; use std::string::String;
@ -425,7 +425,7 @@ pub fn invalid_output_for_target(sess: &Session,
fn is_writeable(p: &Path) -> bool { fn is_writeable(p: &Path) -> bool {
match p.stat() { match p.stat() {
Err(..) => true, Err(..) => true,
Ok(m) => m.perm & io::USER_WRITE == io::USER_WRITE Ok(m) => m.perm & old_io::USER_WRITE == old_io::USER_WRITE
} }
} }
@ -671,7 +671,7 @@ fn link_rlib<'a>(sess: &'a Session,
fn write_rlib_bytecode_object_v1<T: Writer>(writer: &mut T, fn write_rlib_bytecode_object_v1<T: Writer>(writer: &mut T,
bc_data_deflated: &[u8]) bc_data_deflated: &[u8])
-> ::std::io::IoResult<()> { -> ::std::old_io::IoResult<()> {
let bc_data_deflated_size: u64 = bc_data_deflated.len() as u64; let bc_data_deflated_size: u64 = bc_data_deflated.len() as u64;
try! { writer.write(RLIB_BYTECODE_OBJECT_MAGIC) }; try! { writer.write(RLIB_BYTECODE_OBJECT_MAGIC) };
@ -1201,7 +1201,7 @@ fn add_upstream_rust_crates(cmd: &mut Command, sess: &Session,
// Fix up permissions of the copy, as fs::copy() preserves // Fix up permissions of the copy, as fs::copy() preserves
// permissions, but the original file may have been installed // permissions, but the original file may have been installed
// by a package manager and may be read-only. // by a package manager and may be read-only.
match fs::chmod(&dst, io::USER_READ | io::USER_WRITE) { match fs::chmod(&dst, old_io::USER_READ | old_io::USER_WRITE) {
Ok(..) => {} Ok(..) => {}
Err(e) => { Err(e) => {
sess.err(&format!("failed to chmod {} when preparing \ sess.err(&format!("failed to chmod {} when preparing \

View file

@ -23,8 +23,8 @@ use syntax::diagnostic;
use syntax::diagnostic::{Emitter, Handler, Level, mk_handler}; use syntax::diagnostic::{Emitter, Handler, Level, mk_handler};
use std::ffi::{self, CString}; use std::ffi::{self, CString};
use std::io::Command; use std::old_io::Command;
use std::io::fs; use std::old_io::fs;
use std::iter::Unfold; use std::iter::Unfold;
use std::ptr; use std::ptr;
use std::str; use std::str;
@ -728,9 +728,9 @@ pub fn run_passes(sess: &Session,
println!("{:?}", &cmd); println!("{:?}", &cmd);
} }
cmd.stdin(::std::io::process::Ignored) cmd.stdin(::std::old_io::process::Ignored)
.stdout(::std::io::process::InheritFd(1)) .stdout(::std::old_io::process::InheritFd(1))
.stderr(::std::io::process::InheritFd(2)); .stderr(::std::old_io::process::InheritFd(2));
match cmd.status() { match cmd.status() {
Ok(status) => { Ok(status) => {
if !status.success() { if !status.success() {

View file

@ -33,7 +33,7 @@ use middle::def;
use middle::ty::{self, Ty}; use middle::ty::{self, Ty};
use std::cell::Cell; use std::cell::Cell;
use std::io::{self, File, fs}; use std::old_io::{self, File, fs};
use std::os; use std::os;
use syntax::ast_util::{self, PostExpansionMethod}; use syntax::ast_util::{self, PostExpansionMethod};
@ -1532,7 +1532,7 @@ pub fn process_crate(sess: &Session,
}, },
}; };
match fs::mkdir_recursive(&root_path, io::USER_RWX) { match fs::mkdir_recursive(&root_path, old_io::USER_RWX) {
Err(e) => sess.err(&format!("Could not create directory {}: {}", Err(e) => sess.err(&format!("Could not create directory {}: {}",
root_path.display(), e)[]), root_path.display(), e)[]),
_ => (), _ => (),

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::{io, str}; use std::{old_io, str};
#[derive(Clone)] #[derive(Clone)]
pub struct ExternalHtml{ pub struct ExternalHtml{
@ -33,8 +33,8 @@ impl ExternalHtml {
} }
} }
pub fn load_string(input: &Path) -> io::IoResult<Option<String>> { pub fn load_string(input: &Path) -> old_io::IoResult<Option<String>> {
let mut f = try!(io::File::open(input)); let mut f = try!(old_io::File::open(input));
let d = try!(f.read_to_end()); let d = try!(f.read_to_end());
Ok(str::from_utf8(d.as_slice()).map(|s| s.to_string()).ok()) Ok(str::from_utf8(d.as_slice()).map(|s| s.to_string()).ok())
} }
@ -45,12 +45,12 @@ macro_rules! load_or_return {
let input = Path::new($input); let input = Path::new($input);
match ::externalfiles::load_string(&input) { match ::externalfiles::load_string(&input) {
Err(e) => { Err(e) => {
let _ = writeln!(&mut io::stderr(), let _ = writeln!(&mut old_io::stderr(),
"error reading `{}`: {}", input.display(), e); "error reading `{}`: {}", input.display(), e);
return $cant_read; return $cant_read;
} }
Ok(None) => { Ok(None) => {
let _ = writeln!(&mut io::stderr(), let _ = writeln!(&mut old_io::stderr(),
"error reading `{}`: not UTF-8", input.display()); "error reading `{}`: not UTF-8", input.display());
return $not_utf8; return $not_utf8;
} }

View file

@ -15,7 +15,7 @@
use html::escape::Escape; use html::escape::Escape;
use std::io; use std::old_io;
use syntax::parse::lexer; use syntax::parse::lexer;
use syntax::parse::token; use syntax::parse::token;
use syntax::parse; use syntax::parse;
@ -46,7 +46,7 @@ pub fn highlight(src: &str, class: Option<&str>, id: Option<&str>) -> String {
/// source. /// source.
fn doit(sess: &parse::ParseSess, mut lexer: lexer::StringReader, fn doit(sess: &parse::ParseSess, mut lexer: lexer::StringReader,
class: Option<&str>, id: Option<&str>, class: Option<&str>, id: Option<&str>,
out: &mut Writer) -> io::IoResult<()> { out: &mut Writer) -> old_io::IoResult<()> {
use syntax::parse::lexer::Reader; use syntax::parse::lexer::Reader;
try!(write!(out, "<pre ")); try!(write!(out, "<pre "));

View file

@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
use std::fmt; use std::fmt;
use std::io; use std::old_io;
use externalfiles::ExternalHtml; use externalfiles::ExternalHtml;
@ -31,8 +31,8 @@ pub struct Page<'a> {
} }
pub fn render<T: fmt::Display, S: fmt::Display>( pub fn render<T: fmt::Display, S: fmt::Display>(
dst: &mut io::Writer, layout: &Layout, page: &Page, sidebar: &S, t: &T) dst: &mut old_io::Writer, layout: &Layout, page: &Page, sidebar: &S, t: &T)
-> io::IoResult<()> -> old_io::IoResult<()>
{ {
write!(dst, write!(dst,
r##"<!DOCTYPE html> r##"<!DOCTYPE html>
@ -159,7 +159,7 @@ r##"<!DOCTYPE html>
) )
} }
pub fn redirect(dst: &mut io::Writer, url: &str) -> io::IoResult<()> { pub fn redirect(dst: &mut old_io::Writer, url: &str) -> old_io::IoResult<()> {
// <script> triggers a redirect before refresh, so this is fine. // <script> triggers a redirect before refresh, so this is fine.
write!(dst, write!(dst,
r##"<!DOCTYPE html> r##"<!DOCTYPE html>

View file

@ -39,9 +39,9 @@ use std::cmp::Ordering;
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
use std::default::Default; use std::default::Default;
use std::fmt; use std::fmt;
use std::io::fs::PathExtensions; use std::old_io::fs::PathExtensions;
use std::io::{fs, File, BufferedWriter, BufferedReader}; use std::old_io::{fs, File, BufferedWriter, BufferedReader};
use std::io; use std::old_io;
use std::iter::repeat; use std::iter::repeat;
use std::str; use std::str;
use std::sync::Arc; use std::sync::Arc;
@ -257,7 +257,7 @@ thread_local!(pub static CURRENT_LOCATION_KEY: RefCell<Vec<String>> =
pub fn run(mut krate: clean::Crate, pub fn run(mut krate: clean::Crate,
external_html: &ExternalHtml, external_html: &ExternalHtml,
dst: Path, dst: Path,
passes: HashSet<String>) -> io::IoResult<()> { passes: HashSet<String>) -> old_io::IoResult<()> {
let mut cx = Context { let mut cx = Context {
dst: dst, dst: dst,
src_root: krate.src.dir_path(), src_root: krate.src.dir_path(),
@ -391,7 +391,7 @@ pub fn run(mut krate: clean::Crate,
cx.krate(krate, summary) cx.krate(krate, summary)
} }
fn build_index(krate: &clean::Crate, cache: &mut Cache) -> io::IoResult<String> { fn build_index(krate: &clean::Crate, cache: &mut Cache) -> old_io::IoResult<String> {
// Build the search index from the collected metadata // Build the search index from the collected metadata
let mut nodeid_to_pathid = HashMap::new(); let mut nodeid_to_pathid = HashMap::new();
let mut pathid_to_nodeid = Vec::new(); let mut pathid_to_nodeid = Vec::new();
@ -485,7 +485,7 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> io::IoResult<String>
fn write_shared(cx: &Context, fn write_shared(cx: &Context,
krate: &clean::Crate, krate: &clean::Crate,
cache: &Cache, cache: &Cache,
search_index: String) -> io::IoResult<()> { search_index: String) -> old_io::IoResult<()> {
// Write out the shared files. Note that these are shared among all rustdoc // Write out the shared files. Note that these are shared among all rustdoc
// docs placed in the output directory, so this needs to be a synchronized // docs placed in the output directory, so this needs to be a synchronized
// operation with respect to all other rustdocs running around. // operation with respect to all other rustdocs running around.
@ -517,7 +517,7 @@ fn write_shared(cx: &Context,
include_bytes!("static/SourceCodePro-Semibold.woff"))); include_bytes!("static/SourceCodePro-Semibold.woff")));
fn collect(path: &Path, krate: &str, fn collect(path: &Path, krate: &str,
key: &str) -> io::IoResult<Vec<String>> { key: &str) -> old_io::IoResult<Vec<String>> {
let mut ret = Vec::new(); let mut ret = Vec::new();
if path.exists() { if path.exists() {
for line in BufferedReader::new(File::open(path)).lines() { for line in BufferedReader::new(File::open(path)).lines() {
@ -607,7 +607,7 @@ fn write_shared(cx: &Context,
} }
fn render_sources(cx: &mut Context, fn render_sources(cx: &mut Context,
krate: clean::Crate) -> io::IoResult<clean::Crate> { krate: clean::Crate) -> old_io::IoResult<clean::Crate> {
info!("emitting source files"); info!("emitting source files");
let dst = cx.dst.join("src"); let dst = cx.dst.join("src");
try!(mkdir(&dst)); try!(mkdir(&dst));
@ -625,15 +625,15 @@ fn render_sources(cx: &mut Context,
/// Writes the entire contents of a string to a destination, not attempting to /// Writes the entire contents of a string to a destination, not attempting to
/// catch any errors. /// catch any errors.
fn write(dst: Path, contents: &[u8]) -> io::IoResult<()> { fn write(dst: Path, contents: &[u8]) -> old_io::IoResult<()> {
File::create(&dst).write(contents) File::create(&dst).write(contents)
} }
/// Makes a directory on the filesystem, failing the task if an error occurs and /// Makes a directory on the filesystem, failing the task if an error occurs and
/// skipping if the directory already exists. /// skipping if the directory already exists.
fn mkdir(path: &Path) -> io::IoResult<()> { fn mkdir(path: &Path) -> old_io::IoResult<()> {
if !path.exists() { if !path.exists() {
fs::mkdir(path, io::USER_RWX) fs::mkdir(path, old_io::USER_RWX)
} else { } else {
Ok(()) Ok(())
} }
@ -736,7 +736,7 @@ impl<'a> DocFolder for SourceCollector<'a> {
impl<'a> SourceCollector<'a> { impl<'a> SourceCollector<'a> {
/// Renders the given filename into its corresponding HTML source file. /// Renders the given filename into its corresponding HTML source file.
fn emit_source(&mut self, filename: &str) -> io::IoResult<()> { fn emit_source(&mut self, filename: &str) -> old_io::IoResult<()> {
let p = Path::new(filename); let p = Path::new(filename);
// If we couldn't open this file, then just returns because it // If we couldn't open this file, then just returns because it
@ -1084,7 +1084,7 @@ impl Context {
/// This currently isn't parallelized, but it'd be pretty easy to add /// This currently isn't parallelized, but it'd be pretty easy to add
/// parallelization to this function. /// parallelization to this function.
fn krate(mut self, mut krate: clean::Crate, fn krate(mut self, mut krate: clean::Crate,
stability: stability_summary::ModuleSummary) -> io::IoResult<()> { stability: stability_summary::ModuleSummary) -> old_io::IoResult<()> {
let mut item = match krate.module.take() { let mut item = match krate.module.take() {
Some(i) => i, Some(i) => i,
None => return Ok(()) None => return Ok(())
@ -1134,11 +1134,11 @@ impl Context {
/// all sub-items which need to be rendered. /// all sub-items which need to be rendered.
/// ///
/// The rendering driver uses this closure to queue up more work. /// The rendering driver uses this closure to queue up more work.
fn item<F>(&mut self, item: clean::Item, mut f: F) -> io::IoResult<()> where fn item<F>(&mut self, item: clean::Item, mut f: F) -> old_io::IoResult<()> where
F: FnMut(&mut Context, clean::Item), F: FnMut(&mut Context, clean::Item),
{ {
fn render(w: io::File, cx: &Context, it: &clean::Item, fn render(w: old_io::File, cx: &Context, it: &clean::Item,
pushname: bool) -> io::IoResult<()> { pushname: bool) -> old_io::IoResult<()> {
info!("Rendering an item to {}", w.path().display()); info!("Rendering an item to {}", w.path().display());
// A little unfortunate that this is done like this, but it sure // A little unfortunate that this is done like this, but it sure
// does make formatting *a lot* nicer. // does make formatting *a lot* nicer.

View file

@ -38,8 +38,8 @@ extern crate "serialize" as rustc_serialize; // used by deriving
use std::cell::RefCell; use std::cell::RefCell;
use std::collections::HashMap; use std::collections::HashMap;
use std::io::File; use std::old_io::File;
use std::io; use std::old_io;
use std::rc::Rc; use std::rc::Rc;
use externalfiles::ExternalHtml; use externalfiles::ExternalHtml;
use serialize::Decodable; use serialize::Decodable;
@ -476,7 +476,7 @@ fn json_input(input: &str) -> Result<Output, String> {
/// Outputs the crate/plugin json as a giant json blob at the specified /// Outputs the crate/plugin json as a giant json blob at the specified
/// destination. /// destination.
fn json_output(krate: clean::Crate, res: Vec<plugins::PluginJson> , fn json_output(krate: clean::Crate, res: Vec<plugins::PluginJson> ,
dst: Path) -> io::IoResult<()> { dst: Path) -> old_io::IoResult<()> {
// { // {
// "schema": version, // "schema": version,
// "crate": { parsed crate ... }, // "crate": { parsed crate ... },

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::io; use std::old_io;
use core; use core;
use getopts; use getopts;
@ -59,9 +59,9 @@ pub fn render(input: &str, mut output: Path, matches: &getopts::Matches,
} }
let playground = playground.unwrap_or("".to_string()); let playground = playground.unwrap_or("".to_string());
let mut out = match io::File::create(&output) { let mut out = match old_io::File::create(&output) {
Err(e) => { Err(e) => {
let _ = writeln!(&mut io::stderr(), let _ = writeln!(&mut old_io::stderr(),
"error opening `{}` for writing: {}", "error opening `{}` for writing: {}",
output.display(), e); output.display(), e);
return 4; return 4;
@ -71,7 +71,7 @@ pub fn render(input: &str, mut output: Path, matches: &getopts::Matches,
let (metadata, text) = extract_leading_metadata(input_str.as_slice()); let (metadata, text) = extract_leading_metadata(input_str.as_slice());
if metadata.len() == 0 { if metadata.len() == 0 {
let _ = writeln!(&mut io::stderr(), let _ = writeln!(&mut old_io::stderr(),
"invalid markdown file: expecting initial line with `% ...TITLE...`"); "invalid markdown file: expecting initial line with `% ...TITLE...`");
return 5; return 5;
} }
@ -126,7 +126,7 @@ pub fn render(input: &str, mut output: Path, matches: &getopts::Matches,
match err { match err {
Err(e) => { Err(e) => {
let _ = writeln!(&mut io::stderr(), let _ = writeln!(&mut old_io::stderr(),
"error writing to `{}`: {}", "error writing to `{}`: {}",
output.display(), e); output.display(), e);
6 6

View file

@ -11,8 +11,8 @@
use std::cell::RefCell; use std::cell::RefCell;
use std::sync::mpsc::channel; use std::sync::mpsc::channel;
use std::dynamic_lib::DynamicLibrary; use std::dynamic_lib::DynamicLibrary;
use std::io::{Command, TempDir}; use std::old_io::{Command, TempDir};
use std::io; use std::old_io;
use std::os; use std::os;
use std::str; use std::str;
use std::thread::Thread; use std::thread::Thread;
@ -145,20 +145,20 @@ fn runtest(test: &str, cratename: &str, libs: SearchPaths,
// The basic idea is to not use a default_handler() for rustc, and then also // The basic idea is to not use a default_handler() for rustc, and then also
// not print things by default to the actual stderr. // not print things by default to the actual stderr.
let (tx, rx) = channel(); let (tx, rx) = channel();
let w1 = io::ChanWriter::new(tx); let w1 = old_io::ChanWriter::new(tx);
let w2 = w1.clone(); let w2 = w1.clone();
let old = io::stdio::set_stderr(box w1); let old = old_io::stdio::set_stderr(box w1);
Thread::spawn(move |:| { Thread::spawn(move |:| {
let mut p = io::ChanReader::new(rx); let mut p = old_io::ChanReader::new(rx);
let mut err = match old { let mut err = match old {
Some(old) => { Some(old) => {
// Chop off the `Send` bound. // Chop off the `Send` bound.
let old: Box<Writer> = old; let old: Box<Writer> = old;
old old
} }
None => box io::stderr() as Box<Writer>, None => box old_io::stderr() as Box<Writer>,
}; };
io::util::copy(&mut p, &mut err).unwrap(); old_io::util::copy(&mut p, &mut err).unwrap();
}); });
let emitter = diagnostic::EmitterWriter::new(box w2, None); let emitter = diagnostic::EmitterWriter::new(box w2, None);
@ -200,7 +200,7 @@ fn runtest(test: &str, cratename: &str, libs: SearchPaths,
match cmd.output() { match cmd.output() {
Err(e) => panic!("couldn't run the test: {}{}", e, Err(e) => panic!("couldn't run the test: {}{}", e,
if e.kind == io::PermissionDenied { if e.kind == old_io::PermissionDenied {
" - maybe your tempdir is mounted with noexec?" " - maybe your tempdir is mounted with noexec?"
} else { "" }), } else { "" }),
Ok(out) => { Ok(out) => {

View file

@ -201,7 +201,7 @@ use self::InternalStackElement::*;
use std; use std;
use std::collections::{HashMap, BTreeMap}; use std::collections::{HashMap, BTreeMap};
use std::{char, f64, fmt, io, num, str}; use std::{char, f64, fmt, old_io, num, str};
use std::mem::{swap}; use std::mem::{swap};
use std::num::{Float, Int}; use std::num::{Float, Int};
use std::num::FpCategory as Fp; use std::num::FpCategory as Fp;
@ -260,7 +260,7 @@ pub enum ErrorCode {
pub enum ParserError { pub enum ParserError {
/// msg, line, col /// msg, line, col
SyntaxError(ErrorCode, uint, uint), SyntaxError(ErrorCode, uint, uint),
IoError(io::IoErrorKind, &'static str), IoError(old_io::IoErrorKind, &'static str),
} }
// Builder and Parser have the same errors. // Builder and Parser have the same errors.
@ -331,7 +331,7 @@ impl fmt::Display for ErrorCode {
} }
} }
fn io_error_to_error(io: io::IoError) -> ParserError { fn io_error_to_error(io: old_io::IoError) -> ParserError {
IoError(io.kind, io.desc) IoError(io.kind, io.desc)
} }
@ -2057,8 +2057,8 @@ impl<T: Iterator<Item=char>> Builder<T> {
} }
} }
/// Decodes a json value from an `&mut io::Reader` /// Decodes a json value from an `&mut old_io::Reader`
pub fn from_reader(rdr: &mut io::Reader) -> Result<Json, BuilderError> { pub fn from_reader(rdr: &mut old_io::Reader) -> Result<Json, BuilderError> {
let contents = match rdr.read_to_end() { let contents = match rdr.read_to_end() {
Ok(c) => c, Ok(c) => c,
Err(e) => return Err(io_error_to_error(e)) Err(e) => return Err(io_error_to_error(e))
@ -2618,7 +2618,7 @@ mod tests {
use super::JsonEvent::*; use super::JsonEvent::*;
use super::{Json, from_str, DecodeResult, DecoderError, JsonEvent, Parser, use super::{Json, from_str, DecodeResult, DecoderError, JsonEvent, Parser,
StackElement, Stack, Decoder, Encoder, EncoderError}; StackElement, Stack, Decoder, Encoder, EncoderError};
use std::{i64, u64, f32, f64, io}; use std::{i64, u64, f32, f64, old_io};
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::num::Float; use std::num::Float;
use std::string; use std::string;
@ -3456,7 +3456,7 @@ mod tests {
#[test] #[test]
fn test_encode_hashmap_with_numeric_key() { fn test_encode_hashmap_with_numeric_key() {
use std::str::from_utf8; use std::str::from_utf8;
use std::io::Writer; use std::old_io::Writer;
use std::collections::HashMap; use std::collections::HashMap;
let mut hm: HashMap<uint, bool> = HashMap::new(); let mut hm: HashMap<uint, bool> = HashMap::new();
hm.insert(1, true); hm.insert(1, true);
@ -3472,7 +3472,7 @@ mod tests {
#[test] #[test]
fn test_prettyencode_hashmap_with_numeric_key() { fn test_prettyencode_hashmap_with_numeric_key() {
use std::str::from_utf8; use std::str::from_utf8;
use std::io::Writer; use std::old_io::Writer;
use std::collections::HashMap; use std::collections::HashMap;
let mut hm: HashMap<uint, bool> = HashMap::new(); let mut hm: HashMap<uint, bool> = HashMap::new();
hm.insert(1, true); hm.insert(1, true);
@ -3929,7 +3929,7 @@ mod tests {
#[test] #[test]
fn test_encode_hashmap_with_arbitrary_key() { fn test_encode_hashmap_with_arbitrary_key() {
use std::str::from_utf8; use std::str::from_utf8;
use std::io::Writer; use std::old_io::Writer;
use std::collections::HashMap; use std::collections::HashMap;
use std::fmt; use std::fmt;
#[derive(PartialEq, Eq, Hash, RustcEncodable)] #[derive(PartialEq, Eq, Hash, RustcEncodable)]

View file

@ -14,12 +14,12 @@ use prelude::v1::*;
use any::Any; use any::Any;
use cell::RefCell; use cell::RefCell;
use io::IoResult; use old_io::IoResult;
use rt::{backtrace, unwind}; use rt::{backtrace, unwind};
use rt::util::{Stderr, Stdio}; use rt::util::{Stderr, Stdio};
use thread::Thread; use thread::Thread;
// Defined in this module instead of io::stdio so that the unwinding // Defined in this module instead of old_io::stdio so that the unwinding
thread_local! { thread_local! {
pub static LOCAL_STDERR: RefCell<Option<Box<Writer + Send>>> = { pub static LOCAL_STDERR: RefCell<Option<Box<Writer + Send>>> = {
RefCell::new(None) RefCell::new(None)

View file

@ -238,7 +238,7 @@
//! //!
//! ```ignore //! ```ignore
//! format! // described above //! format! // described above
//! write! // first argument is a &mut io::Writer, the destination //! write! // first argument is a &mut old_io::Writer, the destination
//! writeln! // same as write but appends a newline //! writeln! // same as write but appends a newline
//! print! // the format string is printed to the standard output //! print! // the format string is printed to the standard output
//! println! // same as print but appends a newline //! println! // same as print but appends a newline
@ -255,10 +255,8 @@
//! //!
//! ```rust //! ```rust
//! # #![allow(unused_must_use)] //! # #![allow(unused_must_use)]
//! use std::io;
//!
//! let mut w = Vec::new(); //! let mut w = Vec::new();
//! write!(&mut w as &mut io::Writer, "Hello {}!", "world"); //! write!(&mut w, "Hello {}!", "world");
//! ``` //! ```
//! //!
//! #### `print!` //! #### `print!`
@ -282,15 +280,15 @@
//! //!
//! ``` //! ```
//! use std::fmt; //! use std::fmt;
//! use std::io; //! use std::old_io;
//! //!
//! fmt::format(format_args!("this returns {}", "String")); //! fmt::format(format_args!("this returns {}", "String"));
//! //!
//! let some_writer: &mut io::Writer = &mut io::stdout(); //! let mut some_writer = old_io::stdout();
//! write!(some_writer, "{}", format_args!("print with a {}", "macro")); //! write!(&mut some_writer, "{}", format_args!("print with a {}", "macro"));
//! //!
//! fn my_fmt_fn(args: fmt::Arguments) { //! fn my_fmt_fn(args: fmt::Arguments) {
//! write!(&mut io::stdout(), "{}", args); //! write!(&mut old_io::stdout(), "{}", args);
//! } //! }
//! my_fmt_fn(format_args!("or a {} too", "function")); //! my_fmt_fn(format_args!("or a {} too", "function"));
//! ``` //! ```

View file

@ -81,14 +81,14 @@ macro_rules! format {
#[macro_export] #[macro_export]
#[stable] #[stable]
macro_rules! print { macro_rules! print {
($($arg:tt)*) => ($crate::io::stdio::print_args(format_args!($($arg)*))) ($($arg:tt)*) => ($crate::old_io::stdio::print_args(format_args!($($arg)*)))
} }
/// Macro for printing to a task's stdout handle. /// Macro for printing to a task's stdout handle.
/// ///
/// Each task can override its stdout handle via `std::io::stdio::set_stdout`. /// Each task can override its stdout handle via `std::old_io::stdio::set_stdout`.
/// The syntax of this macro is the same as that used for `format!`. For more /// The syntax of this macro is the same as that used for `format!`. For more
/// information, see `std::fmt` and `std::io::stdio`. /// information, see `std::fmt` and `std::old_io::stdio`.
/// ///
/// # Example /// # Example
/// ///
@ -99,7 +99,7 @@ macro_rules! print {
#[macro_export] #[macro_export]
#[stable] #[stable]
macro_rules! println { macro_rules! println {
($($arg:tt)*) => ($crate::io::stdio::println_args(format_args!($($arg)*))) ($($arg:tt)*) => ($crate::old_io::stdio::println_args(format_args!($($arg)*)))
} }
/// Helper macro for unwrapping `Result` values while returning early with an /// Helper macro for unwrapping `Result` values while returning early with an

View file

@ -423,7 +423,7 @@ impl<S: Stream> Writer for BufferedStream<S> {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
extern crate test; extern crate test;
use io; use old_io;
use prelude::v1::*; use prelude::v1::*;
use super::*; use super::*;
use super::super::{IoResult, EndOfFile}; use super::super::{IoResult, EndOfFile};

View file

@ -160,7 +160,7 @@ mod test {
use sync::mpsc::channel; use sync::mpsc::channel;
use super::*; use super::*;
use io; use old_io;
use thread::Thread; use thread::Thread;
#[test] #[test]

View file

@ -178,7 +178,7 @@ pub fn u64_from_be_bytes(data: &[u8], start: uint, size: uint) -> u64 {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use prelude::v1::*; use prelude::v1::*;
use io; use old_io;
use old_io::{MemReader, BytesReader}; use old_io::{MemReader, BytesReader};
struct InitialZeroByteReader { struct InitialZeroByteReader {

View file

@ -407,7 +407,7 @@ pub fn copy(from: &Path, to: &Path) -> IoResult<()> {
/// ///
/// ```rust /// ```rust
/// # #![allow(unused_must_use)] /// # #![allow(unused_must_use)]
/// use std::io; /// use std::old_io;
/// use std::old_io::fs; /// use std::old_io::fs;
/// ///
/// fs::chmod(&Path::new("file.txt"), old_io::USER_FILE); /// fs::chmod(&Path::new("file.txt"), old_io::USER_FILE);
@ -469,7 +469,7 @@ pub fn readlink(path: &Path) -> IoResult<Path> {
/// ///
/// ```rust /// ```rust
/// # #![allow(unused_must_use)] /// # #![allow(unused_must_use)]
/// use std::io; /// use std::old_io;
/// use std::old_io::fs; /// use std::old_io::fs;
/// ///
/// let p = Path::new("/some/dir"); /// let p = Path::new("/some/dir");
@ -515,7 +515,7 @@ pub fn rmdir(path: &Path) -> IoResult<()> {
/// ```rust /// ```rust
/// use std::old_io::fs::PathExtensions; /// use std::old_io::fs::PathExtensions;
/// use std::old_io::fs; /// use std::old_io::fs;
/// use std::io; /// use std::old_io;
/// ///
/// // one possible implementation of fs::walk_dir only visiting files /// // one possible implementation of fs::walk_dir only visiting files
/// fn visit_dirs<F>(dir: &Path, cb: &mut F) -> old_io::IoResult<()> where /// fn visit_dirs<F>(dir: &Path, cb: &mut F) -> old_io::IoResult<()> where
@ -825,7 +825,7 @@ fn access_string(access: FileAccess) -> &'static str {
mod test { mod test {
use prelude::v1::*; use prelude::v1::*;
use old_io::{SeekSet, SeekCur, SeekEnd, Read, Open, ReadWrite, FileType}; use old_io::{SeekSet, SeekCur, SeekEnd, Read, Open, ReadWrite, FileType};
use io; use old_io;
use str; use str;
use old_io::fs::*; use old_io::fs::*;

View file

@ -393,7 +393,7 @@ mod test {
use old_io::{SeekSet, SeekCur, SeekEnd, Reader, Writer, Seek}; use old_io::{SeekSet, SeekCur, SeekEnd, Reader, Writer, Seek};
use prelude::v1::{Ok, Err, range, Vec, Buffer, AsSlice, SliceExt}; use prelude::v1::{Ok, Err, range, Vec, Buffer, AsSlice, SliceExt};
use prelude::v1::IteratorExt; use prelude::v1::IteratorExt;
use io; use old_io;
use iter::repeat; use iter::repeat;
use self::test_crate::Bencher; use self::test_crate::Bencher;
use super::*; use super::*;

View file

@ -80,11 +80,11 @@ impl<T, A: Acceptor<T>> Acceptor<T> for IoResult<A> {
mod test { mod test {
use prelude::v1::*; use prelude::v1::*;
use super::super::mem::*; use super::super::mem::*;
use io; use old_io;
#[test] #[test]
fn test_option_writer() { fn test_option_writer() {
let mut writer: io::IoResult<Vec<u8>> = Ok(Vec::new()); let mut writer: old_io::IoResult<Vec<u8>> = Ok(Vec::new());
writer.write(&[0, 1, 2]).unwrap(); writer.write(&[0, 1, 2]).unwrap();
writer.flush().unwrap(); writer.flush().unwrap();
assert_eq!(writer.unwrap(), vec!(0, 1, 2)); assert_eq!(writer.unwrap(), vec!(0, 1, 2));
@ -92,22 +92,22 @@ mod test {
#[test] #[test]
fn test_option_writer_error() { fn test_option_writer_error() {
let mut writer: io::IoResult<Vec<u8>> = let mut writer: old_io::IoResult<Vec<u8>> =
Err(io::standard_error(io::EndOfFile)); Err(old_io::standard_error(old_io::EndOfFile));
match writer.write(&[0, 0, 0]) { match writer.write(&[0, 0, 0]) {
Ok(..) => panic!(), Ok(..) => panic!(),
Err(e) => assert_eq!(e.kind, io::EndOfFile), Err(e) => assert_eq!(e.kind, old_io::EndOfFile),
} }
match writer.flush() { match writer.flush() {
Ok(..) => panic!(), Ok(..) => panic!(),
Err(e) => assert_eq!(e.kind, io::EndOfFile), Err(e) => assert_eq!(e.kind, old_io::EndOfFile),
} }
} }
#[test] #[test]
fn test_option_reader() { fn test_option_reader() {
let mut reader: io::IoResult<MemReader> = let mut reader: old_io::IoResult<MemReader> =
Ok(MemReader::new(vec!(0, 1, 2, 3))); Ok(MemReader::new(vec!(0, 1, 2, 3)));
let mut buf = [0, 0]; let mut buf = [0, 0];
reader.read(&mut buf).unwrap(); reader.read(&mut buf).unwrap();
@ -117,13 +117,13 @@ mod test {
#[test] #[test]
fn test_option_reader_error() { fn test_option_reader_error() {
let mut reader: io::IoResult<MemReader> = let mut reader: old_io::IoResult<MemReader> =
Err(io::standard_error(io::EndOfFile)); Err(old_io::standard_error(old_io::EndOfFile));
let mut buf = []; let mut buf = [];
match reader.read(&mut buf) { match reader.read(&mut buf) {
Ok(..) => panic!(), Ok(..) => panic!(),
Err(e) => assert_eq!(e.kind, io::EndOfFile), Err(e) => assert_eq!(e.kind, old_io::EndOfFile),
} }
} }
} }

View file

@ -19,7 +19,7 @@
//! //!
//! ```rust //! ```rust
//! # #![allow(unused_must_use)] //! # #![allow(unused_must_use)]
//! use std::io; //! use std::old_io;
//! //!
//! let mut out = old_io::stdout(); //! let mut out = old_io::stdout();
//! out.write(b"Hello, world!"); //! out.write(b"Hello, world!");
@ -141,7 +141,7 @@ impl StdinReader {
/// # Examples /// # Examples
/// ///
/// ```rust /// ```rust
/// use std::io; /// use std::old_io;
/// ///
/// for line in old_io::stdin().lock().lines() { /// for line in old_io::stdin().lock().lines() {
/// println!("{}", line.unwrap()); /// println!("{}", line.unwrap());

View file

@ -276,7 +276,7 @@ mod test {
use prelude::v1::*; use prelude::v1::*;
use old_io::{MemReader, ByRefReader}; use old_io::{MemReader, ByRefReader};
use io; use old_io;
use super::*; use super::*;
#[test] #[test]

View file

@ -10,17 +10,19 @@
//! Higher-level interfaces to libc::* functions and operating system services. //! Higher-level interfaces to libc::* functions and operating system services.
//! //!
//! In general these take and return rust types, use rust idioms (enums, closures, vectors) rather //! In general these take and return rust types, use rust idioms (enums,
//! than C idioms, and do more extensive safety checks. //! closures, vectors) rather than C idioms, and do more extensive safety
//! checks.
//! //!
//! This module is not meant to only contain 1:1 mappings to libc entries; any os-interface code //! This module is not meant to only contain 1:1 mappings to libc entries; any
//! that is reasonably useful and broadly applicable can go here. Including utility routines that //! os-interface code that is reasonably useful and broadly applicable can go
//! merely build on other os code. //! here. Including utility routines that merely build on other os code.
//! //!
//! We assume the general case is that users do not care, and do not want to be made to care, which //! We assume the general case is that users do not care, and do not want to be
//! operating system they are on. While they may want to special case various special cases -- and //! made to care, which operating system they are on. While they may want to
//! so we will not _hide_ the facts of which OS the user is on -- they should be given the //! special case various special cases -- and so we will not _hide_ the facts of
//! opportunity to write OS-ignorant code by default. //! which OS the user is on -- they should be given the opportunity to write
//! OS-ignorant code by default.
#![unstable] #![unstable]
@ -35,7 +37,7 @@ use self::MapError::*;
use clone::Clone; use clone::Clone;
use error::{FromError, Error}; use error::{FromError, Error};
use fmt; use fmt;
use io::{IoResult, IoError}; use old_io::{IoResult, IoError};
use iter::{Iterator, IteratorExt}; use iter::{Iterator, IteratorExt};
use marker::{Copy, Send}; use marker::{Copy, Send};
use libc::{c_void, c_int, c_char}; use libc::{c_void, c_int, c_char};
@ -374,7 +376,7 @@ pub struct Pipe {
/// This function is also unsafe as there is no destructor associated with the /// This function is also unsafe as there is no destructor associated with the
/// `Pipe` structure will return. If it is not arranged for the returned file /// `Pipe` structure will return. If it is not arranged for the returned file
/// descriptors to be closed, the file descriptors will leak. For safe handling /// descriptors to be closed, the file descriptors will leak. For safe handling
/// of this scenario, use `std::io::PipeStream` instead. /// of this scenario, use `std::old_io::PipeStream` instead.
pub unsafe fn pipe() -> IoResult<Pipe> { pub unsafe fn pipe() -> IoResult<Pipe> {
let (reader, writer) = try!(sys::os::pipe()); let (reader, writer) = try!(sys::os::pipe());
Ok(Pipe { Ok(Pipe {
@ -1635,10 +1637,10 @@ mod tests {
fn memory_map_file() { fn memory_map_file() {
use libc; use libc;
use os::*; use os::*;
use io::fs::{File, unlink}; use old_io::fs::{File, unlink};
use io::SeekStyle::SeekSet; use old_io::SeekStyle::SeekSet;
use io::FileMode::Open; use old_io::FileMode::Open;
use io::FileAccess::ReadWrite; use old_io::FileAccess::ReadWrite;
#[cfg(not(windows))] #[cfg(not(windows))]
fn get_fd(file: &File) -> libc::c_int { fn get_fd(file: &File) -> libc::c_int {

View file

@ -49,7 +49,7 @@
//! ## Example //! ## Example
//! //!
//! ```rust //! ```rust
//! use std::io::fs::PathExtensions; //! use std::old_io::fs::PathExtensions;
//! //!
//! let mut path = Path::new("/tmp/path"); //! let mut path = Path::new("/tmp/path");
//! println!("path: {}", path.display()); //! println!("path: {}", path.display());

View file

@ -14,7 +14,7 @@ use clone::Clone;
use cmp::{Ordering, Eq, Ord, PartialEq, PartialOrd}; use cmp::{Ordering, Eq, Ord, PartialEq, PartialOrd};
use fmt; use fmt;
use hash; use hash;
use io::Writer; use old_io::Writer;
use iter::{AdditiveIterator, Extend}; use iter::{AdditiveIterator, Extend};
use iter::{Iterator, IteratorExt, Map}; use iter::{Iterator, IteratorExt, Map};
use marker::Sized; use marker::Sized;

View file

@ -20,7 +20,7 @@ use clone::Clone;
use cmp::{Ordering, Eq, Ord, PartialEq, PartialOrd}; use cmp::{Ordering, Eq, Ord, PartialEq, PartialOrd};
use fmt; use fmt;
use hash; use hash;
use io::Writer; use old_io::Writer;
use iter::{AdditiveIterator, Extend}; use iter::{AdditiveIterator, Extend};
use iter::{Iterator, IteratorExt, Map, repeat}; use iter::{Iterator, IteratorExt, Map, repeat};
use mem; use mem;

View file

@ -43,6 +43,6 @@
// NB: remove when path reform lands // NB: remove when path reform lands
#[doc(no_inline)] pub use path::{Path, GenericPath}; #[doc(no_inline)] pub use path::{Path, GenericPath};
// NB: remove when I/O reform lands // NB: remove when I/O reform lands
#[doc(no_inline)] pub use io::{Buffer, Writer, Reader, Seek, BufferPrelude}; #[doc(no_inline)] pub use old_io::{Buffer, Writer, Reader, Seek, BufferPrelude};
// NB: remove when range syntax lands // NB: remove when range syntax lands
#[doc(no_inline)] pub use iter::range; #[doc(no_inline)] pub use iter::range;

View file

@ -223,7 +223,7 @@
use cell::RefCell; use cell::RefCell;
use clone::Clone; use clone::Clone;
use io::IoResult; use old_io::IoResult;
use iter::{Iterator, IteratorExt}; use iter::{Iterator, IteratorExt};
use mem; use mem;
use rc::Rc; use rc::Rc;

View file

@ -19,7 +19,7 @@ mod imp {
use self::OsRngInner::*; use self::OsRngInner::*;
use io::{IoResult, File}; use old_io::{IoResult, File};
use path::Path; use path::Path;
use rand::Rng; use rand::Rng;
use rand::reader::ReaderRng; use rand::reader::ReaderRng;
@ -187,7 +187,7 @@ mod imp {
mod imp { mod imp {
extern crate libc; extern crate libc;
use io::{IoResult}; use old_io::{IoResult};
use marker::Sync; use marker::Sync;
use mem; use mem;
use os; use os;
@ -259,7 +259,7 @@ mod imp {
mod imp { mod imp {
extern crate libc; extern crate libc;
use io::{IoResult, IoError}; use old_io::{IoResult, IoError};
use mem; use mem;
use ops::Drop; use ops::Drop;
use os; use os;

View file

@ -10,7 +10,7 @@
//! A wrapper around any Reader to treat it as an RNG. //! A wrapper around any Reader to treat it as an RNG.
use io::Reader; use old_io::Reader;
use rand::Rng; use rand::Rng;
use result::Result::{Ok, Err}; use result::Result::{Ok, Err};
use slice::SliceExt; use slice::SliceExt;
@ -26,7 +26,7 @@ use slice::SliceExt;
/// ///
/// ```rust /// ```rust
/// use std::rand::{reader, Rng}; /// use std::rand::{reader, Rng};
/// use std::io::MemReader; /// use std::old_io::MemReader;
/// ///
/// let mut rng = reader::ReaderRng::new(MemReader::new(vec!(1,2,3,4,5,6,7,8))); /// let mut rng = reader::ReaderRng::new(MemReader::new(vec!(1,2,3,4,5,6,7,8)));
/// println!("{:x}", rng.gen::<uint>()); /// println!("{:x}", rng.gen::<uint>());
@ -77,7 +77,7 @@ mod test {
use prelude::v1::*; use prelude::v1::*;
use super::ReaderRng; use super::ReaderRng;
use io::MemReader; use old_io::MemReader;
use num::Int; use num::Int;
use rand::Rng; use rand::Rng;

View file

@ -120,7 +120,7 @@
//! //!
//! ```no_run //! ```no_run
//! use std::sync::mpsc::channel; //! use std::sync::mpsc::channel;
//! use std::io::timer::Timer; //! use std::old_io::timer::Timer;
//! use std::time::Duration; //! use std::time::Duration;
//! //!
//! let (tx, rx) = channel::<int>(); //! let (tx, rx) = channel::<int>();
@ -144,7 +144,7 @@
//! //!
//! ```no_run //! ```no_run
//! use std::sync::mpsc::channel; //! use std::sync::mpsc::channel;
//! use std::io::timer::Timer; //! use std::old_io::timer::Timer;
//! use std::time::Duration; //! use std::time::Duration;
//! //!
//! let (tx, rx) = channel::<int>(); //! let (tx, rx) = channel::<int>();

View file

@ -10,7 +10,7 @@
use prelude::v1::*; use prelude::v1::*;
use io::IoResult; use old_io::IoResult;
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
pub const HEX_WIDTH: uint = 18; pub const HEX_WIDTH: uint = 18;

View file

@ -11,7 +11,7 @@
#![allow(missing_docs)] #![allow(missing_docs)]
#![allow(dead_code)] #![allow(dead_code)]
use io::{self, IoError, IoResult}; use old_io::{self, IoError, IoResult};
use prelude::v1::*; use prelude::v1::*;
use sys::{last_error, retry}; use sys::{last_error, retry};
use ffi::CString; use ffi::CString;
@ -35,7 +35,7 @@ pub mod wtf8;
pub fn eof() -> IoError { pub fn eof() -> IoError {
IoError { IoError {
kind: io::EndOfFile, kind: old_io::EndOfFile,
desc: "end of file", desc: "end of file",
detail: None, detail: None,
} }
@ -43,7 +43,7 @@ pub fn eof() -> IoError {
pub fn timeout(desc: &'static str) -> IoError { pub fn timeout(desc: &'static str) -> IoError {
IoError { IoError {
kind: io::TimedOut, kind: old_io::TimedOut,
desc: desc, desc: desc,
detail: None, detail: None,
} }
@ -51,7 +51,7 @@ pub fn timeout(desc: &'static str) -> IoError {
pub fn short_write(n: uint, desc: &'static str) -> IoError { pub fn short_write(n: uint, desc: &'static str) -> IoError {
IoError { IoError {
kind: if n == 0 { io::TimedOut } else { io::ShortWrite(n) }, kind: if n == 0 { old_io::TimedOut } else { old_io::ShortWrite(n) },
desc: desc, desc: desc,
detail: None, detail: None,
} }
@ -59,7 +59,7 @@ pub fn short_write(n: uint, desc: &'static str) -> IoError {
pub fn unimpl() -> IoError { pub fn unimpl() -> IoError {
IoError { IoError {
kind: io::IoUnavailable, kind: old_io::IoUnavailable,
desc: "operations not yet supported", desc: "operations not yet supported",
detail: None, detail: None,
} }

View file

@ -14,9 +14,9 @@ use self::InAddr::*;
use ffi::CString; use ffi::CString;
use ffi; use ffi;
use io::net::addrinfo; use old_io::net::addrinfo;
use io::net::ip::{SocketAddr, IpAddr, Ipv4Addr, Ipv6Addr}; use old_io::net::ip::{SocketAddr, IpAddr, Ipv4Addr, Ipv6Addr};
use io::{IoResult, IoError}; use old_io::{IoResult, IoError};
use libc::{self, c_char, c_int}; use libc::{self, c_char, c_int};
use mem; use mem;
use num::Int; use num::Int;
@ -28,7 +28,7 @@ use sys::{self, retry, c, sock_t, last_error, last_net_error, last_gai_error, cl
use sync::{Arc, Mutex, MutexGuard}; use sync::{Arc, Mutex, MutexGuard};
use sys_common::{self, keep_going, short_write, timeout}; use sys_common::{self, keep_going, short_write, timeout};
use cmp; use cmp;
use io; use old_io;
// FIXME: move uses of Arc and deadline tracking to std::io // FIXME: move uses of Arc and deadline tracking to std::io
@ -208,7 +208,7 @@ pub fn sockaddr_to_addr(storage: &libc::sockaddr_storage,
} }
_ => { _ => {
Err(IoError { Err(IoError {
kind: io::InvalidInput, kind: old_io::InvalidInput,
desc: "invalid argument", desc: "invalid argument",
detail: None, detail: None,
}) })
@ -458,7 +458,7 @@ pub fn write<T, L, W>(fd: sock_t,
// As with read(), first wait for the socket to be ready for // As with read(), first wait for the socket to be ready for
// the I/O operation. // the I/O operation.
match await(&[fd], deadline, Writable) { match await(&[fd], deadline, Writable) {
Err(ref e) if e.kind == io::EndOfFile && written > 0 => { Err(ref e) if e.kind == old_io::EndOfFile && written > 0 => {
assert!(deadline.is_some()); assert!(deadline.is_some());
return Err(short_write(written, "short write")) return Err(short_write(written, "short write"))
} }

View file

@ -86,7 +86,7 @@
use prelude::v1::*; use prelude::v1::*;
use ffi; use ffi;
use io::IoResult; use old_io::IoResult;
use libc; use libc;
use mem; use mem;
use str; use str;
@ -136,7 +136,7 @@ pub fn write(w: &mut Writer) -> IoResult<()> {
#[inline(never)] // if we know this is a function call, we can skip it when #[inline(never)] // if we know this is a function call, we can skip it when
// tracing // tracing
pub fn write(w: &mut Writer) -> IoResult<()> { pub fn write(w: &mut Writer) -> IoResult<()> {
use io::IoError; use old_io::IoError;
struct Context<'a> { struct Context<'a> {
idx: int, idx: int,

View file

@ -18,7 +18,7 @@
//! ```rust,ignore //! ```rust,ignore
//! #![feature(globs)] //! #![feature(globs)]
//! //!
//! use std::io::fs::File; //! use std::old_io::fs::File;
//! use std::os::unix::prelude::*; //! use std::os::unix::prelude::*;
//! //!
//! fn main() { //! fn main() {
@ -37,7 +37,7 @@ use sys_common::{AsInner, IntoInner, FromInner};
use ffi::{OsStr, OsString}; use ffi::{OsStr, OsString};
use libc; use libc;
use io; use old_io;
/// Raw file descriptors. /// Raw file descriptors.
pub type Fd = libc::c_int; pub type Fd = libc::c_int;
@ -48,55 +48,55 @@ pub trait AsRawFd {
fn as_raw_fd(&self) -> Fd; fn as_raw_fd(&self) -> Fd;
} }
impl AsRawFd for io::fs::File { impl AsRawFd for old_io::fs::File {
fn as_raw_fd(&self) -> Fd { fn as_raw_fd(&self) -> Fd {
self.as_inner().fd() self.as_inner().fd()
} }
} }
impl AsRawFd for io::pipe::PipeStream { impl AsRawFd for old_io::pipe::PipeStream {
fn as_raw_fd(&self) -> Fd { fn as_raw_fd(&self) -> Fd {
self.as_inner().fd() self.as_inner().fd()
} }
} }
impl AsRawFd for io::net::pipe::UnixStream { impl AsRawFd for old_io::net::pipe::UnixStream {
fn as_raw_fd(&self) -> Fd { fn as_raw_fd(&self) -> Fd {
self.as_inner().fd() self.as_inner().fd()
} }
} }
impl AsRawFd for io::net::pipe::UnixListener { impl AsRawFd for old_io::net::pipe::UnixListener {
fn as_raw_fd(&self) -> Fd { fn as_raw_fd(&self) -> Fd {
self.as_inner().fd() self.as_inner().fd()
} }
} }
impl AsRawFd for io::net::pipe::UnixAcceptor { impl AsRawFd for old_io::net::pipe::UnixAcceptor {
fn as_raw_fd(&self) -> Fd { fn as_raw_fd(&self) -> Fd {
self.as_inner().fd() self.as_inner().fd()
} }
} }
impl AsRawFd for io::net::tcp::TcpStream { impl AsRawFd for old_io::net::tcp::TcpStream {
fn as_raw_fd(&self) -> Fd { fn as_raw_fd(&self) -> Fd {
self.as_inner().fd() self.as_inner().fd()
} }
} }
impl AsRawFd for io::net::tcp::TcpListener { impl AsRawFd for old_io::net::tcp::TcpListener {
fn as_raw_fd(&self) -> Fd { fn as_raw_fd(&self) -> Fd {
self.as_inner().fd() self.as_inner().fd()
} }
} }
impl AsRawFd for io::net::tcp::TcpAcceptor { impl AsRawFd for old_io::net::tcp::TcpAcceptor {
fn as_raw_fd(&self) -> Fd { fn as_raw_fd(&self) -> Fd {
self.as_inner().fd() self.as_inner().fd()
} }
} }
impl AsRawFd for io::net::udp::UdpSocket { impl AsRawFd for old_io::net::udp::UdpSocket {
fn as_raw_fd(&self) -> Fd { fn as_raw_fd(&self) -> Fd {
self.as_inner().fd() self.as_inner().fd()
} }

View file

@ -13,10 +13,10 @@
use prelude::v1::*; use prelude::v1::*;
use ffi::{self, CString}; use ffi::{self, CString};
use io::{FilePermission, Write, UnstableFileStat, Open, FileAccess, FileMode}; use old_io::{FilePermission, Write, UnstableFileStat, Open, FileAccess, FileMode};
use io::{IoResult, FileStat, SeekStyle}; use old_io::{IoResult, FileStat, SeekStyle};
use io::{Read, Truncate, SeekCur, SeekSet, ReadWrite, SeekEnd, Append}; use old_io::{Read, Truncate, SeekCur, SeekSet, ReadWrite, SeekEnd, Append};
use io; use old_io;
use libc::{self, c_int, c_void}; use libc::{self, c_int, c_void};
use mem; use mem;
use ptr; use ptr;
@ -304,12 +304,12 @@ fn mkstat(stat: &libc::stat) -> FileStat {
FileStat { FileStat {
size: stat.st_size as u64, size: stat.st_size as u64,
kind: match (stat.st_mode as libc::mode_t) & libc::S_IFMT { kind: match (stat.st_mode as libc::mode_t) & libc::S_IFMT {
libc::S_IFREG => io::FileType::RegularFile, libc::S_IFREG => old_io::FileType::RegularFile,
libc::S_IFDIR => io::FileType::Directory, libc::S_IFDIR => old_io::FileType::Directory,
libc::S_IFIFO => io::FileType::NamedPipe, libc::S_IFIFO => old_io::FileType::NamedPipe,
libc::S_IFBLK => io::FileType::BlockSpecial, libc::S_IFBLK => old_io::FileType::BlockSpecial,
libc::S_IFLNK => io::FileType::Symlink, libc::S_IFLNK => old_io::FileType::Symlink,
_ => io::FileType::Unknown, _ => old_io::FileType::Unknown,
}, },
perm: FilePermission::from_bits_truncate(stat.st_mode as u32), perm: FilePermission::from_bits_truncate(stat.st_mode as u32),
created: mktime(stat.st_ctime as u64, stat.st_ctime_nsec as u64), created: mktime(stat.st_ctime as u64, stat.st_ctime_nsec as u64),

View file

@ -18,7 +18,7 @@
use prelude::v1::*; use prelude::v1::*;
use ffi; use ffi;
use io::{self, IoResult, IoError}; use old_io::{self, IoResult, IoError};
use libc; use libc;
use num::{Int, SignedInt}; use num::{Int, SignedInt};
use num; use num;
@ -94,35 +94,35 @@ pub fn last_gai_error(s: libc::c_int) -> IoError {
pub fn decode_error(errno: i32) -> IoError { pub fn decode_error(errno: i32) -> IoError {
// FIXME: this should probably be a bit more descriptive... // FIXME: this should probably be a bit more descriptive...
let (kind, desc) = match errno { let (kind, desc) = match errno {
libc::EOF => (io::EndOfFile, "end of file"), libc::EOF => (old_io::EndOfFile, "end of file"),
libc::ECONNREFUSED => (io::ConnectionRefused, "connection refused"), libc::ECONNREFUSED => (old_io::ConnectionRefused, "connection refused"),
libc::ECONNRESET => (io::ConnectionReset, "connection reset"), libc::ECONNRESET => (old_io::ConnectionReset, "connection reset"),
libc::EPERM | libc::EACCES => libc::EPERM | libc::EACCES =>
(io::PermissionDenied, "permission denied"), (old_io::PermissionDenied, "permission denied"),
libc::EPIPE => (io::BrokenPipe, "broken pipe"), libc::EPIPE => (old_io::BrokenPipe, "broken pipe"),
libc::ENOTCONN => (io::NotConnected, "not connected"), libc::ENOTCONN => (old_io::NotConnected, "not connected"),
libc::ECONNABORTED => (io::ConnectionAborted, "connection aborted"), libc::ECONNABORTED => (old_io::ConnectionAborted, "connection aborted"),
libc::EADDRNOTAVAIL => (io::ConnectionRefused, "address not available"), libc::EADDRNOTAVAIL => (old_io::ConnectionRefused, "address not available"),
libc::EADDRINUSE => (io::ConnectionRefused, "address in use"), libc::EADDRINUSE => (old_io::ConnectionRefused, "address in use"),
libc::ENOENT => (io::FileNotFound, "no such file or directory"), libc::ENOENT => (old_io::FileNotFound, "no such file or directory"),
libc::EISDIR => (io::InvalidInput, "illegal operation on a directory"), libc::EISDIR => (old_io::InvalidInput, "illegal operation on a directory"),
libc::ENOSYS => (io::IoUnavailable, "function not implemented"), libc::ENOSYS => (old_io::IoUnavailable, "function not implemented"),
libc::EINVAL => (io::InvalidInput, "invalid argument"), libc::EINVAL => (old_io::InvalidInput, "invalid argument"),
libc::ENOTTY => libc::ENOTTY =>
(io::MismatchedFileTypeForOperation, (old_io::MismatchedFileTypeForOperation,
"file descriptor is not a TTY"), "file descriptor is not a TTY"),
libc::ETIMEDOUT => (io::TimedOut, "operation timed out"), libc::ETIMEDOUT => (old_io::TimedOut, "operation timed out"),
libc::ECANCELED => (io::TimedOut, "operation aborted"), libc::ECANCELED => (old_io::TimedOut, "operation aborted"),
libc::consts::os::posix88::EEXIST => libc::consts::os::posix88::EEXIST =>
(io::PathAlreadyExists, "path already exists"), (old_io::PathAlreadyExists, "path already exists"),
// These two constants can have the same value on some systems, // These two constants can have the same value on some systems,
// but different values on others, so we can't use a match // but different values on others, so we can't use a match
// clause // clause
x if x == libc::EAGAIN || x == libc::EWOULDBLOCK => x if x == libc::EAGAIN || x == libc::EWOULDBLOCK =>
(io::ResourceUnavailable, "resource temporarily unavailable"), (old_io::ResourceUnavailable, "resource temporarily unavailable"),
_ => (io::OtherIoError, "unknown error") _ => (old_io::OtherIoError, "unknown error")
}; };
IoError { kind: kind, desc: desc, detail: None } IoError { kind: kind, desc: desc, detail: None }
} }

View file

@ -15,7 +15,7 @@ use prelude::v1::*;
use error::{FromError, Error}; use error::{FromError, Error};
use ffi::{self, CString}; use ffi::{self, CString};
use fmt; use fmt;
use io::{IoError, IoResult}; use old_io::{IoError, IoResult};
use libc::{self, c_int, c_char, c_void}; use libc::{self, c_int, c_char, c_void};
use os::TMPBUF_SZ; use os::TMPBUF_SZ;
use os; use os;
@ -198,7 +198,7 @@ pub fn load_self() -> Option<Vec<u8>> {
pub fn load_self() -> Option<Vec<u8>> { pub fn load_self() -> Option<Vec<u8>> {
use std::io; use std::io;
match io::fs::readlink(&Path::new("/proc/curproc/file")) { match old_io::fs::readlink(&Path::new("/proc/curproc/file")) {
Ok(path) => Some(path.into_vec()), Ok(path) => Some(path.into_vec()),
Err(..) => None Err(..) => None
} }
@ -206,9 +206,9 @@ pub fn load_self() -> Option<Vec<u8>> {
#[cfg(any(target_os = "linux", target_os = "android"))] #[cfg(any(target_os = "linux", target_os = "android"))]
pub fn load_self() -> Option<Vec<u8>> { pub fn load_self() -> Option<Vec<u8>> {
use std::io; use old_io;
match io::fs::readlink(&Path::new("/proc/self/exe")) { match old_io::fs::readlink(&Path::new("/proc/self/exe")) {
Ok(path) => Some(path.into_vec()), Ok(path) => Some(path.into_vec()),
Err(..) => None Err(..) => None
} }

View file

@ -15,7 +15,7 @@ use libc;
use mem; use mem;
use sync::{Arc, Mutex}; use sync::{Arc, Mutex};
use sync::atomic::{AtomicBool, Ordering}; use sync::atomic::{AtomicBool, Ordering};
use io::{self, IoResult, IoError}; use old_io::{self, IoResult, IoError};
use sys::{self, timer, retry, c, set_nonblocking, wouldblock}; use sys::{self, timer, retry, c, set_nonblocking, wouldblock};
use sys::fs::{fd_t, FileDesc}; use sys::fs::{fd_t, FileDesc};
@ -41,7 +41,7 @@ fn addr_to_sockaddr_un(addr: &CString,
let len = addr.len(); let len = addr.len();
if len > s.sun_path.len() - 1 { if len > s.sun_path.len() - 1 {
return Err(IoError { return Err(IoError {
kind: io::InvalidInput, kind: old_io::InvalidInput,
desc: "invalid argument: path must be smaller than SUN_LEN", desc: "invalid argument: path must be smaller than SUN_LEN",
detail: None, detail: None,
}) })

View file

@ -15,8 +15,8 @@ use collections::HashMap;
use collections::hash_map::Hasher; use collections::hash_map::Hasher;
use ffi::CString; use ffi::CString;
use hash::Hash; use hash::Hash;
use io::process::{ProcessExit, ExitStatus, ExitSignal}; use old_io::process::{ProcessExit, ExitStatus, ExitSignal};
use io::{self, IoResult, IoError, EndOfFile}; use old_io::{self, IoResult, IoError, EndOfFile};
use libc::{self, pid_t, c_void, c_int}; use libc::{self, pid_t, c_void, c_int};
use mem; use mem;
use os; use os;

View file

@ -10,8 +10,8 @@
use prelude::v1::*; use prelude::v1::*;
use io::net::ip; use old_io::net::ip;
use io::IoResult; use old_io::IoResult;
use libc; use libc;
use mem; use mem;
use ptr; use ptr;

View file

@ -49,7 +49,7 @@
use prelude::v1::*; use prelude::v1::*;
use self::Req::*; use self::Req::*;
use io::IoResult; use old_io::IoResult;
use libc; use libc;
use mem; use mem;
use os; use os;

View file

@ -12,7 +12,7 @@ use prelude::v1::*;
use sys::fs::FileDesc; use sys::fs::FileDesc;
use libc::{self, c_int, c_ulong, funcs}; use libc::{self, c_int, c_ulong, funcs};
use io::{self, IoResult, IoError}; use old_io::{self, IoResult, IoError};
use sys::c; use sys::c;
use sys_common; use sys_common;
@ -33,7 +33,7 @@ impl TTY {
Ok(TTY { fd: FileDesc::new(fd, true) }) Ok(TTY { fd: FileDesc::new(fd, true) })
} else { } else {
Err(IoError { Err(IoError {
kind: io::MismatchedFileTypeForOperation, kind: old_io::MismatchedFileTypeForOperation,
desc: "file descriptor is not a TTY", desc: "file descriptor is not a TTY",
detail: None, detail: None,
}) })

View file

@ -158,7 +158,7 @@ use sync::{Mutex, Condvar, Arc};
use str::Str; use str::Str;
use string::String; use string::String;
use rt::{self, unwind}; use rt::{self, unwind};
use io::{Writer, stdio}; use old_io::{Writer, stdio};
use thunk::Thunk; use thunk::Thunk;
use sys::thread as imp; use sys::thread as imp;
@ -508,7 +508,7 @@ mod test {
use sync::mpsc::{channel, Sender}; use sync::mpsc::{channel, Sender};
use boxed::BoxAny; use boxed::BoxAny;
use result; use result;
use std::io::{ChanReader, ChanWriter}; use std::old_io::{ChanReader, ChanWriter};
use super::{Thread, Builder}; use super::{Thread, Builder};
use thunk::Thunk; use thunk::Thunk;

View file

@ -25,7 +25,7 @@ use visit::{self, Visitor};
use arena::TypedArena; use arena::TypedArena;
use std::cell::RefCell; use std::cell::RefCell;
use std::fmt; use std::fmt;
use std::io::IoResult; use std::old_io::IoResult;
use std::iter::{self, repeat}; use std::iter::{self, repeat};
use std::mem; use std::mem;
use std::slice; use std::slice;

View file

@ -19,7 +19,7 @@ use diagnostics;
use std::cell::{RefCell, Cell}; use std::cell::{RefCell, Cell};
use std::fmt; use std::fmt;
use std::io; use std::old_io;
use std::iter::range; use std::iter::range;
use std::string::String; use std::string::String;
use term::WriterWrapper; use term::WriterWrapper;
@ -266,7 +266,7 @@ impl Level {
fn print_maybe_styled(w: &mut EmitterWriter, fn print_maybe_styled(w: &mut EmitterWriter,
msg: &str, msg: &str,
color: term::attr::Attr) -> io::IoResult<()> { color: term::attr::Attr) -> old_io::IoResult<()> {
match w.dst { match w.dst {
Terminal(ref mut t) => { Terminal(ref mut t) => {
try!(t.attr(color)); try!(t.attr(color));
@ -300,7 +300,7 @@ fn print_maybe_styled(w: &mut EmitterWriter,
} }
fn print_diagnostic(dst: &mut EmitterWriter, topic: &str, lvl: Level, fn print_diagnostic(dst: &mut EmitterWriter, topic: &str, lvl: Level,
msg: &str, code: Option<&str>) -> io::IoResult<()> { msg: &str, code: Option<&str>) -> old_io::IoResult<()> {
if !topic.is_empty() { if !topic.is_empty() {
try!(write!(&mut dst.dst, "{} ", topic)); try!(write!(&mut dst.dst, "{} ", topic));
} }
@ -336,7 +336,7 @@ enum Destination {
impl EmitterWriter { impl EmitterWriter {
pub fn stderr(color_config: ColorConfig, pub fn stderr(color_config: ColorConfig,
registry: Option<diagnostics::registry::Registry>) -> EmitterWriter { registry: Option<diagnostics::registry::Registry>) -> EmitterWriter {
let stderr = io::stderr(); let stderr = old_io::stderr();
let use_color = match color_config { let use_color = match color_config {
Always => true, Always => true,
@ -362,7 +362,7 @@ impl EmitterWriter {
} }
impl Writer for Destination { impl Writer for Destination {
fn write(&mut self, bytes: &[u8]) -> io::IoResult<()> { fn write(&mut self, bytes: &[u8]) -> old_io::IoResult<()> {
match *self { match *self {
Terminal(ref mut t) => t.write(bytes), Terminal(ref mut t) => t.write(bytes),
Raw(ref mut w) => w.write(bytes), Raw(ref mut w) => w.write(bytes),
@ -398,7 +398,7 @@ impl Emitter for EmitterWriter {
} }
fn emit(dst: &mut EmitterWriter, cm: &codemap::CodeMap, rsp: RenderSpan, fn emit(dst: &mut EmitterWriter, cm: &codemap::CodeMap, rsp: RenderSpan,
msg: &str, code: Option<&str>, lvl: Level, custom: bool) -> io::IoResult<()> { msg: &str, code: Option<&str>, lvl: Level, custom: bool) -> old_io::IoResult<()> {
let sp = rsp.span(); let sp = rsp.span();
// We cannot check equality directly with COMMAND_LINE_SP // We cannot check equality directly with COMMAND_LINE_SP
@ -446,7 +446,7 @@ fn highlight_lines(err: &mut EmitterWriter,
cm: &codemap::CodeMap, cm: &codemap::CodeMap,
sp: Span, sp: Span,
lvl: Level, lvl: Level,
lines: codemap::FileLines) -> io::IoResult<()> { lines: codemap::FileLines) -> old_io::IoResult<()> {
let fm = &*lines.file; let fm = &*lines.file;
let mut elided = false; let mut elided = false;
@ -529,7 +529,7 @@ fn custom_highlight_lines(w: &mut EmitterWriter,
sp: Span, sp: Span,
lvl: Level, lvl: Level,
lines: codemap::FileLines) lines: codemap::FileLines)
-> io::IoResult<()> { -> old_io::IoResult<()> {
let fm = &*lines.file; let fm = &*lines.file;
let lines = &lines.lines[]; let lines = &lines.lines[];
@ -570,7 +570,7 @@ fn custom_highlight_lines(w: &mut EmitterWriter,
fn print_macro_backtrace(w: &mut EmitterWriter, fn print_macro_backtrace(w: &mut EmitterWriter,
cm: &codemap::CodeMap, cm: &codemap::CodeMap,
sp: Span) sp: Span)
-> io::IoResult<()> { -> old_io::IoResult<()> {
let cs = try!(cm.with_expn_info(sp.expn_id, |expn_info| match expn_info { let cs = try!(cm.with_expn_info(sp.expn_id, |expn_info| match expn_info {
Some(ei) => { Some(ei) => {
let ss = ei.callee.span.map_or(String::new(), |span| cm.span_to_string(span)); let ss = ei.callee.span.map_or(String::new(), |span| cm.span_to_string(span));

View file

@ -20,7 +20,7 @@ use print::pprust;
use ptr::P; use ptr::P;
use util::small_vector::SmallVector; use util::small_vector::SmallVector;
use std::io::File; use std::old_io::File;
use std::rc::Rc; use std::rc::Rc;
// These macros all relate to the file system; they either return // These macros all relate to the file system; they either return

View file

@ -1430,7 +1430,7 @@ pub fn noop_fold_stmt<T: Folder>(Spanned {node, span}: Stmt, folder: &mut T)
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use std::io; use std::old_io;
use ast; use ast;
use util::parser_testing::{string_to_crate, matches_codepattern}; use util::parser_testing::{string_to_crate, matches_codepattern};
use parse::token; use parse::token;
@ -1440,7 +1440,7 @@ mod test {
// this version doesn't care about getting comments or docstrings in. // this version doesn't care about getting comments or docstrings in.
fn fake_print_crate(s: &mut pprust::State, fn fake_print_crate(s: &mut pprust::State,
krate: &ast::Crate) -> io::IoResult<()> { krate: &ast::Crate) -> old_io::IoResult<()> {
s.print_mod(&krate.module, krate.attrs.as_slice()) s.print_mod(&krate.module, krate.attrs.as_slice())
} }

View file

@ -19,7 +19,7 @@ use parse::lexer::is_block_doc_comment;
use parse::lexer; use parse::lexer;
use print::pprust; use print::pprust;
use std::io; use std::old_io;
use std::str; use std::str;
use std::string::String; use std::string::String;
use std::usize; use std::usize;
@ -337,7 +337,7 @@ pub struct Literal {
// probably not a good thing. // probably not a good thing.
pub fn gather_comments_and_literals(span_diagnostic: &diagnostic::SpanHandler, pub fn gather_comments_and_literals(span_diagnostic: &diagnostic::SpanHandler,
path: String, path: String,
srdr: &mut io::Reader) srdr: &mut old_io::Reader)
-> (Vec<Comment>, Vec<Literal>) { -> (Vec<Comment>, Vec<Literal>) {
let src = srdr.read_to_end().unwrap(); let src = srdr.read_to_end().unwrap();
let src = String::from_utf8(src).unwrap(); let src = String::from_utf8(src).unwrap();

View file

@ -1482,7 +1482,7 @@ mod test {
use diagnostic; use diagnostic;
use parse::token; use parse::token;
use parse::token::{str_to_ident}; use parse::token::{str_to_ident};
use std::io::util; use std::old_io::util;
fn mk_sh() -> diagnostic::SpanHandler { fn mk_sh() -> diagnostic::SpanHandler {
let emitter = diagnostic::EmitterWriter::new(box util::NullWriter, None); let emitter = diagnostic::EmitterWriter::new(box util::NullWriter, None);

View file

@ -18,7 +18,7 @@ use parse::parser::Parser;
use ptr::P; use ptr::P;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::io::File; use std::old_io::File;
use std::rc::Rc; use std::rc::Rc;
use std::num::Int; use std::num::Int;
use std::str; use std::str;

View file

@ -80,7 +80,7 @@ use ptr::P;
use owned_slice::OwnedSlice; use owned_slice::OwnedSlice;
use std::collections::HashSet; use std::collections::HashSet;
use std::io::fs::PathExtensions; use std::old_io::fs::PathExtensions;
use std::iter; use std::iter;
use std::mem; use std::mem;
use std::num::Float; use std::num::Float;

View file

@ -59,7 +59,7 @@
//! line (which it can't) and so naturally place the content on its own line to //! line (which it can't) and so naturally place the content on its own line to
//! avoid combining it with other lines and making matters even worse. //! avoid combining it with other lines and making matters even worse.
use std::io; use std::old_io;
use std::string; use std::string;
use std::iter::repeat; use std::iter::repeat;
@ -161,7 +161,7 @@ pub struct PrintStackElem {
static SIZE_INFINITY: isize = 0xffff; static SIZE_INFINITY: isize = 0xffff;
pub fn mk_printer(out: Box<io::Writer+'static>, linewidth: usize) -> Printer { pub fn mk_printer(out: Box<old_io::Writer+'static>, linewidth: usize) -> Printer {
// Yes 3, it makes the ring buffers big enough to never // Yes 3, it makes the ring buffers big enough to never
// fall behind. // fall behind.
let n: usize = 3 * linewidth; let n: usize = 3 * linewidth;
@ -266,7 +266,7 @@ pub fn mk_printer(out: Box<io::Writer+'static>, linewidth: usize) -> Printer {
/// the method called 'pretty_print', and the 'PRINT' process is the method /// the method called 'pretty_print', and the 'PRINT' process is the method
/// called 'print'. /// called 'print'.
pub struct Printer { pub struct Printer {
pub out: Box<io::Writer+'static>, pub out: Box<old_io::Writer+'static>,
buf_len: usize, buf_len: usize,
/// Width of lines we're constrained to /// Width of lines we're constrained to
margin: isize, margin: isize,
@ -311,7 +311,7 @@ impl Printer {
pub fn replace_last_token(&mut self, t: Token) { pub fn replace_last_token(&mut self, t: Token) {
self.token[self.right] = t; self.token[self.right] = t;
} }
pub fn pretty_print(&mut self, token: Token) -> io::IoResult<()> { pub fn pretty_print(&mut self, token: Token) -> old_io::IoResult<()> {
debug!("pp ~[{},{}]", self.left, self.right); debug!("pp ~[{},{}]", self.left, self.right);
match token { match token {
Token::Eof => { Token::Eof => {
@ -385,7 +385,7 @@ impl Printer {
} }
} }
} }
pub fn check_stream(&mut self) -> io::IoResult<()> { pub fn check_stream(&mut self) -> old_io::IoResult<()> {
debug!("check_stream ~[{}, {}] with left_total={}, right_total={}", debug!("check_stream ~[{}, {}] with left_total={}, right_total={}",
self.left, self.right, self.left_total, self.right_total); self.left, self.right, self.left_total, self.right_total);
if self.right_total - self.left_total > self.space { if self.right_total - self.left_total > self.space {
@ -445,7 +445,7 @@ impl Printer {
self.right %= self.buf_len; self.right %= self.buf_len;
assert!((self.right != self.left)); assert!((self.right != self.left));
} }
pub fn advance_left(&mut self) -> io::IoResult<()> { pub fn advance_left(&mut self) -> old_io::IoResult<()> {
debug!("advance_left ~[{},{}], sizeof({})={}", self.left, self.right, debug!("advance_left ~[{},{}], sizeof({})={}", self.left, self.right,
self.left, self.size[self.left]); self.left, self.size[self.left]);
@ -506,7 +506,7 @@ impl Printer {
} }
} }
} }
pub fn print_newline(&mut self, amount: isize) -> io::IoResult<()> { pub fn print_newline(&mut self, amount: isize) -> old_io::IoResult<()> {
debug!("NEWLINE {}", amount); debug!("NEWLINE {}", amount);
let ret = write!(self.out, "\n"); let ret = write!(self.out, "\n");
self.pending_indentation = 0; self.pending_indentation = 0;
@ -529,14 +529,14 @@ impl Printer {
} }
} }
} }
pub fn print_str(&mut self, s: &str) -> io::IoResult<()> { pub fn print_str(&mut self, s: &str) -> old_io::IoResult<()> {
while self.pending_indentation > 0 { while self.pending_indentation > 0 {
try!(write!(self.out, " ")); try!(write!(self.out, " "));
self.pending_indentation -= 1; self.pending_indentation -= 1;
} }
write!(self.out, "{}", s) write!(self.out, "{}", s)
} }
pub fn print(&mut self, token: Token, l: isize) -> io::IoResult<()> { pub fn print(&mut self, token: Token, l: isize) -> old_io::IoResult<()> {
debug!("print {} {} (remaining line space={})", tok_str(&token), l, debug!("print {} {} (remaining line space={})", tok_str(&token), l,
self.space); self.space);
debug!("{}", buf_str(&self.token[], debug!("{}", buf_str(&self.token[],
@ -620,61 +620,61 @@ impl Printer {
// Convenience functions to talk to the printer. // Convenience functions to talk to the printer.
// //
// "raw box" // "raw box"
pub fn rbox(p: &mut Printer, indent: usize, b: Breaks) -> io::IoResult<()> { pub fn rbox(p: &mut Printer, indent: usize, b: Breaks) -> old_io::IoResult<()> {
p.pretty_print(Token::Begin(BeginToken { p.pretty_print(Token::Begin(BeginToken {
offset: indent as isize, offset: indent as isize,
breaks: b breaks: b
})) }))
} }
pub fn ibox(p: &mut Printer, indent: usize) -> io::IoResult<()> { pub fn ibox(p: &mut Printer, indent: usize) -> old_io::IoResult<()> {
rbox(p, indent, Breaks::Inconsistent) rbox(p, indent, Breaks::Inconsistent)
} }
pub fn cbox(p: &mut Printer, indent: usize) -> io::IoResult<()> { pub fn cbox(p: &mut Printer, indent: usize) -> old_io::IoResult<()> {
rbox(p, indent, Breaks::Consistent) rbox(p, indent, Breaks::Consistent)
} }
pub fn break_offset(p: &mut Printer, n: usize, off: isize) -> io::IoResult<()> { pub fn break_offset(p: &mut Printer, n: usize, off: isize) -> old_io::IoResult<()> {
p.pretty_print(Token::Break(BreakToken { p.pretty_print(Token::Break(BreakToken {
offset: off, offset: off,
blank_space: n as isize blank_space: n as isize
})) }))
} }
pub fn end(p: &mut Printer) -> io::IoResult<()> { pub fn end(p: &mut Printer) -> old_io::IoResult<()> {
p.pretty_print(Token::End) p.pretty_print(Token::End)
} }
pub fn eof(p: &mut Printer) -> io::IoResult<()> { pub fn eof(p: &mut Printer) -> old_io::IoResult<()> {
p.pretty_print(Token::Eof) p.pretty_print(Token::Eof)
} }
pub fn word(p: &mut Printer, wrd: &str) -> io::IoResult<()> { pub fn word(p: &mut Printer, wrd: &str) -> old_io::IoResult<()> {
p.pretty_print(Token::String(/* bad */ wrd.to_string(), wrd.len() as isize)) p.pretty_print(Token::String(/* bad */ wrd.to_string(), wrd.len() as isize))
} }
pub fn huge_word(p: &mut Printer, wrd: &str) -> io::IoResult<()> { pub fn huge_word(p: &mut Printer, wrd: &str) -> old_io::IoResult<()> {
p.pretty_print(Token::String(/* bad */ wrd.to_string(), SIZE_INFINITY)) p.pretty_print(Token::String(/* bad */ wrd.to_string(), SIZE_INFINITY))
} }
pub fn zero_word(p: &mut Printer, wrd: &str) -> io::IoResult<()> { pub fn zero_word(p: &mut Printer, wrd: &str) -> old_io::IoResult<()> {
p.pretty_print(Token::String(/* bad */ wrd.to_string(), 0)) p.pretty_print(Token::String(/* bad */ wrd.to_string(), 0))
} }
pub fn spaces(p: &mut Printer, n: usize) -> io::IoResult<()> { pub fn spaces(p: &mut Printer, n: usize) -> old_io::IoResult<()> {
break_offset(p, n, 0) break_offset(p, n, 0)
} }
pub fn zerobreak(p: &mut Printer) -> io::IoResult<()> { pub fn zerobreak(p: &mut Printer) -> old_io::IoResult<()> {
spaces(p, 0us) spaces(p, 0us)
} }
pub fn space(p: &mut Printer) -> io::IoResult<()> { pub fn space(p: &mut Printer) -> old_io::IoResult<()> {
spaces(p, 1us) spaces(p, 1us)
} }
pub fn hardbreak(p: &mut Printer) -> io::IoResult<()> { pub fn hardbreak(p: &mut Printer) -> old_io::IoResult<()> {
spaces(p, SIZE_INFINITY as usize) spaces(p, SIZE_INFINITY as usize)
} }

View file

@ -30,7 +30,7 @@ use print::pp::Breaks::{Consistent, Inconsistent};
use ptr::P; use ptr::P;
use std::{ascii, mem}; use std::{ascii, mem};
use std::io::{self, IoResult}; use std::old_io::{self, IoResult};
use std::iter; use std::iter;
pub enum AnnNode<'a> { pub enum AnnNode<'a> {
@ -69,12 +69,12 @@ pub struct State<'a> {
encode_idents_with_hygiene: bool, encode_idents_with_hygiene: bool,
} }
pub fn rust_printer(writer: Box<io::Writer+'static>) -> State<'static> { pub fn rust_printer(writer: Box<old_io::Writer+'static>) -> State<'static> {
static NO_ANN: NoAnn = NoAnn; static NO_ANN: NoAnn = NoAnn;
rust_printer_annotated(writer, &NO_ANN) rust_printer_annotated(writer, &NO_ANN)
} }
pub fn rust_printer_annotated<'a>(writer: Box<io::Writer+'static>, pub fn rust_printer_annotated<'a>(writer: Box<old_io::Writer+'static>,
ann: &'a PpAnn) -> State<'a> { ann: &'a PpAnn) -> State<'a> {
State { State {
s: pp::mk_printer(writer, default_columns), s: pp::mk_printer(writer, default_columns),
@ -104,8 +104,8 @@ pub fn print_crate<'a>(cm: &'a CodeMap,
span_diagnostic: &diagnostic::SpanHandler, span_diagnostic: &diagnostic::SpanHandler,
krate: &ast::Crate, krate: &ast::Crate,
filename: String, filename: String,
input: &mut io::Reader, input: &mut old_io::Reader,
out: Box<io::Writer+'static>, out: Box<old_io::Writer+'static>,
ann: &'a PpAnn, ann: &'a PpAnn,
is_expanded: bool) -> IoResult<()> { is_expanded: bool) -> IoResult<()> {
let mut s = State::new_from_input(cm, let mut s = State::new_from_input(cm,
@ -124,8 +124,8 @@ impl<'a> State<'a> {
pub fn new_from_input(cm: &'a CodeMap, pub fn new_from_input(cm: &'a CodeMap,
span_diagnostic: &diagnostic::SpanHandler, span_diagnostic: &diagnostic::SpanHandler,
filename: String, filename: String,
input: &mut io::Reader, input: &mut old_io::Reader,
out: Box<io::Writer+'static>, out: Box<old_io::Writer+'static>,
ann: &'a PpAnn, ann: &'a PpAnn,
is_expanded: bool) -> State<'a> { is_expanded: bool) -> State<'a> {
let (cmnts, lits) = comments::gather_comments_and_literals( let (cmnts, lits) = comments::gather_comments_and_literals(
@ -145,7 +145,7 @@ impl<'a> State<'a> {
} }
pub fn new(cm: &'a CodeMap, pub fn new(cm: &'a CodeMap,
out: Box<io::Writer+'static>, out: Box<old_io::Writer+'static>,
ann: &'a PpAnn, ann: &'a PpAnn,
comments: Option<Vec<comments::Comment>>, comments: Option<Vec<comments::Comment>>,
literals: Option<Vec<comments::Literal>>) -> State<'a> { literals: Option<Vec<comments::Literal>>) -> State<'a> {
@ -173,7 +173,7 @@ pub fn to_string<F>(f: F) -> String where
f(&mut s).unwrap(); f(&mut s).unwrap();
eof(&mut s.s).unwrap(); eof(&mut s.s).unwrap();
let wr = unsafe { let wr = unsafe {
// FIXME(pcwalton): A nasty function to extract the string from an `io::Writer` // FIXME(pcwalton): A nasty function to extract the string from an `old_io::Writer`
// that we "know" to be a `Vec<u8>` that works around the lack of checked // that we "know" to be a `Vec<u8>` that works around the lack of checked
// downcasts. // downcasts.
let obj: &TraitObject = mem::transmute(&s.s.out); let obj: &TraitObject = mem::transmute(&s.s.out);
@ -421,7 +421,7 @@ thing_to_string_impls! { to_string }
pub mod with_hygiene { pub mod with_hygiene {
use abi; use abi;
use ast; use ast;
use std::io::IoResult; use std::old_io::IoResult;
use super::indent_unit; use super::indent_unit;
// This function is the trick that all the rest of the routines // This function is the trick that all the rest of the routines

View file

@ -61,7 +61,7 @@ pub use terminfo::TerminfoTerminal;
#[cfg(windows)] #[cfg(windows)]
pub use win::WinConsole; pub use win::WinConsole;
use std::io::IoResult; use std::old_io::IoResult;
pub mod terminfo; pub mod terminfo;
@ -91,7 +91,7 @@ impl Writer for WriterWrapper {
/// opened. /// opened.
pub fn stdout() -> Option<Box<Terminal<WriterWrapper> + Send>> { pub fn stdout() -> Option<Box<Terminal<WriterWrapper> + Send>> {
TerminfoTerminal::new(WriterWrapper { TerminfoTerminal::new(WriterWrapper {
wrapped: box std::io::stdout() as Box<Writer + Send>, wrapped: box std::old_io::stdout() as Box<Writer + Send>,
}) })
} }
@ -100,14 +100,14 @@ pub fn stdout() -> Option<Box<Terminal<WriterWrapper> + Send>> {
/// opened. /// opened.
pub fn stdout() -> Option<Box<Terminal<WriterWrapper> + Send>> { pub fn stdout() -> Option<Box<Terminal<WriterWrapper> + Send>> {
let ti = TerminfoTerminal::new(WriterWrapper { let ti = TerminfoTerminal::new(WriterWrapper {
wrapped: box std::io::stdout() as Box<Writer + Send>, wrapped: box std::old_io::stdout() as Box<Writer + Send>,
}); });
match ti { match ti {
Some(t) => Some(t), Some(t) => Some(t),
None => { None => {
WinConsole::new(WriterWrapper { WinConsole::new(WriterWrapper {
wrapped: box std::io::stdout() as Box<Writer + Send>, wrapped: box std::old_io::stdout() as Box<Writer + Send>,
}) })
} }
} }
@ -118,7 +118,7 @@ pub fn stdout() -> Option<Box<Terminal<WriterWrapper> + Send>> {
/// opened. /// opened.
pub fn stderr() -> Option<Box<Terminal<WriterWrapper> + Send>> { pub fn stderr() -> Option<Box<Terminal<WriterWrapper> + Send>> {
TerminfoTerminal::new(WriterWrapper { TerminfoTerminal::new(WriterWrapper {
wrapped: box std::io::stderr() as Box<Writer + Send>, wrapped: box std::old_io::stderr() as Box<Writer + Send>,
}) })
} }
@ -127,14 +127,14 @@ pub fn stderr() -> Option<Box<Terminal<WriterWrapper> + Send>> {
/// opened. /// opened.
pub fn stderr() -> Option<Box<Terminal<WriterWrapper> + Send>> { pub fn stderr() -> Option<Box<Terminal<WriterWrapper> + Send>> {
let ti = TerminfoTerminal::new(WriterWrapper { let ti = TerminfoTerminal::new(WriterWrapper {
wrapped: box std::io::stderr() as Box<Writer + Send>, wrapped: box std::old_io::stderr() as Box<Writer + Send>,
}); });
match ti { match ti {
Some(t) => Some(t), Some(t) => Some(t),
None => { None => {
WinConsole::new(WriterWrapper { WinConsole::new(WriterWrapper {
wrapped: box std::io::stderr() as Box<Writer + Send>, wrapped: box std::old_io::stderr() as Box<Writer + Send>,
}) })
} }
} }

View file

@ -11,7 +11,7 @@
//! Terminfo database interface. //! Terminfo database interface.
use std::collections::HashMap; use std::collections::HashMap;
use std::io::IoResult; use std::old_io::IoResult;
use std::os; use std::os;
use attr; use attr;

View file

@ -13,7 +13,7 @@
//! ncurses-compatible compiled terminfo format parsing (term(5)) //! ncurses-compatible compiled terminfo format parsing (term(5))
use std::collections::HashMap; use std::collections::HashMap;
use std::io; use std::old_io;
use super::super::TermInfo; use super::super::TermInfo;
// These are the orders ncurses uses in its compiled format (as of 5.9). Not sure if portable. // These are the orders ncurses uses in its compiled format (as of 5.9). Not sure if portable.
@ -158,7 +158,7 @@ pub static stringnames: &'static[&'static str] = &[ "cbt", "_", "cr", "csr", "tb
"box1"]; "box1"];
/// Parse a compiled terminfo entry, using long capability names if `longnames` is true /// Parse a compiled terminfo entry, using long capability names if `longnames` is true
pub fn parse(file: &mut io::Reader, longnames: bool) pub fn parse(file: &mut old_io::Reader, longnames: bool)
-> Result<Box<TermInfo>, String> { -> Result<Box<TermInfo>, String> {
macro_rules! try { ($e:expr) => ( macro_rules! try { ($e:expr) => (
match $e { match $e {
@ -340,6 +340,6 @@ mod test {
#[ignore(reason = "no ncurses on buildbots, needs a bundled terminfo file to test against")] #[ignore(reason = "no ncurses on buildbots, needs a bundled terminfo file to test against")]
fn test_parse() { fn test_parse() {
// FIXME #6870: Distribute a compiled file in src/tests and test there // FIXME #6870: Distribute a compiled file in src/tests and test there
// parse(io::fs_reader(&p("/usr/share/terminfo/r/rxvt-256color")).unwrap(), false); // parse(old_io::fs_reader(&p("/usr/share/terminfo/r/rxvt-256color")).unwrap(), false);
} }
} }

View file

@ -12,8 +12,8 @@
//! //!
//! Does not support hashed database, only filesystem! //! Does not support hashed database, only filesystem!
use std::io::File; use std::old_io::File;
use std::io::fs::PathExtensions; use std::old_io::fs::PathExtensions;
use std::os::getenv; use std::os::getenv;
use std::os; use std::os;

View file

@ -60,9 +60,9 @@ use std::any::Any;
use std::cmp; use std::cmp;
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::fmt; use std::fmt;
use std::io::stdio::StdWriter; use std::old_io::stdio::StdWriter;
use std::io::{File, ChanReader, ChanWriter}; use std::old_io::{File, ChanReader, ChanWriter};
use std::io; use std::old_io;
use std::iter::repeat; use std::iter::repeat;
use std::num::{Float, Int}; use std::num::{Float, Int};
use std::os; use std::os;
@ -443,13 +443,13 @@ struct ConsoleTestState<T> {
impl<T: Writer> ConsoleTestState<T> { impl<T: Writer> ConsoleTestState<T> {
pub fn new(opts: &TestOpts, pub fn new(opts: &TestOpts,
_: Option<T>) -> io::IoResult<ConsoleTestState<StdWriter>> { _: Option<T>) -> old_io::IoResult<ConsoleTestState<StdWriter>> {
let log_out = match opts.logfile { let log_out = match opts.logfile {
Some(ref path) => Some(try!(File::create(path))), Some(ref path) => Some(try!(File::create(path))),
None => None None => None
}; };
let out = match term::stdout() { let out = match term::stdout() {
None => Raw(io::stdio::stdout_raw()), None => Raw(old_io::stdio::stdout_raw()),
Some(t) => Pretty(t) Some(t) => Pretty(t)
}; };
@ -468,29 +468,29 @@ impl<T: Writer> ConsoleTestState<T> {
}) })
} }
pub fn write_ok(&mut self) -> io::IoResult<()> { pub fn write_ok(&mut self) -> old_io::IoResult<()> {
self.write_pretty("ok", term::color::GREEN) self.write_pretty("ok", term::color::GREEN)
} }
pub fn write_failed(&mut self) -> io::IoResult<()> { pub fn write_failed(&mut self) -> old_io::IoResult<()> {
self.write_pretty("FAILED", term::color::RED) self.write_pretty("FAILED", term::color::RED)
} }
pub fn write_ignored(&mut self) -> io::IoResult<()> { pub fn write_ignored(&mut self) -> old_io::IoResult<()> {
self.write_pretty("ignored", term::color::YELLOW) self.write_pretty("ignored", term::color::YELLOW)
} }
pub fn write_metric(&mut self) -> io::IoResult<()> { pub fn write_metric(&mut self) -> old_io::IoResult<()> {
self.write_pretty("metric", term::color::CYAN) self.write_pretty("metric", term::color::CYAN)
} }
pub fn write_bench(&mut self) -> io::IoResult<()> { pub fn write_bench(&mut self) -> old_io::IoResult<()> {
self.write_pretty("bench", term::color::CYAN) self.write_pretty("bench", term::color::CYAN)
} }
pub fn write_pretty(&mut self, pub fn write_pretty(&mut self,
word: &str, word: &str,
color: term::color::Color) -> io::IoResult<()> { color: term::color::Color) -> old_io::IoResult<()> {
match self.out { match self.out {
Pretty(ref mut term) => { Pretty(ref mut term) => {
if self.use_color { if self.use_color {
@ -506,26 +506,26 @@ impl<T: Writer> ConsoleTestState<T> {
} }
} }
pub fn write_plain(&mut self, s: &str) -> io::IoResult<()> { pub fn write_plain(&mut self, s: &str) -> old_io::IoResult<()> {
match self.out { match self.out {
Pretty(ref mut term) => term.write(s.as_bytes()), Pretty(ref mut term) => term.write(s.as_bytes()),
Raw(ref mut stdout) => stdout.write(s.as_bytes()) Raw(ref mut stdout) => stdout.write(s.as_bytes())
} }
} }
pub fn write_run_start(&mut self, len: uint) -> io::IoResult<()> { pub fn write_run_start(&mut self, len: uint) -> old_io::IoResult<()> {
self.total = len; self.total = len;
let noun = if len != 1 { "tests" } else { "test" }; let noun = if len != 1 { "tests" } else { "test" };
self.write_plain(format!("\nrunning {} {}\n", len, noun).as_slice()) self.write_plain(format!("\nrunning {} {}\n", len, noun).as_slice())
} }
pub fn write_test_start(&mut self, test: &TestDesc, pub fn write_test_start(&mut self, test: &TestDesc,
align: NamePadding) -> io::IoResult<()> { align: NamePadding) -> old_io::IoResult<()> {
let name = test.padded_name(self.max_name_len, align); let name = test.padded_name(self.max_name_len, align);
self.write_plain(format!("test {} ... ", name).as_slice()) self.write_plain(format!("test {} ... ", name).as_slice())
} }
pub fn write_result(&mut self, result: &TestResult) -> io::IoResult<()> { pub fn write_result(&mut self, result: &TestResult) -> old_io::IoResult<()> {
try!(match *result { try!(match *result {
TrOk => self.write_ok(), TrOk => self.write_ok(),
TrFailed => self.write_failed(), TrFailed => self.write_failed(),
@ -547,7 +547,7 @@ impl<T: Writer> ConsoleTestState<T> {
} }
pub fn write_log(&mut self, test: &TestDesc, pub fn write_log(&mut self, test: &TestDesc,
result: &TestResult) -> io::IoResult<()> { result: &TestResult) -> old_io::IoResult<()> {
match self.log_out { match self.log_out {
None => Ok(()), None => Ok(()),
Some(ref mut o) => { Some(ref mut o) => {
@ -563,7 +563,7 @@ impl<T: Writer> ConsoleTestState<T> {
} }
} }
pub fn write_failures(&mut self) -> io::IoResult<()> { pub fn write_failures(&mut self) -> old_io::IoResult<()> {
try!(self.write_plain("\nfailures:\n")); try!(self.write_plain("\nfailures:\n"));
let mut failures = Vec::new(); let mut failures = Vec::new();
let mut fail_out = String::new(); let mut fail_out = String::new();
@ -591,7 +591,7 @@ impl<T: Writer> ConsoleTestState<T> {
Ok(()) Ok(())
} }
pub fn write_run_finish(&mut self) -> io::IoResult<bool> { pub fn write_run_finish(&mut self) -> old_io::IoResult<bool> {
assert!(self.passed + self.failed + self.ignored + self.measured == self.total); assert!(self.passed + self.failed + self.ignored + self.measured == self.total);
let success = self.failed == 0u; let success = self.failed == 0u;
@ -627,9 +627,10 @@ pub fn fmt_bench_samples(bs: &BenchSamples) -> String {
} }
// A simple console test runner // A simple console test runner
pub fn run_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn> ) -> io::IoResult<bool> { pub fn run_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn> ) -> old_io::IoResult<bool> {
fn callback<T: Writer>(event: &TestEvent, st: &mut ConsoleTestState<T>) -> io::IoResult<()> { fn callback<T: Writer>(event: &TestEvent,
st: &mut ConsoleTestState<T>) -> old_io::IoResult<()> {
match (*event).clone() { match (*event).clone() {
TeFiltered(ref filtered_tests) => st.write_run_start(filtered_tests.len()), TeFiltered(ref filtered_tests) => st.write_run_start(filtered_tests.len()),
TeWait(ref test, padding) => st.write_test_start(test, padding), TeWait(ref test, padding) => st.write_test_start(test, padding),
@ -727,7 +728,7 @@ fn should_sort_failures_before_printing_them() {
fn use_color(opts: &TestOpts) -> bool { fn use_color(opts: &TestOpts) -> bool {
match opts.color { match opts.color {
AutoColor => get_concurrency() == 1 && io::stdout().get_ref().isatty(), AutoColor => get_concurrency() == 1 && old_io::stdout().get_ref().isatty(),
AlwaysColor => true, AlwaysColor => true,
NeverColor => false, NeverColor => false,
} }
@ -745,8 +746,8 @@ pub type MonitorMsg = (TestDesc, TestResult, Vec<u8> );
fn run_tests<F>(opts: &TestOpts, fn run_tests<F>(opts: &TestOpts,
tests: Vec<TestDescAndFn> , tests: Vec<TestDescAndFn> ,
mut callback: F) -> io::IoResult<()> where mut callback: F) -> old_io::IoResult<()> where
F: FnMut(TestEvent) -> io::IoResult<()>, F: FnMut(TestEvent) -> old_io::IoResult<()>,
{ {
let filtered_tests = filter_tests(opts, tests); let filtered_tests = filter_tests(opts, tests);
let filtered_descs = filtered_tests.iter() let filtered_descs = filtered_tests.iter()
@ -1119,7 +1120,7 @@ mod tests {
TestDesc, TestDescAndFn, TestOpts, run_test, TestDesc, TestDescAndFn, TestOpts, run_test,
Metric, MetricMap, Metric, MetricMap,
StaticTestName, DynTestName, DynTestFn, ShouldFail}; StaticTestName, DynTestName, DynTestFn, ShouldFail};
use std::io::TempDir; use std::old_io::TempDir;
use std::thunk::Thunk; use std::thunk::Thunk;
use std::sync::mpsc::channel; use std::sync::mpsc::channel;

View file

@ -351,7 +351,7 @@ pub fn freq_count<T, U>(mut iter: T) -> hash_map::HashMap<U, uint>
mod tests { mod tests {
use stats::Stats; use stats::Stats;
use stats::Summary; use stats::Summary;
use std::io; use std::old_io;
use std::f64; use std::f64;
macro_rules! assert_approx_eq { macro_rules! assert_approx_eq {
@ -367,7 +367,7 @@ mod tests {
let summ2 = Summary::new(samples); let summ2 = Summary::new(samples);
let mut w = io::stdout(); let mut w = old_io::stdout();
let w = &mut w; let w = &mut w;
(write!(w, "\n")).unwrap(); (write!(w, "\n")).unwrap();

View file

@ -10,7 +10,7 @@
//! Basic data structures for representing a book. //! Basic data structures for representing a book.
use std::io::BufferedReader; use std::old_io::BufferedReader;
use std::iter; use std::iter;
use std::iter::AdditiveIterator; use std::iter::AdditiveIterator;

View file

@ -11,8 +11,8 @@
//! Implementation of the `build` subcommand, used to compile a book. //! Implementation of the `build` subcommand, used to compile a book.
use std::os; use std::os;
use std::io; use std::old_io;
use std::io::{fs, File, BufferedWriter, TempDir, IoResult}; use std::old_io::{fs, File, BufferedWriter, TempDir, IoResult};
use subcommand::Subcommand; use subcommand::Subcommand;
use term::Term; use term::Term;
@ -119,7 +119,7 @@ fn render(book: &Book, tgt: &Path) -> CliResult<()> {
try!(writeln!(&mut toc, "</div></div>")); try!(writeln!(&mut toc, "</div></div>"));
} }
try!(fs::mkdir_recursive(&out_path, io::USER_DIR)); try!(fs::mkdir_recursive(&out_path, old_io::USER_DIR));
let rustdoc_args: &[String] = &[ let rustdoc_args: &[String] = &[
"".to_string(), "".to_string(),
@ -165,7 +165,7 @@ impl Subcommand for Build {
tgt = Path::new(os::args()[3].clone()); tgt = Path::new(os::args()[3].clone());
} }
try!(fs::mkdir(&tgt, io::USER_DIR)); try!(fs::mkdir(&tgt, old_io::USER_DIR));
try!(File::create(&tgt.join("rust-book.css")).write_str(css::STYLE)); try!(File::create(&tgt.join("rust-book.css")).write_str(css::STYLE));

View file

@ -13,7 +13,7 @@
use std::fmt; use std::fmt;
use std::fmt::{Show, Formatter}; use std::fmt::{Show, Formatter};
use std::io::IoError; use std::old_io::IoError;
pub type CliError = Box<Error + 'static>; pub type CliError = Box<Error + 'static>;
pub type CliResult<T> = Result<T, CliError>; pub type CliResult<T> = Result<T, CliError>;

View file

@ -12,7 +12,7 @@
//! verbosity support. For now, just a wrapper around stdout/stderr. //! verbosity support. For now, just a wrapper around stdout/stderr.
use std::os; use std::os;
use std::io::stdio; use std::old_io::stdio;
pub struct Term { pub struct Term {
err: Box<Writer + 'static> err: Box<Writer + 'static>

View file

@ -16,7 +16,7 @@ use error::CommandResult;
use error::Error; use error::Error;
use term::Term; use term::Term;
use book; use book;
use std::io::{Command, File}; use std::old_io::{Command, File};
use std::os; use std::os;
struct Test; struct Test;

View file

@ -13,7 +13,7 @@
#![feature(unboxed_closures)] #![feature(unboxed_closures)]
use std::io::File; use std::old_io::File;
use std::iter::repeat; use std::iter::repeat;
use std::mem::swap; use std::mem::swap;
use std::os; use std::os;
@ -71,7 +71,7 @@ fn shift_push() {
} }
fn read_line() { fn read_line() {
use std::io::BufferedReader; use std::old_io::BufferedReader;
let mut path = Path::new(env!("CFG_SRC_DIR")); let mut path = Path::new(env!("CFG_SRC_DIR"));
path.push("src/test/bench/shootout-k-nucleotide.data"); path.push("src/test/bench/shootout-k-nucleotide.data");

View file

@ -39,7 +39,7 @@
// OF THE POSSIBILITY OF SUCH DAMAGE. // OF THE POSSIBILITY OF SUCH DAMAGE.
use std::cmp::min; use std::cmp::min;
use std::io::{stdout, IoResult}; use std::old_io::{stdout, IoResult};
use std::iter::repeat; use std::iter::repeat;
use std::os; use std::os;
use std::slice::bytes::copy_memory; use std::slice::bytes::copy_memory;

View file

@ -39,8 +39,8 @@
// OF THE POSSIBILITY OF SUCH DAMAGE. // OF THE POSSIBILITY OF SUCH DAMAGE.
use std::cmp::min; use std::cmp::min;
use std::io::{BufferedWriter, File}; use std::old_io::{BufferedWriter, File};
use std::io; use std::old_io;
use std::num::Float; use std::num::Float;
use std::os; use std::os;
@ -86,7 +86,7 @@ impl<'a> Iterator for AAGen<'a> {
fn make_fasta<W: Writer, I: Iterator<Item=u8>>( fn make_fasta<W: Writer, I: Iterator<Item=u8>>(
wr: &mut W, header: &str, mut it: I, mut n: uint) wr: &mut W, header: &str, mut it: I, mut n: uint)
-> std::io::IoResult<()> -> std::old_io::IoResult<()>
{ {
try!(wr.write(header.as_bytes())); try!(wr.write(header.as_bytes()));
let mut line = [0u8; LINE_LENGTH + 1]; let mut line = [0u8; LINE_LENGTH + 1];
@ -102,7 +102,7 @@ fn make_fasta<W: Writer, I: Iterator<Item=u8>>(
Ok(()) Ok(())
} }
fn run<W: Writer>(writer: &mut W) -> std::io::IoResult<()> { fn run<W: Writer>(writer: &mut W) -> std::old_io::IoResult<()> {
let args = os::args(); let args = os::args();
let args = args.as_slice(); let args = args.as_slice();
let n = if os::getenv("RUST_BENCH").is_some() { let n = if os::getenv("RUST_BENCH").is_some() {
@ -147,7 +147,7 @@ fn main() {
let mut file = BufferedWriter::new(File::create(&Path::new("./shootout-fasta.data"))); let mut file = BufferedWriter::new(File::create(&Path::new("./shootout-fasta.data")));
run(&mut file) run(&mut file)
} else { } else {
run(&mut io::stdout()) run(&mut old_io::stdout())
}; };
res.unwrap() res.unwrap()
} }

View file

@ -146,7 +146,7 @@ fn make_sequence_processor(sz: uint,
// given a FASTA file on stdin, process sequence THREE // given a FASTA file on stdin, process sequence THREE
fn main() { fn main() {
use std::io::{stdio, MemReader, BufferedReader}; use std::old_io::{stdio, MemReader, BufferedReader};
let rdr = if os::getenv("RUST_BENCH").is_some() { let rdr = if os::getenv("RUST_BENCH").is_some() {
let foo = include_bytes!("shootout-k-nucleotide.data"); let foo = include_bytes!("shootout-k-nucleotide.data");

View file

@ -294,10 +294,10 @@ fn get_sequence<R: Buffer>(r: &mut R, key: &str) -> Vec<u8> {
fn main() { fn main() {
let input = if std::os::getenv("RUST_BENCH").is_some() { let input = if std::os::getenv("RUST_BENCH").is_some() {
let fd = std::io::File::open(&Path::new("shootout-k-nucleotide.data")); let fd = std::old_io::File::open(&Path::new("shootout-k-nucleotide.data"));
get_sequence(&mut std::io::BufferedReader::new(fd), ">THREE") get_sequence(&mut std::old_io::BufferedReader::new(fd), ">THREE")
} else { } else {
get_sequence(&mut *std::io::stdin().lock(), ">THREE") get_sequence(&mut *std::old_io::stdin().lock(), ">THREE")
}; };
let input = Arc::new(input); let input = Arc::new(input);

View file

@ -43,7 +43,7 @@
// ignore-pretty very bad with line comments // ignore-pretty very bad with line comments
use std::io; use std::old_io;
use std::os; use std::os;
use std::simd::f64x2; use std::simd::f64x2;
use std::sync::Arc; use std::sync::Arc;
@ -54,7 +54,7 @@ const LIMIT: f64 = 2.0;
const WORKERS: uint = 16; const WORKERS: uint = 16;
#[inline(always)] #[inline(always)]
fn mandelbrot<W: io::Writer>(w: uint, mut out: W) -> io::IoResult<()> { fn mandelbrot<W: old_io::Writer>(w: uint, mut out: W) -> old_io::IoResult<()> {
assert!(WORKERS % 2 == 0); assert!(WORKERS % 2 == 0);
// Ensure w and h are multiples of 8. // Ensure w and h are multiples of 8.
@ -203,9 +203,9 @@ fn main() {
let res = if args.len() < 2 { let res = if args.len() < 2 {
println!("Test mode: do not dump the image because it's not utf8, \ println!("Test mode: do not dump the image because it's not utf8, \
which interferes with the test runner."); which interferes with the test runner.");
mandelbrot(1000, io::util::NullWriter) mandelbrot(1000, old_io::util::NullWriter)
} else { } else {
mandelbrot(args[1].parse().unwrap(), io::stdout()) mandelbrot(args[1].parse().unwrap(), old_io::stdout())
}; };
res.unwrap(); res.unwrap();
} }

Some files were not shown because too many files have changed in this diff Show more