Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilize std::path #23229

Merged
merged 1 commit into from
Mar 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/compiletest/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#![feature(std_misc)]
#![feature(test)]
#![feature(core)]
#![feature(path)]
#![feature(io)]
#![feature(net)]
#![feature(path_ext)]
Expand Down
2 changes: 2 additions & 0 deletions src/compiletest/procsrv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![allow(deprecated)] // for old path, for dynamic_lib

use std::process::{ExitStatus, Command, Child, Output, Stdio};
use std::io::prelude::*;
use std::dynamic_lib::DynamicLibrary;
Expand Down
1 change: 0 additions & 1 deletion src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#![feature(unsafe_destructor)]
#![feature(staged_api)]
#![feature(std_misc)]
#![feature(path)]
#![feature(io)]
#![feature(path_ext)]
#![feature(str_words)]
Expand Down
4 changes: 4 additions & 0 deletions src/librustc/plugin/load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ use std::borrow::ToOwned;
use std::dynamic_lib::DynamicLibrary;
use std::env;
use std::mem;

#[allow(deprecated)]
use std::old_path;

use std::path::PathBuf;
use syntax::ast;
use syntax::codemap::{Span, COMMAND_LINE_SP};
Expand Down Expand Up @@ -100,6 +103,7 @@ impl<'a> PluginLoader<'a> {
}

// Dynamically link a registrar function into the compiler process.
#[allow(deprecated)] // until #23197
fn dylink_registrar(&mut self,
span: Span,
path: PathBuf,
Expand Down
1 change: 1 addition & 0 deletions src/librustc_back/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use std::io;
use std::old_io::fs;
use std::old_io;
#[allow(deprecated)]
use std::old_path;
use std::os;
use std::path::{Path, PathBuf};
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_back/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@
#![feature(old_io)]
#![feature(old_path)]
#![feature(os)]
#![feature(path)]
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(rand)]
#![feature(path_ext)]
#![feature(std_misc)]
#![feature(path_relative_from)]

extern crate syntax;
extern crate serialize;
Expand Down
1 change: 0 additions & 1 deletion src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#![feature(unsafe_destructor)]
#![feature(staged_api)]
#![feature(exit_status)]
#![feature(path)]
#![feature(io)]

extern crate arena;
Expand Down
1 change: 0 additions & 1 deletion src/librustc_llvm/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#![feature(libc)]
#![feature(link_args)]
#![feature(staged_api)]
#![feature(path)]
#![cfg_attr(unix, feature(std_misc))]

extern crate libc;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trans/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
#![feature(staged_api)]
#![feature(unicode)]
#![feature(io)]
#![feature(path)]
#![feature(path_ext)]
#![feature(fs)]
#![feature(hash)]
#![feature(path_relative_from)]

extern crate arena;
extern crate flate;
Expand Down
3 changes: 2 additions & 1 deletion src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
#![feature(unicode)]
#![feature(str_words)]
#![feature(io)]
#![feature(path)]
#![feature(file_path)]
#![feature(path_ext)]
#![feature(path_relative_from)]

