diff options
| author | Brian Anderson <banderson@mozilla.com> | 2015-01-27 09:38:30 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2015-01-27 15:05:04 -0800 |
| commit | 71223050538939ed758fcd3b9114f71abff20bb2 (patch) | |
| tree | 43ddd18223904fa86601f1a0e16ebcbaddead270 /src/libsyntax | |
| parent | 3c172392cf0c86ffd1d7b39d3f44de98f77afc44 (diff) | |
| parent | 777435990e0e91df6b72ce80c9b6fa485eeb5daa (diff) | |
| download | rust-71223050538939ed758fcd3b9114f71abff20bb2.tar.gz rust-71223050538939ed758fcd3b9114f71abff20bb2.zip | |
Merge remote-tracking branch 'rust-lang/master'
Conflicts: src/libcore/cell.rs src/librustc_driver/test.rs src/libstd/old_io/net/tcp.rs src/libstd/old_io/process.rs
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast_map/mod.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/codemap.rs | 7 | ||||
| -rw-r--r-- | src/libsyntax/diagnostic.rs | 22 | ||||
| -rw-r--r-- | src/libsyntax/ext/source_util.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/fold.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/parse/lexer/comments.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/parse/lexer/mod.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/print/pp.rs | 44 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 20 |
11 files changed, 61 insertions, 60 deletions
diff --git a/src/libsyntax/ast_map/mod.rs b/src/libsyntax/ast_map/mod.rs index 8a114e4b748..96476cabac5 100644 --- a/src/libsyntax/ast_map/mod.rs +++ b/src/libsyntax/ast_map/mod.rs @@ -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; diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index a5e10f42750..e0d4f69a34c 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -364,9 +364,10 @@ impl CodeMap { }; // Append '\n' in case it's not already there. - // This is a workaround to prevent CodeMap.lookup_filemap_idx from accidentally - // overflowing into the next filemap in case the last byte of span is also the last - // byte of filemap, which leads to incorrect results from CodeMap.span_to_*. + // This is a workaround to prevent CodeMap.lookup_filemap_idx from + // accidentally overflowing into the next filemap in case the last byte + // of span is also the last byte of filemap, which leads to incorrect + // results from CodeMap.span_to_*. if src.len() > 0 && !src.ends_with("\n") { src.push('\n'); } diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index 01bb0e7a51c..f3e66897316 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -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; @@ -272,7 +272,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)); @@ -306,7 +306,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)); } @@ -342,7 +342,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, @@ -368,10 +368,10 @@ impl EmitterWriter { } impl Writer for Destination { - fn write(&mut self, bytes: &[u8]) -> io::IoResult<()> { + fn write_all(&mut self, bytes: &[u8]) -> old_io::IoResult<()> { match *self { - Terminal(ref mut t) => t.write(bytes), - Raw(ref mut w) => w.write(bytes), + Terminal(ref mut t) => t.write_all(bytes), + Raw(ref mut w) => w.write_all(bytes), } } } @@ -404,7 +404,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 @@ -452,7 +452,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; @@ -535,7 +535,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[]; @@ -576,7 +576,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)); diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index a74adbf4085..fbc591834d0 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -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 @@ -135,7 +135,7 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) let bytes = match File::open(&file).read_to_end() { Err(e) => { cx.span_err(sp, - &format!("couldn't read {:?}: {}", + &format!("couldn't read {}: {}", file.display(), e)[]); return DummyResult::expr(sp); @@ -146,7 +146,7 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) Ok(src) => { // Add this input file to the code map to make it available as // dependency information - let filename = format!("{:?}", file.display()); + let filename = format!("{}", file.display()); let interned = token::intern_and_get_ident(&src[]); cx.codemap().new_filemap(filename, src); @@ -154,7 +154,7 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) } Err(_) => { cx.span_err(sp, - &format!("{:?} wasn't a utf-8 file", + &format!("{} wasn't a utf-8 file", file.display())[]); return DummyResult::expr(sp); } @@ -171,7 +171,7 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) match File::open(&file).read_to_end() { Err(e) => { cx.span_err(sp, - &format!("couldn't read {:?}: {}", file.display(), e)[]); + &format!("couldn't read {}: {}", file.display(), e)[]); return DummyResult::expr(sp); } Ok(bytes) => { diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 9f8427cc8ae..bf822599a88 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -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()) } diff --git a/src/libsyntax/parse/lexer/comments.rs b/src/libsyntax/parse/lexer/comments.rs index c58136b30aa..926385ccd11 100644 --- a/src/libsyntax/parse/lexer/comments.rs +++ b/src/libsyntax/parse/lexer/comments.rs @@ -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(); diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 3b9dcf53009..99be1b11b11 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -1482,11 +1482,11 @@ 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); - let handler = diagnostic::mk_handler(box emitter); + let handler = diagnostic::mk_handler(true, box emitter); diagnostic::mk_span_handler(handler, CodeMap::new()) } diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 326aa1f3fc9..4bd476885a0 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -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; diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index eab24574bb1..fbea265597c 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -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; diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index 0b1bd282941..7fb2f9a80cc 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -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) } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index d06ac50920e..ae3c4addf38 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -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 |
