std: Deprecate std::old_io::fs

This commit deprecates the majority of std::old_io::fs in favor of std::fs and
its new functionality. Some functions remain non-deprecated but are now behind a
feature gate called `old_fs`. These functions will be deprecated once
suitable replacements have been implemented.

The compiler has been migrated to new `std::fs` and `std::path` APIs where
appropriate as part of this change.
This commit is contained in:
Alex Crichton
2015-02-26 21:00:43 -08:00
parent 3b3bb0e682
commit 95d904625b
80 changed files with 1430 additions and 1209 deletions

View File

@@ -8,7 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::fs::File;
use std::io::Write;
use std::old_io;
use std::path::{PathBuf, Path};
use core;
use getopts;
@@ -40,10 +43,10 @@ fn extract_leading_metadata<'a>(s: &'a str) -> (Vec<&'a str>, &'a str) {
/// Render `input` (e.g. "foo.md") into an HTML file in `output`
/// (e.g. output = "bar" => "bar/foo.html").
pub fn render(input: &str, mut output: Path, matches: &getopts::Matches,
pub fn render(input: &str, mut output: PathBuf, matches: &getopts::Matches,
external_html: &ExternalHtml, include_toc: bool) -> int {
let input_p = Path::new(input);
output.push(input_p.filestem().unwrap());
output.push(input_p.file_stem().unwrap());
output.set_extension("html");
let mut css = String::new();
@@ -59,7 +62,7 @@ pub fn render(input: &str, mut output: Path, matches: &getopts::Matches,
}
let playground = playground.unwrap_or("".to_string());
let mut out = match old_io::File::create(&output) {
let mut out = match File::create(&output) {
Err(e) => {
let _ = writeln!(&mut old_io::stderr(),
"error opening `{}` for writing: {}",