extern crate arena;
extern crate getopts;
Expand Down Expand Up @@ -362,6 +362,7 @@ fn parse_externs(matches: &getopts::Matches) -> Result<core::Externs, String> {
/// generated from the cleaned AST of the crate.
///
/// This form of input will run all of the plug/cleaning passes
#[allow(deprecated)] // for old Path in plugin manager
fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matches) -> Output {
let mut default_passes = !matches.opt_present("no-defaults");
let mut passes = matches.opt_strs("passes");
Expand Down
2 changes: 2 additions & 0 deletions src/librustdoc/plugins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![allow(deprecated)] // old path, used for compatibility with dynamic lib

use clean;

use std::dynamic_lib as dl;
Expand Down
1 change: 0 additions & 1 deletion src/libserialize/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ Core encoding and decoding interfaces.
#![feature(staged_api)]
#![feature(std_misc)]
#![feature(unicode)]
#![feature(path)]
#![cfg_attr(test, feature(test))]

// test harness access
Expand Down
5 changes: 5 additions & 0 deletions src/libserialize/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
Core encoding and decoding interfaces.
*/

#[allow(deprecated)]
use std::old_path;
use std::path;
use std::rc::Rc;
Expand Down Expand Up @@ -539,25 +540,29 @@ macro_rules! tuple {

tuple! { T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, }

#[allow(deprecated)]
impl Encodable for old_path::posix::Path {
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
self.as_vec().encode(e)
}
}

#[allow(deprecated)]
impl Decodable for old_path::posix::Path {
fn decode<D: Decoder>(d: &mut D) -> Result<old_path::posix::Path, D::Error> {
let bytes: Vec<u8> = try!(Decodable::decode(d));
Ok(old_path::posix::Path::new(bytes))
}
}

#[allow(deprecated)]
impl Encodable for old_path::windows::Path {
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
self.as_vec().encode(e)
}
}

#[allow(deprecated)]
impl Decodable for old_path::windows::Path {
fn decode<D: Decoder>(d: &mut D) -> Result<old_path::windows::Path, D::Error> {
let bytes: Vec<u8> = try!(Decodable::decode(d));
Expand Down
1 change: 1 addition & 0 deletions src/libstd/dynamic_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#![unstable(feature = "std_misc")]
#![allow(missing_docs)]
#![allow(deprecated)] // will be addressed by #23197

use prelude::v1::*;

Expand Down
5 changes: 3 additions & 2 deletions src/libstd/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

use prelude::v1::*;

use iter::IntoIterator;
use error::Error;
use ffi::{OsString, AsOsStr};
use fmt;
Expand Down Expand Up @@ -338,9 +339,9 @@ pub struct JoinPathsError {
/// ```
#[stable(feature = "env", since = "1.0.0")]
pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError>
where I: Iterator<Item=T>, T: AsOsStr
where I: IntoIterator<Item=T>, T: AsOsStr
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sneaky sneaky (also yay!)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sweet

{
os_imp::join_paths(paths).map_err(|e| {
os_imp::join_paths(paths.into_iter()).map_err(|e| {
JoinPathsError { inner: e }
})
}
Expand Down
1 change: 1 addition & 0 deletions src/libstd/ffi/os_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ impl AsOsStr for String {
}
}

#[allow(deprecated)]
impl AsOsStr for Path {
#[cfg(unix)]
fn as_os_str(&self) -> &OsStr {
Expand Down
14 changes: 2 additions & 12 deletions src/libstd/fs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,18 +571,8 @@ pub fn create_dir<P: AsPath + ?Sized>(path: &P) -> io::Result<()> {
pub fn create_dir_all<P: AsPath + ?Sized>(path: &P) -> io::Result<()> {
let path = path.as_path();
if path.is_dir() { return Ok(()) }
match path.parent() {
Some(p) if p != path => try!(create_dir_all(p)),
_ => {}
}
// If the file name of the given `path` is blank then the creation of the
// parent directory will have taken care of the whole path for us, so we're
// good to go.
if path.file_name().is_none() {
Ok(())
} else {
create_dir(path)
}
if let Some(p) = path.parent() { try!(create_dir_all(p)) }
create_dir(path)
}

/// Remove an existing, empty directory
Expand Down
1 change: 1 addition & 0 deletions src/libstd/old_path/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
//! ```

#![unstable(feature = "old_path")]
#![deprecated(since = "1.0.0", reason = "use std::path instead")]
#![allow(deprecated)] // seriously this is all deprecated
#![allow(unused_imports)]

Expand Down
1 change: 1 addition & 0 deletions src/libstd/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#![allow(missing_docs)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(deprecated)]

use self::MemoryMapKind::*;
use self::MapOption::*;
Expand Down
Loading