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;
use std::os;
use std::io;
use std::io::fs;
use std::old_io;
use std::old_io::fs;
use std::str::FromStr;
use std::thunk::Thunk;
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
// parallel (especially when we have lots and lots of child processes).
// 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
// If #11207 is resolved (adding manifest to .exe) this becomes unnecessary
os::setenv("__COMPAT_LAYER", "RunAsInvoker");

View file

@ -9,7 +9,7 @@
// except according to those terms.
use self::WhichLine::*;
use std::io::{BufferedReader, File};
use std::old_io::{BufferedReader, File};
pub struct ExpectedError {
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
F: FnMut(&str) -> bool,
{
use std::io::{BufferedReader, File};
use std::old_io::{BufferedReader, File};
let mut rdr = BufferedReader::new(File::open(testfile).unwrap());
for ln in rdr.lines() {

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// 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;
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")]
use std::ascii::AsciiExt;
use std::io::File;
use std::io::fs::PathExtensions;
use std::io::fs;
use std::io::net::tcp;
use std::io::process::ProcessExit;
use std::io::process;
use std::io::timer;
use std::io;
use std::old_io::File;
use std::old_io::fs::PathExtensions;
use std::old_io::fs;
use std::old_io::net::tcp;
use std::old_io::process::ProcessExit;
use std::old_io::process;
use std::old_io::timer;
use std::old_io;
use std::os;
use std::iter::repeat;
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) {
use std::io::process::{Command, ProcessOutput};
use std::old_io::process::{Command, ProcessOutput};
if config.lldb_python_dir.is_none() {
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)
-> DebuggerCommands {
use std::io::{BufferedReader, File};
use std::old_io::{BufferedReader, File};
let command_directive = format!("{}-command", debugger_prefix);
let check_directive = format!("{}-check", debugger_prefix);
@ -1224,7 +1224,7 @@ fn compose_and_run_compiler(
fn ensure_dir(path: &Path) {
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,

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`:
```{rust,no_run}
use std::io;
use std::old_io;
fn main() {
println!("Guess the number!");
println!("Please input your guess.");
let input = io::stdin().read_line()
let input = old_io::stdin().read_line()
.ok()
.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:
```{rust,ignore}
use std::io;
use std::old_io;
use std::rand;
fn main() {
@ -133,7 +133,7 @@ fn main() {
println!("Please input your guess.");
let input = io::stdin().read_line()
let input = old_io::stdin().read_line()
.ok()
.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:
```{rust,no_run}
use std::io;
use std::old_io;
use std::rand;
fn main() {
@ -192,7 +192,7 @@ fn main() {
println!("Please input your guess.");
let input = io::stdin().read_line()
let input = old_io::stdin().read_line()
.ok()
.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:
```{rust,no_run}
use std::io;
use std::old_io;
use std::rand;
fn main() {
@ -245,7 +245,7 @@ fn main() {
println!("Please input your guess.");
let input = io::stdin().read_line()
let input = old_io::stdin().read_line()
.ok()
.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:
```{rust,ignore}
use std::io;
use std::old_io;
use std::rand;
use std::cmp::Ordering;
@ -289,7 +289,7 @@ fn main() {
println!("Please input your guess.");
let input = io::stdin().read_line()
let input = old_io::stdin().read_line()
.ok()
.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:
```{rust,ignore}
use std::io;
use std::old_io;
use std::rand;
use std::cmp::Ordering;
@ -344,7 +344,7 @@ fn main() {
println!("Please input your guess.");
let input = io::stdin().read_line()
let input = old_io::stdin().read_line()
.ok()
.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:
```{rust,ignore}
let input = io::stdin().read_line()
let input = old_io::stdin().read_line()
.ok()
.expect("Failed to read line");
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:
```{rust,ignore}
use std::io;
use std::old_io;
use std::rand;
use std::cmp::Ordering;
@ -442,7 +442,7 @@ fn main() {
println!("Please input your guess.");
let input = io::stdin().read_line()
let input = old_io::stdin().read_line()
.ok()
.expect("Failed to read line");
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:
```{rust,no_run}
use std::io;
use std::old_io;
use std::rand;
use std::cmp::Ordering;
@ -492,7 +492,7 @@ fn main() {
println!("Please input your guess.");
let input = io::stdin().read_line()
let input = old_io::stdin().read_line()
.ok()
.expect("Failed to read line");
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:
```{rust,no_run}
use std::io;
use std::old_io;
use std::rand;
use std::cmp::Ordering;
@ -559,7 +559,7 @@ fn main() {
println!("Please input your guess.");
let input = io::stdin().read_line()
let input = old_io::stdin().read_line()
.ok()
.expect("Failed to read line");
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:
```{rust,no_run}
use std::io;
use std::old_io;
use std::rand;
use std::cmp::Ordering;
@ -635,7 +635,7 @@ fn main() {
println!("Please input your guess.");
let input = io::stdin().read_line()
let input = old_io::stdin().read_line()
.ok()
.expect("Failed to read line");
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:
```{rust,no_run}
use std::io;
use std::old_io;
use std::rand;
use std::cmp::Ordering;
@ -711,7 +711,7 @@ fn main() {
println!("Please input your guess.");
let input = io::stdin().read_line()
let input = old_io::stdin().read_line()
.ok()
.expect("Failed to read line");
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}
use std::io;
use std::old_io;
use std::rand;
use std::cmp::Ordering;
@ -767,7 +767,7 @@ fn main() {
println!("Please input your guess.");
let input = io::stdin().read_line()
let input = old_io::stdin().read_line()
.ok()
.expect("Failed to read line");
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:
```{rust,no_run}
use std::io;
use std::old_io;
use std::rand;
use std::cmp::Ordering;
@ -844,7 +844,7 @@ fn main() {
println!("Please input your guess.");
let input = io::stdin().read_line()
let input = old_io::stdin().read_line()
.ok()
.expect("Failed to read line");
let input_num: Option<u32> = input.trim().parse();

View file

@ -8,7 +8,7 @@ and then prints it back out:
fn main() {
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);
}
@ -17,7 +17,7 @@ fn main() {
Let's go over these chunks, one by one:
```{rust,ignore}
std::io::stdin();
std::old_io::stdin();
```
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:
```{rust}
use std::io::stdin;
use std::old_io::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:
```{rust}
use std::io;
use std::old_io;
io::stdin();
old_io::stdin();
```
Let's update our example to use this style:
```{rust,ignore}
use std::io;
use std::old_io;
fn main() {
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);
}
@ -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:
```{rust,ignore}
use std::io;
use std::old_io;
fn main() {
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);
}
@ -136,14 +136,14 @@ With long lines like this, Rust gives you some flexibility with the whitespace.
We _could_ write the example like this:
```{rust,ignore}
use std::io;
use std::old_io;
fn main() {
println!("Type something!");
// 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>
.ok() // Option<String>
.expect("Failed to read line"); // String

View file

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

View file

@ -95,7 +95,7 @@
//! by the [`Writer`](../io/trait.Writer.html) trait:
//!
//! ```
//! use std::io::IoError;
//! use std::old_io::IoError;
//!
//! trait Writer {
//! fn write_line(&mut self, s: &str) -> Result<(), IoError>;
@ -110,7 +110,7 @@
//! something like this:
//!
//! ```{.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);
//! // If `write_line` errors, then we'll never know, because the return
@ -128,7 +128,7 @@
//! a marginally useful message indicating why:
//!
//! ```{.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);
//! file.write_line("important message").ok().expect("failed to write message");
@ -138,7 +138,7 @@
//! You might also simply assert success:
//!
//! ```{.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);
//! assert!(file.write_line("important message").is_ok());
@ -148,7 +148,7 @@
//! 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> {
//! let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write);
//! try!(file.write_line("important message"));
@ -167,7 +167,7 @@
//! It replaces this:
//!
//! ```
//! use std::io::{File, Open, Write, IoError};
//! use std::old_io::{File, Open, Write, IoError};
//!
//! struct Info {
//! name: String,
@ -191,7 +191,7 @@
//! With this:
//!
//! ```
//! use std::io::{File, Open, Write, IoError};
//! use std::old_io::{File, Open, Write, IoError};
//!
//! struct Info {
//! name: String,
@ -444,7 +444,7 @@ impl<T, E> Result<T, E> {
/// 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";
///

View file

@ -96,7 +96,7 @@
//! ```no_run
//! # pub fn render_to<W:Writer>(output: &mut W) { unimplemented!() }
//! pub fn main() {
//! use std::io::File;
//! use std::old_io::File;
//! let mut f = File::create(&Path::new("example1.dot"));
//! render_to(&mut f)
//! }
@ -188,7 +188,7 @@
//! ```no_run
//! # pub fn render_to<W:Writer>(output: &mut W) { unimplemented!() }
//! pub fn main() {
//! use std::io::File;
//! use std::old_io::File;
//! let mut f = File::create(&Path::new("example2.dot"));
//! render_to(&mut f)
//! }
@ -252,7 +252,7 @@
//! ```no_run
//! # pub fn render_to<W:Writer>(output: &mut W) { unimplemented!() }
//! pub fn main() {
//! use std::io::File;
//! use std::old_io::File;
//! let mut f = File::create(&Path::new("example3.dot"));
//! render_to(&mut f)
//! }
@ -279,7 +279,7 @@
use self::LabelText::*;
use std::borrow::IntoCow;
use std::io;
use std::old_io;
use std::string::CowString;
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.)
pub fn render<'a, N:Clone+'a, E:Clone+'a, G:Labeller<'a,N,E>+GraphWalk<'a,N,E>, W:Writer>(
g: &'a G,
w: &mut W) -> io::IoResult<()> {
w: &mut W) -> old_io::IoResult<()> {
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>(
g: &'a G,
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)); }
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(" ")
}
@ -590,7 +590,7 @@ mod tests {
use self::NodeLabels::*;
use super::{Id, Labeller, Nodes, Edges, GraphWalk, render};
use super::LabelText::{self, LabelStr, EscStr};
use std::io::IoResult;
use std::old_io::IoResult;
use std::borrow::IntoCow;
use std::iter::repeat;

View file

@ -174,8 +174,8 @@
use std::cell::RefCell;
use std::fmt;
use std::io::LineBufferedWriter;
use std::io;
use std::old_io::LineBufferedWriter;
use std::old_io;
use std::mem;
use std::os;
use std::ptr;
@ -232,7 +232,7 @@ pub trait Logger {
}
struct DefaultLogger {
handle: LineBufferedWriter<io::stdio::StdWriter>,
handle: LineBufferedWriter<old_io::stdio::StdWriter>,
}
/// 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| {
s.borrow_mut().take()
}).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 {
level: LogLevel(level),

View file

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

View file

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

View file

@ -34,8 +34,8 @@ use middle::astencode::vtable_decoder_helpers;
use std::collections::HashMap;
use std::hash::{self, Hash, SipHasher};
use std::io::extensions::u64_from_be_bytes;
use std::io;
use std::old_io::extensions::u64_from_be_bytes;
use std::old_io;
use std::num::FromPrimitive;
use std::rc::Rc;
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,
out: &mut io::Writer) -> io::IoResult<()> {
out: &mut old_io::Writer) -> old_io::IoResult<()> {
try!(write!(out, "=Crate Attributes ({})=\n", *hash));
let r = get_attributes(md);
@ -1223,7 +1223,7 @@ pub fn get_crate_deps(data: &[u8]) -> Vec<CrateDep> {
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"));
for dep in get_crate_deps(data).iter() {
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")
}
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 md = rbml::Doc::new(bytes);
try!(list_crate_attributes(md, &hash, out));

View file

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

View file

@ -231,8 +231,8 @@ use rustc_back::target::Target;
use std::ffi::CString;
use std::cmp;
use std::collections::HashMap;
use std::io::fs::PathExtensions;
use std::io;
use std::old_io::fs::PathExtensions;
use std::old_io;
use std::ptr;
use std::slice;
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
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) {
Ok(bytes) => decoder::list_crate_metadata(bytes.as_slice(), out),
Err(msg) => {

View file

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

View file

@ -19,7 +19,7 @@ pub use self::EntryOrExit::*;
use middle::cfg;
use middle::cfg::CFGIndex;
use middle::ty;
use std::io;
use std::old_io;
use std::uint;
use std::iter::repeat;
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> {
fn pre(&self,
ps: &mut pprust::State,
node: pprust::AnnNode) -> io::IoResult<()> {
node: pprust::AnnNode) -> old_io::IoResult<()> {
let id = match node {
pprust::NodeIdent(_) | pprust::NodeName(_) => 0,
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!("{}", {
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>,
blk: &ast::Block) -> io::IoResult<()> {
fn pretty_print_to(&self, wr: Box<old_io::Writer+'static>,
blk: &ast::Block) -> old_io::IoResult<()> {
let mut ps = pprust::rust_printer_annotated(wr, self);
try!(ps.cbox(pprust::indent_unit));
try!(ps.ibox(0u));

View file

@ -26,7 +26,7 @@ use util::nodemap::{FnvHashMap, FnvHashSet};
use util::ppaux::Repr;
use std::collections::hash_map::Entry::Vacant;
use std::io::{self, File};
use std::old_io::{self, File};
use std::os;
use std::sync::atomic::{AtomicBool, Ordering, ATOMIC_BOOL_INIT};
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>,
map: &ConstraintMap<'tcx>,
path: &str) -> io::IoResult<()> {
path: &str) -> old_io::IoResult<()> {
debug!("dump_region_constraints map (len: {}) path: {}", map.len(), path);
let g = ConstraintGraph::new(tcx, format!("region_constraints"), map);
let mut f = File::create(&Path::new(path));

View file

@ -118,7 +118,7 @@ use middle::ty::ClosureTyper;
use lint;
use util::nodemap::NodeMap;
use std::{fmt, io, uint};
use std::{fmt, old_io, uint};
use std::rc::Rc;
use std::iter::repeat;
use syntax::ast::{self, NodeId, Expr};
@ -693,10 +693,10 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
}
fn write_vars<F>(&self,
wr: &mut io::Writer,
wr: &mut old_io::Writer,
ln: LiveNode,
mut test: F)
-> io::IoResult<()> where
-> old_io::IoResult<()> where
F: FnMut(uint) -> LiveNode,
{
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 {
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));
self.write_vars(wr, ln, |idx| self.users[idx].reader);
write!(wr, " writes");

View file

@ -10,10 +10,10 @@
//! A helper class for dealing with static archives
use std::io::fs::PathExtensions;
use std::io::process::{Command, ProcessOutput};
use std::io::{fs, TempDir};
use std::io;
use std::old_io::fs::PathExtensions;
use std::old_io::process::{Command, ProcessOutput};
use std::old_io::{fs, TempDir};
use std::old_io;
use std::os;
use std::str;
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
/// 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,
&self.archive.slib_prefix[],
&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
/// then the object file also isn't added.
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
// as simple comparison is not enough - there
// might be also an extra name suffix
@ -205,7 +205,7 @@ impl<'a> ArchiveBuilder<'a> {
}
/// 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 new_file = self.work_dir.path().join(&filename);
try!(fs::copy(file, &new_file));
@ -274,8 +274,9 @@ impl<'a> ArchiveBuilder<'a> {
self.archive
}
fn add_archive<F>(&mut self, archive: &Path, name: &str, mut skip: F) -> io::IoResult<()> where
F: FnMut(&str) -> bool,
fn add_archive<F>(&mut self, archive: &Path, name: &str,
mut skip: F) -> old_io::IoResult<()>
where F: FnMut(&str) -> bool,
{
let loc = TempDir::new("rsar").unwrap();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -64,7 +64,7 @@ use rustc::metadata::creader::CrateOrString::Str;
use rustc::util::common::time;
use std::cmp::Ordering::Equal;
use std::io;
use std::old_io;
use std::iter::repeat;
use std::os;
use std::sync::mpsc::channel;
@ -133,7 +133,7 @@ fn run_compiler(args: &[String]) {
1u => {
let ifile = &matches.free[0][];
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();
(Input::Str(src), None)
} else {
@ -187,7 +187,7 @@ fn run_compiler(args: &[String]) {
if r.contains(&("ls".to_string())) {
match input {
Input::File(ref ifile) => {
let mut stdout = io::stdout();
let mut stdout = old_io::stdout();
list_metadata(&sess, &(*ifile), &mut stdout).unwrap();
}
Input::Str(_) => {
@ -590,7 +590,7 @@ fn parse_crate_attrs(sess: &Session, input: &Input) ->
}
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)
}
@ -603,8 +603,8 @@ pub fn monitor<F:FnOnce()+Send>(f: F) {
static STACK_SIZE: uint = 8 * 1024 * 1024; // 8MB
let (tx, rx) = channel();
let w = io::ChanWriter::new(tx);
let mut r = io::ChanReader::new(rx);
let w = old_io::ChanWriter::new(tx);
let mut r = old_io::ChanReader::new(rx);
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);
}
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 */ }
Err(value) => {
// 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
// output with some unnecessary panic messages, we've already
// 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!();
}
}

View file

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

View file

@ -27,9 +27,9 @@ use util::common::time;
use util::ppaux;
use util::sha2::{Digest, Sha256};
use std::io::fs::PathExtensions;
use std::io::{fs, TempDir, Command};
use std::io;
use std::old_io::fs::PathExtensions;
use std::old_io::{fs, TempDir, Command};
use std::old_io;
use std::mem;
use std::str;
use std::string::String;
@ -425,7 +425,7 @@ pub fn invalid_output_for_target(sess: &Session,
fn is_writeable(p: &Path) -> bool {
match p.stat() {
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,
bc_data_deflated: &[u8])
-> ::std::io::IoResult<()> {
-> ::std::old_io::IoResult<()> {
let bc_data_deflated_size: u64 = bc_data_deflated.len() as u64;
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
// permissions, but the original file may have been installed
// 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(..) => {}
Err(e) => {
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 std::ffi::{self, CString};
use std::io::Command;
use std::io::fs;
use std::old_io::Command;
use std::old_io::fs;
use std::iter::Unfold;
use std::ptr;
use std::str;
@ -728,9 +728,9 @@ pub fn run_passes(sess: &Session,
println!("{:?}", &cmd);
}
cmd.stdin(::std::io::process::Ignored)
.stdout(::std::io::process::InheritFd(1))
.stderr(::std::io::process::InheritFd(2));
cmd.stdin(::std::old_io::process::Ignored)
.stdout(::std::old_io::process::InheritFd(1))
.stderr(::std::old_io::process::InheritFd(2));
match cmd.status() {
Ok(status) => {
if !status.success() {

View file

@ -33,7 +33,7 @@ use middle::def;
use middle::ty::{self, Ty};
use std::cell::Cell;
use std::io::{self, File, fs};
use std::old_io::{self, File, fs};
use std::os;
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 {}: {}",
root_path.display(), e)[]),
_ => (),

View file

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

View file

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

View file

@ -9,7 +9,7 @@
// except according to those terms.
use std::fmt;
use std::io;
use std::old_io;
use externalfiles::ExternalHtml;
@ -31,8 +31,8 @@ pub struct Page<'a> {
}
pub fn render<T: fmt::Display, S: fmt::Display>(
dst: &mut io::Writer, layout: &Layout, page: &Page, sidebar: &S, t: &T)
-> io::IoResult<()>
dst: &mut old_io::Writer, layout: &Layout, page: &Page, sidebar: &S, t: &T)
-> old_io::IoResult<()>
{
write!(dst,
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.
write!(dst,
r##"<!DOCTYPE html>

View file

@ -39,9 +39,9 @@ use std::cmp::Ordering;
use std::collections::{HashMap, HashSet};
use std::default::Default;
use std::fmt;
use std::io::fs::PathExtensions;
use std::io::{fs, File, BufferedWriter, BufferedReader};
use std::io;
use std::old_io::fs::PathExtensions;
use std::old_io::{fs, File, BufferedWriter, BufferedReader};
use std::old_io;
use std::iter::repeat;
use std::str;
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,
external_html: &ExternalHtml,
dst: Path,
passes: HashSet<String>) -> io::IoResult<()> {
passes: HashSet<String>) -> old_io::IoResult<()> {
let mut cx = Context {
dst: dst,
src_root: krate.src.dir_path(),
@ -391,7 +391,7 @@ pub fn run(mut krate: clean::Crate,
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
let mut nodeid_to_pathid = HashMap::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,
krate: &clean::Crate,
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
// docs placed in the output directory, so this needs to be a synchronized
// operation with respect to all other rustdocs running around.
@ -517,7 +517,7 @@ fn write_shared(cx: &Context,
include_bytes!("static/SourceCodePro-Semibold.woff")));
fn collect(path: &Path, krate: &str,
key: &str) -> io::IoResult<Vec<String>> {
key: &str) -> old_io::IoResult<Vec<String>> {
let mut ret = Vec::new();
if path.exists() {
for line in BufferedReader::new(File::open(path)).lines() {
@ -607,7 +607,7 @@ fn write_shared(cx: &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");
let dst = cx.dst.join("src");
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
/// 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)
}
/// Makes a directory on the filesystem, failing the task if an error occurs and
/// skipping if the directory already exists.
fn mkdir(path: &Path) -> io::IoResult<()> {
fn mkdir(path: &Path) -> old_io::IoResult<()> {
if !path.exists() {
fs::mkdir(path, io::USER_RWX)
fs::mkdir(path, old_io::USER_RWX)
} else {
Ok(())
}
@ -736,7 +736,7 @@ impl<'a> DocFolder for SourceCollector<'a> {
impl<'a> SourceCollector<'a> {
/// 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);
// 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
/// parallelization to this function.
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() {
Some(i) => i,
None => return Ok(())
@ -1134,11 +1134,11 @@ impl Context {
/// all sub-items which need to be rendered.
///
/// 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),
{
fn render(w: io::File, cx: &Context, it: &clean::Item,
pushname: bool) -> io::IoResult<()> {
fn render(w: old_io::File, cx: &Context, it: &clean::Item,
pushname: bool) -> old_io::IoResult<()> {
info!("Rendering an item to {}", w.path().display());
// A little unfortunate that this is done like this, but it sure
// 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::collections::HashMap;
use std::io::File;
use std::io;
use std::old_io::File;
use std::old_io;
use std::rc::Rc;
use externalfiles::ExternalHtml;
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
/// destination.
fn json_output(krate: clean::Crate, res: Vec<plugins::PluginJson> ,
dst: Path) -> io::IoResult<()> {
dst: Path) -> old_io::IoResult<()> {
// {
// "schema": version,
// "crate": { parsed crate ... },

View file

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

View file

@ -11,8 +11,8 @@
use std::cell::RefCell;
use std::sync::mpsc::channel;
use std::dynamic_lib::DynamicLibrary;
use std::io::{Command, TempDir};
use std::io;
use std::old_io::{Command, TempDir};
use std::old_io;
use std::os;
use std::str;
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
// not print things by default to the actual stderr.
let (tx, rx) = channel();
let w1 = io::ChanWriter::new(tx);
let w1 = old_io::ChanWriter::new(tx);
let w2 = w1.clone();
let old = io::stdio::set_stderr(box w1);
let old = old_io::stdio::set_stderr(box w1);
Thread::spawn(move |:| {
let mut p = io::ChanReader::new(rx);
let mut p = old_io::ChanReader::new(rx);
let mut err = match old {
Some(old) => {
// Chop off the `Send` bound.
let old: Box<Writer> = 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);
@ -200,7 +200,7 @@ fn runtest(test: &str, cratename: &str, libs: SearchPaths,
match cmd.output() {
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?"
} else { "" }),
Ok(out) => {

View file

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

View file

@ -14,12 +14,12 @@ use prelude::v1::*;
use any::Any;
use cell::RefCell;
use io::IoResult;
use old_io::IoResult;
use rt::{backtrace, unwind};
use rt::util::{Stderr, Stdio};
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! {
pub static LOCAL_STDERR: RefCell<Option<Box<Writer + Send>>> = {
RefCell::new(None)

View file

@ -238,7 +238,7 @@
//!
//! ```ignore
//! 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
//! print! // the format string is printed to the standard output
//! println! // same as print but appends a newline
@ -255,10 +255,8 @@
//!
//! ```rust
//! # #![allow(unused_must_use)]
//! use std::io;
//!
//! let mut w = Vec::new();
//! write!(&mut w as &mut io::Writer, "Hello {}!", "world");
//! write!(&mut w, "Hello {}!", "world");
//! ```
//!
//! #### `print!`
@ -282,15 +280,15 @@
//!
//! ```
//! use std::fmt;
//! use std::io;
//! use std::old_io;
//!
//! fmt::format(format_args!("this returns {}", "String"));
//!
//! let some_writer: &mut io::Writer = &mut io::stdout();
//! write!(some_writer, "{}", format_args!("print with a {}", "macro"));
//! let mut some_writer = old_io::stdout();
//! write!(&mut some_writer, "{}", format_args!("print with a {}", "macro"));
//!
//! 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"));
//! ```

View file

@ -81,14 +81,14 @@ macro_rules! format {
#[macro_export]
#[stable]
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.
///
/// 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
/// information, see `std::fmt` and `std::io::stdio`.
/// information, see `std::fmt` and `std::old_io::stdio`.
///
/// # Example
///
@ -99,7 +99,7 @@ macro_rules! print {
#[macro_export]
#[stable]
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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -80,11 +80,11 @@ impl<T, A: Acceptor<T>> Acceptor<T> for IoResult<A> {
mod test {
use prelude::v1::*;
use super::super::mem::*;
use io;
use old_io;
#[test]
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.flush().unwrap();
assert_eq!(writer.unwrap(), vec!(0, 1, 2));
@ -92,22 +92,22 @@ mod test {
#[test]
fn test_option_writer_error() {
let mut writer: io::IoResult<Vec<u8>> =
Err(io::standard_error(io::EndOfFile));
let mut writer: old_io::IoResult<Vec<u8>> =
Err(old_io::standard_error(old_io::EndOfFile));
match writer.write(&[0, 0, 0]) {
Ok(..) => panic!(),
Err(e) => assert_eq!(e.kind, io::EndOfFile),
Err(e) => assert_eq!(e.kind, old_io::EndOfFile),
}
match writer.flush() {
Ok(..) => panic!(),
Err(e) => assert_eq!(e.kind, io::EndOfFile),
Err(e) => assert_eq!(e.kind, old_io::EndOfFile),
}
}
#[test]
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)));
let mut buf = [0, 0];
reader.read(&mut buf).unwrap();
@ -117,13 +117,13 @@ mod test {
#[test]
fn test_option_reader_error() {
let mut reader: io::IoResult<MemReader> =
Err(io::standard_error(io::EndOfFile));
let mut reader: old_io::IoResult<MemReader> =
Err(old_io::standard_error(old_io::EndOfFile));
let mut buf = [];
match reader.read(&mut buf) {
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
//! # #![allow(unused_must_use)]
//! use std::io;
//! use std::old_io;
//!
//! let mut out = old_io::stdout();
//! out.write(b"Hello, world!");
@ -141,7 +141,7 @@ impl StdinReader {
/// # Examples
///
/// ```rust
/// use std::io;
/// use std::old_io;
///
/// for line in old_io::stdin().lock().lines() {
/// println!("{}", line.unwrap());

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -43,6 +43,6 @@
// NB: remove when path reform lands
#[doc(no_inline)] pub use path::{Path, GenericPath};
// 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
#[doc(no_inline)] pub use iter::range;

View file

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

View file

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

View file

@ -10,7 +10,7 @@
//! A wrapper around any Reader to treat it as an RNG.
use io::Reader;
use old_io::Reader;
use rand::Rng;
use result::Result::{Ok, Err};
use slice::SliceExt;
@ -26,7 +26,7 @@ use slice::SliceExt;
///
/// ```rust
/// 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)));
/// println!("{:x}", rng.gen::<uint>());
@ -77,7 +77,7 @@ mod test {
use prelude::v1::*;
use super::ReaderRng;
use io::MemReader;
use old_io::MemReader;
use num::Int;
use rand::Rng;

View file

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

View file

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

View file

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

View file

@ -14,9 +14,9 @@ use self::InAddr::*;
use ffi::CString;
use ffi;
use io::net::addrinfo;
use io::net::ip::{SocketAddr, IpAddr, Ipv4Addr, Ipv6Addr};
use io::{IoResult, IoError};
use old_io::net::addrinfo;
use old_io::net::ip::{SocketAddr, IpAddr, Ipv4Addr, Ipv6Addr};
use old_io::{IoResult, IoError};
use libc::{self, c_char, c_int};
use mem;
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 sys_common::{self, keep_going, short_write, timeout};
use cmp;
use io;
use old_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 {
kind: io::InvalidInput,
kind: old_io::InvalidInput,
desc: "invalid argument",
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
// the I/O operation.
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());
return Err(short_write(written, "short write"))
}

View file

@ -86,7 +86,7 @@
use prelude::v1::*;
use ffi;
use io::IoResult;
use old_io::IoResult;
use libc;
use mem;
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
// tracing
pub fn write(w: &mut Writer) -> IoResult<()> {
use io::IoError;
use old_io::IoError;
struct Context<'a> {
idx: int,

View file

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

View file

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

View file

@ -18,7 +18,7 @@
use prelude::v1::*;
use ffi;
use io::{self, IoResult, IoError};
use old_io::{self, IoResult, IoError};
use libc;
use num::{Int, SignedInt};
use num;
@ -94,35 +94,35 @@ pub fn last_gai_error(s: libc::c_int) -> IoError {
pub fn decode_error(errno: i32) -> IoError {
// FIXME: this should probably be a bit more descriptive...
let (kind, desc) = match errno {
libc::EOF => (io::EndOfFile, "end of file"),
libc::ECONNREFUSED => (io::ConnectionRefused, "connection refused"),
libc::ECONNRESET => (io::ConnectionReset, "connection reset"),
libc::EOF => (old_io::EndOfFile, "end of file"),
libc::ECONNREFUSED => (old_io::ConnectionRefused, "connection refused"),
libc::ECONNRESET => (old_io::ConnectionReset, "connection reset"),
libc::EPERM | libc::EACCES =>
(io::PermissionDenied, "permission denied"),
libc::EPIPE => (io::BrokenPipe, "broken pipe"),
libc::ENOTCONN => (io::NotConnected, "not connected"),
libc::ECONNABORTED => (io::ConnectionAborted, "connection aborted"),
libc::EADDRNOTAVAIL => (io::ConnectionRefused, "address not available"),
libc::EADDRINUSE => (io::ConnectionRefused, "address in use"),
libc::ENOENT => (io::FileNotFound, "no such file or directory"),
libc::EISDIR => (io::InvalidInput, "illegal operation on a directory"),
libc::ENOSYS => (io::IoUnavailable, "function not implemented"),
libc::EINVAL => (io::InvalidInput, "invalid argument"),
(old_io::PermissionDenied, "permission denied"),
libc::EPIPE => (old_io::BrokenPipe, "broken pipe"),
libc::ENOTCONN => (old_io::NotConnected, "not connected"),
libc::ECONNABORTED => (old_io::ConnectionAborted, "connection aborted"),
libc::EADDRNOTAVAIL => (old_io::ConnectionRefused, "address not available"),
libc::EADDRINUSE => (old_io::ConnectionRefused, "address in use"),
libc::ENOENT => (old_io::FileNotFound, "no such file or directory"),
libc::EISDIR => (old_io::InvalidInput, "illegal operation on a directory"),
libc::ENOSYS => (old_io::IoUnavailable, "function not implemented"),
libc::EINVAL => (old_io::InvalidInput, "invalid argument"),
libc::ENOTTY =>
(io::MismatchedFileTypeForOperation,
(old_io::MismatchedFileTypeForOperation,
"file descriptor is not a TTY"),
libc::ETIMEDOUT => (io::TimedOut, "operation timed out"),
libc::ECANCELED => (io::TimedOut, "operation aborted"),
libc::ETIMEDOUT => (old_io::TimedOut, "operation timed out"),
libc::ECANCELED => (old_io::TimedOut, "operation aborted"),
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,
// but different values on others, so we can't use a match
// clause
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 }
}

View file

@ -15,7 +15,7 @@ use prelude::v1::*;
use error::{FromError, Error};
use ffi::{self, CString};
use fmt;
use io::{IoError, IoResult};
use old_io::{IoError, IoResult};
use libc::{self, c_int, c_char, c_void};
use os::TMPBUF_SZ;
use os;
@ -198,7 +198,7 @@ pub fn load_self() -> Option<Vec<u8>> {
pub fn load_self() -> Option<Vec<u8>> {
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()),
Err(..) => None
}
@ -206,9 +206,9 @@ pub fn load_self() -> Option<Vec<u8>> {
#[cfg(any(target_os = "linux", target_os = "android"))]
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()),
Err(..) => None
}

View file

@ -15,7 +15,7 @@ use libc;
use mem;
use sync::{Arc, Mutex};
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::fs::{fd_t, FileDesc};
@ -41,7 +41,7 @@ fn addr_to_sockaddr_un(addr: &CString,
let len = addr.len();
if len > s.sun_path.len() - 1 {
return Err(IoError {
kind: io::InvalidInput,
kind: old_io::InvalidInput,
desc: "invalid argument: path must be smaller than SUN_LEN",
detail: None,
})

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -19,7 +19,7 @@ use diagnostics;
use std::cell::{RefCell, Cell};
use std::fmt;
use std::io;
use std::old_io;
use std::iter::range;
use std::string::String;
use term::WriterWrapper;
@ -266,7 +266,7 @@ impl Level {
fn print_maybe_styled(w: &mut EmitterWriter,
msg: &str,
color: term::attr::Attr) -> io::IoResult<()> {
color: term::attr::Attr) -> old_io::IoResult<()> {
match w.dst {
Terminal(ref mut t) => {
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,
msg: &str, code: Option<&str>) -> io::IoResult<()> {
msg: &str, code: Option<&str>) -> old_io::IoResult<()> {
if !topic.is_empty() {
try!(write!(&mut dst.dst, "{} ", topic));
}
@ -336,7 +336,7 @@ enum Destination {
impl EmitterWriter {
pub fn stderr(color_config: ColorConfig,
registry: Option<diagnostics::registry::Registry>) -> EmitterWriter {
let stderr = io::stderr();
let stderr = old_io::stderr();
let use_color = match color_config {
Always => true,
@ -362,7 +362,7 @@ impl EmitterWriter {
}
impl Writer for Destination {
fn write(&mut self, bytes: &[u8]) -> io::IoResult<()> {
fn write(&mut self, bytes: &[u8]) -> old_io::IoResult<()> {
match *self {
Terminal(ref mut t) => t.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,
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();
// We cannot check equality directly with COMMAND_LINE_SP
@ -446,7 +446,7 @@ fn highlight_lines(err: &mut EmitterWriter,
cm: &codemap::CodeMap,
sp: Span,
lvl: Level,
lines: codemap::FileLines) -> io::IoResult<()> {
lines: codemap::FileLines) -> old_io::IoResult<()> {
let fm = &*lines.file;
let mut elided = false;
@ -529,7 +529,7 @@ fn custom_highlight_lines(w: &mut EmitterWriter,
sp: Span,
lvl: Level,
lines: codemap::FileLines)
-> io::IoResult<()> {
-> old_io::IoResult<()> {
let fm = &*lines.file;
let lines = &lines.lines[];
@ -570,7 +570,7 @@ fn custom_highlight_lines(w: &mut EmitterWriter,
fn print_macro_backtrace(w: &mut EmitterWriter,
cm: &codemap::CodeMap,
sp: Span)
-> io::IoResult<()> {
-> old_io::IoResult<()> {
let cs = try!(cm.with_expn_info(sp.expn_id, |expn_info| match expn_info {
Some(ei) => {
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 util::small_vector::SmallVector;
use std::io::File;
use std::old_io::File;
use std::rc::Rc;
// 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)]
mod test {
use std::io;
use std::old_io;
use ast;
use util::parser_testing::{string_to_crate, matches_codepattern};
use parse::token;
@ -1440,7 +1440,7 @@ mod test {
// this version doesn't care about getting comments or docstrings in.
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())
}

View file

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

View file

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

View file

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

View file

@ -80,7 +80,7 @@ use ptr::P;
use owned_slice::OwnedSlice;
use std::collections::HashSet;
use std::io::fs::PathExtensions;
use std::old_io::fs::PathExtensions;
use std::iter;
use std::mem;
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
//! avoid combining it with other lines and making matters even worse.
use std::io;
use std::old_io;
use std::string;
use std::iter::repeat;
@ -161,7 +161,7 @@ pub struct PrintStackElem {
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
// fall behind.
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
/// called 'print'.
pub struct Printer {
pub out: Box<io::Writer+'static>,
pub out: Box<old_io::Writer+'static>,
buf_len: usize,
/// Width of lines we're constrained to
margin: isize,
@ -311,7 +311,7 @@ impl Printer {
pub fn replace_last_token(&mut self, t: Token) {
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);
match token {
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={}",
self.left, self.right, self.left_total, self.right_total);
if self.right_total - self.left_total > self.space {
@ -445,7 +445,7 @@ impl Printer {
self.right %= self.buf_len;
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,
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);
let ret = write!(self.out, "\n");
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 {
try!(write!(self.out, " "));
self.pending_indentation -= 1;
}
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,
self.space);
debug!("{}", buf_str(&self.token[],
@ -620,61 +620,61 @@ impl Printer {
// Convenience functions to talk to the printer.
//
// "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 {
offset: indent as isize,
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)
}
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)
}
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 {
offset: off,
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)
}
pub fn eof(p: &mut Printer) -> io::IoResult<()> {
pub fn eof(p: &mut Printer) -> old_io::IoResult<()> {
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))
}
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))
}
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))
}
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)
}
pub fn zerobreak(p: &mut Printer) -> io::IoResult<()> {
pub fn zerobreak(p: &mut Printer) -> old_io::IoResult<()> {
spaces(p, 0us)
}
pub fn space(p: &mut Printer) -> io::IoResult<()> {
pub fn space(p: &mut Printer) -> old_io::IoResult<()> {
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)
}

View file

@ -30,7 +30,7 @@ use print::pp::Breaks::{Consistent, Inconsistent};
use ptr::P;
use std::{ascii, mem};
use std::io::{self, IoResult};
use std::old_io::{self, IoResult};
use std::iter;
pub enum AnnNode<'a> {
@ -69,12 +69,12 @@ pub struct State<'a> {
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;
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> {
State {
s: pp::mk_printer(writer, default_columns),
@ -104,8 +104,8 @@ pub fn print_crate<'a>(cm: &'a CodeMap,
span_diagnostic: &diagnostic::SpanHandler,
krate: &ast::Crate,
filename: String,
input: &mut io::Reader,
out: Box<io::Writer+'static>,
input: &mut old_io::Reader,
out: Box<old_io::Writer+'static>,
ann: &'a PpAnn,
is_expanded: bool) -> IoResult<()> {
let mut s = State::new_from_input(cm,
@ -124,8 +124,8 @@ impl<'a> State<'a> {
pub fn new_from_input(cm: &'a CodeMap,
span_diagnostic: &diagnostic::SpanHandler,
filename: String,
input: &mut io::Reader,
out: Box<io::Writer+'static>,
input: &mut old_io::Reader,
out: Box<old_io::Writer+'static>,
ann: &'a PpAnn,
is_expanded: bool) -> State<'a> {
let (cmnts, lits) = comments::gather_comments_and_literals(
@ -145,7 +145,7 @@ impl<'a> State<'a> {
}
pub fn new(cm: &'a CodeMap,
out: Box<io::Writer+'static>,
out: Box<old_io::Writer+'static>,
ann: &'a PpAnn,
comments: Option<Vec<comments::Comment>>,
literals: Option<Vec<comments::Literal>>) -> State<'a> {
@ -173,7 +173,7 @@ pub fn to_string<F>(f: F) -> String where
f(&mut s).unwrap();
eof(&mut s.s).unwrap();
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
// downcasts.
let obj: &TraitObject = mem::transmute(&s.s.out);
@ -421,7 +421,7 @@ thing_to_string_impls! { to_string }
pub mod with_hygiene {
use abi;
use ast;
use std::io::IoResult;
use std::old_io::IoResult;
use super::indent_unit;
// This function is the trick that all the rest of the routines

View file

@ -61,7 +61,7 @@ pub use terminfo::TerminfoTerminal;
#[cfg(windows)]
pub use win::WinConsole;
use std::io::IoResult;
use std::old_io::IoResult;
pub mod terminfo;
@ -91,7 +91,7 @@ impl Writer for WriterWrapper {
/// opened.
pub fn stdout() -> Option<Box<Terminal<WriterWrapper> + Send>> {
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.
pub fn stdout() -> Option<Box<Terminal<WriterWrapper> + Send>> {
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 {
Some(t) => Some(t),
None => {
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.
pub fn stderr() -> Option<Box<Terminal<WriterWrapper> + Send>> {
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.
pub fn stderr() -> Option<Box<Terminal<WriterWrapper> + Send>> {
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 {
Some(t) => Some(t),
None => {
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.
use std::collections::HashMap;
use std::io::IoResult;
use std::old_io::IoResult;
use std::os;
use attr;

View file

@ -13,7 +13,7 @@
//! ncurses-compatible compiled terminfo format parsing (term(5))
use std::collections::HashMap;
use std::io;
use std::old_io;
use super::super::TermInfo;
// 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"];
/// 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> {
macro_rules! try { ($e:expr) => (
match $e {
@ -340,6 +340,6 @@ mod test {
#[ignore(reason = "no ncurses on buildbots, needs a bundled terminfo file to test against")]
fn test_parse() {
// 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!
use std::io::File;
use std::io::fs::PathExtensions;
use std::old_io::File;
use std::old_io::fs::PathExtensions;
use std::os::getenv;
use std::os;

View file

@ -60,9 +60,9 @@ use std::any::Any;
use std::cmp;
use std::collections::BTreeMap;
use std::fmt;
use std::io::stdio::StdWriter;
use std::io::{File, ChanReader, ChanWriter};
use std::io;
use std::old_io::stdio::StdWriter;
use std::old_io::{File, ChanReader, ChanWriter};
use std::old_io;
use std::iter::repeat;
use std::num::{Float, Int};
use std::os;
@ -443,13 +443,13 @@ struct ConsoleTestState<T> {
impl<T: Writer> ConsoleTestState<T> {
pub fn new(opts: &TestOpts,
_: Option<T>) -> io::IoResult<ConsoleTestState<StdWriter>> {
_: Option<T>) -> old_io::IoResult<ConsoleTestState<StdWriter>> {
let log_out = match opts.logfile {
Some(ref path) => Some(try!(File::create(path))),
None => None
};
let out = match term::stdout() {
None => Raw(io::stdio::stdout_raw()),
None => Raw(old_io::stdio::stdout_raw()),
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)
}
pub fn write_failed(&mut self) -> io::IoResult<()> {
pub fn write_failed(&mut self) -> old_io::IoResult<()> {
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)
}
pub fn write_metric(&mut self) -> io::IoResult<()> {
pub fn write_metric(&mut self) -> old_io::IoResult<()> {
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)
}
pub fn write_pretty(&mut self,
word: &str,
color: term::color::Color) -> io::IoResult<()> {
color: term::color::Color) -> old_io::IoResult<()> {
match self.out {
Pretty(ref mut term) => {
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 {
Pretty(ref mut term) => term.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;
let noun = if len != 1 { "tests" } else { "test" };
self.write_plain(format!("\nrunning {} {}\n", len, noun).as_slice())
}
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);
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 {
TrOk => self.write_ok(),
TrFailed => self.write_failed(),
@ -547,7 +547,7 @@ impl<T: Writer> ConsoleTestState<T> {
}
pub fn write_log(&mut self, test: &TestDesc,
result: &TestResult) -> io::IoResult<()> {
result: &TestResult) -> old_io::IoResult<()> {
match self.log_out {
None => Ok(()),
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"));
let mut failures = Vec::new();
let mut fail_out = String::new();
@ -591,7 +591,7 @@ impl<T: Writer> ConsoleTestState<T> {
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);
let success = self.failed == 0u;
@ -627,9 +627,10 @@ pub fn fmt_bench_samples(bs: &BenchSamples) -> String {
}
// 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() {
TeFiltered(ref filtered_tests) => st.write_run_start(filtered_tests.len()),
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 {
match opts.color {
AutoColor => get_concurrency() == 1 && io::stdout().get_ref().isatty(),
AutoColor => get_concurrency() == 1 && old_io::stdout().get_ref().isatty(),
AlwaysColor => true,
NeverColor => false,
}
@ -745,8 +746,8 @@ pub type MonitorMsg = (TestDesc, TestResult, Vec<u8> );
fn run_tests<F>(opts: &TestOpts,
tests: Vec<TestDescAndFn> ,
mut callback: F) -> io::IoResult<()> where
F: FnMut(TestEvent) -> io::IoResult<()>,
mut callback: F) -> old_io::IoResult<()> where
F: FnMut(TestEvent) -> old_io::IoResult<()>,
{
let filtered_tests = filter_tests(opts, tests);
let filtered_descs = filtered_tests.iter()
@ -1119,7 +1120,7 @@ mod tests {
TestDesc, TestDescAndFn, TestOpts, run_test,
Metric, MetricMap,
StaticTestName, DynTestName, DynTestFn, ShouldFail};
use std::io::TempDir;
use std::old_io::TempDir;
use std::thunk::Thunk;
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 {
use stats::Stats;
use stats::Summary;
use std::io;
use std::old_io;
use std::f64;
macro_rules! assert_approx_eq {
@ -367,7 +367,7 @@ mod tests {
let summ2 = Summary::new(samples);
let mut w = io::stdout();
let mut w = old_io::stdout();
let w = &mut w;
(write!(w, "\n")).unwrap();

View file

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

View file

@ -11,8 +11,8 @@
//! Implementation of the `build` subcommand, used to compile a book.
use std::os;
use std::io;
use std::io::{fs, File, BufferedWriter, TempDir, IoResult};
use std::old_io;
use std::old_io::{fs, File, BufferedWriter, TempDir, IoResult};
use subcommand::Subcommand;
use term::Term;
@ -119,7 +119,7 @@ fn render(book: &Book, tgt: &Path) -> CliResult<()> {
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] = &[
"".to_string(),
@ -165,7 +165,7 @@ impl Subcommand for Build {
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));

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -146,7 +146,7 @@ fn make_sequence_processor(sz: uint,
// given a FASTA file on stdin, process sequence THREE
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 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() {
let input = if std::os::getenv("RUST_BENCH").is_some() {
let fd = std::io::File::open(&Path::new("shootout-k-nucleotide.data"));
get_sequence(&mut std::io::BufferedReader::new(fd), ">THREE")
let fd = std::old_io::File::open(&Path::new("shootout-k-nucleotide.data"));
get_sequence(&mut std::old_io::BufferedReader::new(fd), ">THREE")
} else {
get_sequence(&mut *std::io::stdin().lock(), ">THREE")
get_sequence(&mut *std::old_io::stdin().lock(), ">THREE")
};
let input = Arc::new(input);

View file

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

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