Rename std::path to std::old_path
As part of [RFC 474](https://github.com/rust-lang/rfcs/pull/474), this commit renames `std::path` to `std::old_path`, leaving the existing path API in place to ease migration to the new one. Updating should be as simple as adjusting imports, and the prelude still maps to the old path APIs for now. [breaking-change]
This commit is contained in:
parent
3b2ed14906
commit
3e39f0bc0e
26 changed files with 38 additions and 37 deletions
|
@ -51,7 +51,7 @@
|
||||||
//! use std::error::FromError;
|
//! use std::error::FromError;
|
||||||
//! use std::old_io::{File, IoError};
|
//! use std::old_io::{File, IoError};
|
||||||
//! use std::os::{MemoryMap, MapError};
|
//! use std::os::{MemoryMap, MapError};
|
||||||
//! use std::path::Path;
|
//! use std::old_path::Path;
|
||||||
//!
|
//!
|
||||||
//! enum MyError {
|
//! enum MyError {
|
||||||
//! Io(IoError),
|
//! Io(IoError),
|
||||||
|
|
|
@ -17,7 +17,7 @@ use std::cmp::Ordering;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::iter::FromIterator;
|
use std::iter::FromIterator;
|
||||||
use std::path::BytesContainer;
|
use std::old_path::BytesContainer;
|
||||||
use std::slice;
|
use std::slice;
|
||||||
|
|
||||||
// Note 1: It is not clear whether the flexibility of providing both
|
// Note 1: It is not clear whether the flexibility of providing both
|
||||||
|
|
|
@ -306,7 +306,7 @@ impl Target {
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
use std::old_io::File;
|
use std::old_io::File;
|
||||||
use std::path::Path;
|
use std::old_path::Path;
|
||||||
use serialize::json;
|
use serialize::json;
|
||||||
|
|
||||||
fn load_file(path: &Path) -> Result<Target, String> {
|
fn load_file(path: &Path) -> Result<Target, String> {
|
||||||
|
|
|
@ -1590,7 +1590,7 @@ fn compile_unit_metadata(cx: &CrateContext) -> DIDescriptor {
|
||||||
Some(ref p) if p.is_relative() => {
|
Some(ref p) if p.is_relative() => {
|
||||||
// prepend "./" if necessary
|
// prepend "./" if necessary
|
||||||
let dotdot = b"..";
|
let dotdot = b"..";
|
||||||
let prefix: &[u8] = &[dotdot[0], ::std::path::SEP_BYTE];
|
let prefix: &[u8] = &[dotdot[0], ::std::old_path::SEP_BYTE];
|
||||||
let mut path_bytes = p.as_vec().to_vec();
|
let mut path_bytes = p.as_vec().to_vec();
|
||||||
|
|
||||||
if &path_bytes[..2] != prefix &&
|
if &path_bytes[..2] != prefix &&
|
||||||
|
|
|
@ -49,7 +49,7 @@ use rustc::middle::stability;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::u32;
|
use std::u32;
|
||||||
use std::str::Str as StrTrait; // Conflicts with Str variant
|
use std::str::Str as StrTrait; // Conflicts with Str variant
|
||||||
use std::path::Path as FsPath; // Conflicts with Path struct
|
use std::old_path::Path as FsPath; // Conflicts with Path struct
|
||||||
|
|
||||||
use core::DocContext;
|
use core::DocContext;
|
||||||
use doctree;
|
use doctree;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
Core encoding and decoding interfaces.
|
Core encoding and decoding interfaces.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use std::path;
|
use std::old_path;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::cell::{Cell, RefCell};
|
use std::cell::{Cell, RefCell};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
@ -538,29 +538,29 @@ macro_rules! tuple {
|
||||||
|
|
||||||
tuple! { T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, }
|
tuple! { T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, }
|
||||||
|
|
||||||
impl Encodable for path::posix::Path {
|
impl Encodable for old_path::posix::Path {
|
||||||
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
|
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
|
||||||
self.as_vec().encode(e)
|
self.as_vec().encode(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Decodable for path::posix::Path {
|
impl Decodable for old_path::posix::Path {
|
||||||
fn decode<D: Decoder>(d: &mut D) -> Result<path::posix::Path, D::Error> {
|
fn decode<D: Decoder>(d: &mut D) -> Result<old_path::posix::Path, D::Error> {
|
||||||
let bytes: Vec<u8> = try!(Decodable::decode(d));
|
let bytes: Vec<u8> = try!(Decodable::decode(d));
|
||||||
Ok(path::posix::Path::new(bytes))
|
Ok(old_path::posix::Path::new(bytes))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Encodable for path::windows::Path {
|
impl Encodable for old_path::windows::Path {
|
||||||
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
|
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
|
||||||
self.as_vec().encode(e)
|
self.as_vec().encode(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Decodable for path::windows::Path {
|
impl Decodable for old_path::windows::Path {
|
||||||
fn decode<D: Decoder>(d: &mut D) -> Result<path::windows::Path, D::Error> {
|
fn decode<D: Decoder>(d: &mut D) -> Result<old_path::windows::Path, D::Error> {
|
||||||
let bytes: Vec<u8> = try!(Decodable::decode(d));
|
let bytes: Vec<u8> = try!(Decodable::decode(d));
|
||||||
Ok(path::windows::Path::new(bytes))
|
Ok(old_path::windows::Path::new(bytes))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ pub fn current_dir() -> IoResult<Path> {
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// use std::env;
|
/// use std::env;
|
||||||
/// use std::path::Path;
|
/// use std::old_path::Path;
|
||||||
///
|
///
|
||||||
/// let root = Path::new("/");
|
/// let root = Path::new("/");
|
||||||
/// assert!(env::set_current_dir(&root).is_ok());
|
/// assert!(env::set_current_dir(&root).is_ok());
|
||||||
|
|
|
@ -251,6 +251,7 @@ pub mod old_io;
|
||||||
pub mod os;
|
pub mod os;
|
||||||
pub mod env;
|
pub mod env;
|
||||||
pub mod path;
|
pub mod path;
|
||||||
|
pub mod old_path;
|
||||||
pub mod rand;
|
pub mod rand;
|
||||||
pub mod time;
|
pub mod time;
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,8 @@ use old_io;
|
||||||
use iter::{Iterator, Extend};
|
use iter::{Iterator, Extend};
|
||||||
use option::Option;
|
use option::Option;
|
||||||
use option::Option::{Some, None};
|
use option::Option::{Some, None};
|
||||||
use path::{Path, GenericPath};
|
use old_path::{Path, GenericPath};
|
||||||
use path;
|
use old_path;
|
||||||
use result::Result::{Err, Ok};
|
use result::Result::{Err, Ok};
|
||||||
use slice::SliceExt;
|
use slice::SliceExt;
|
||||||
use string::String;
|
use string::String;
|
||||||
|
@ -782,7 +782,7 @@ pub trait PathExtensions {
|
||||||
fn is_dir(&self) -> bool;
|
fn is_dir(&self) -> bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PathExtensions for path::Path {
|
impl PathExtensions for old_path::Path {
|
||||||
fn stat(&self) -> IoResult<FileStat> { stat(self) }
|
fn stat(&self) -> IoResult<FileStat> { stat(self) }
|
||||||
fn lstat(&self) -> IoResult<FileStat> { lstat(self) }
|
fn lstat(&self) -> IoResult<FileStat> { lstat(self) }
|
||||||
fn exists(&self) -> bool {
|
fn exists(&self) -> bool {
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
use prelude::v1::*;
|
use prelude::v1::*;
|
||||||
|
|
||||||
use ffi::CString;
|
use ffi::CString;
|
||||||
use path::BytesContainer;
|
use old_path::BytesContainer;
|
||||||
use old_io::{Listener, Acceptor, IoResult, TimedOut, standard_error};
|
use old_io::{Listener, Acceptor, IoResult, TimedOut, standard_error};
|
||||||
use sys::pipe::UnixAcceptor as UnixAcceptorImp;
|
use sys::pipe::UnixAcceptor as UnixAcceptorImp;
|
||||||
use sys::pipe::UnixListener as UnixListenerImp;
|
use sys::pipe::UnixListener as UnixListenerImp;
|
||||||
|
|
|
@ -25,7 +25,7 @@ use old_io::{IoResult, IoError};
|
||||||
use old_io;
|
use old_io;
|
||||||
use libc;
|
use libc;
|
||||||
use os;
|
use os;
|
||||||
use path::BytesContainer;
|
use old_path::BytesContainer;
|
||||||
use sync::mpsc::{channel, Receiver};
|
use sync::mpsc::{channel, Receiver};
|
||||||
use sys::fs::FileDesc;
|
use sys::fs::FileDesc;
|
||||||
use sys::process::Process as ProcessImp;
|
use sys::process::Process as ProcessImp;
|
||||||
|
|
|
@ -17,7 +17,7 @@ use old_io;
|
||||||
use ops::Drop;
|
use ops::Drop;
|
||||||
use option::Option::{None, Some};
|
use option::Option::{None, Some};
|
||||||
use option::Option;
|
use option::Option;
|
||||||
use path::{Path, GenericPath};
|
use old_path::{Path, GenericPath};
|
||||||
use rand::{Rng, thread_rng};
|
use rand::{Rng, thread_rng};
|
||||||
use result::Result::{Ok, Err};
|
use result::Result::{Ok, Err};
|
||||||
use str::StrExt;
|
use str::StrExt;
|
||||||
|
|
|
@ -445,7 +445,7 @@ mod tests {
|
||||||
use clone::Clone;
|
use clone::Clone;
|
||||||
use iter::IteratorExt;
|
use iter::IteratorExt;
|
||||||
use option::Option::{self, Some, None};
|
use option::Option::{self, Some, None};
|
||||||
use path::GenericPath;
|
use old_path::GenericPath;
|
||||||
use slice::{AsSlice, SliceExt};
|
use slice::{AsSlice, SliceExt};
|
||||||
use str::{self, Str, StrExt};
|
use str::{self, Str, StrExt};
|
||||||
use string::ToString;
|
use string::ToString;
|
|
@ -1124,7 +1124,7 @@ mod tests {
|
||||||
use clone::Clone;
|
use clone::Clone;
|
||||||
use iter::IteratorExt;
|
use iter::IteratorExt;
|
||||||
use option::Option::{self, Some, None};
|
use option::Option::{self, Some, None};
|
||||||
use path::GenericPath;
|
use old_path::GenericPath;
|
||||||
use slice::{AsSlice, SliceExt};
|
use slice::{AsSlice, SliceExt};
|
||||||
use str::Str;
|
use str::Str;
|
||||||
use string::ToString;
|
use string::ToString;
|
|
@ -48,7 +48,7 @@ use old_io::{IoResult, IoError};
|
||||||
use ops::{Drop, FnOnce};
|
use ops::{Drop, FnOnce};
|
||||||
use option::Option::{Some, None};
|
use option::Option::{Some, None};
|
||||||
use option::Option;
|
use option::Option;
|
||||||
use path::{Path, GenericPath, BytesContainer};
|
use old_path::{Path, GenericPath, BytesContainer};
|
||||||
use ptr::PtrExt;
|
use ptr::PtrExt;
|
||||||
use ptr;
|
use ptr;
|
||||||
use result::Result::{Err, Ok};
|
use result::Result::{Err, Ok};
|
||||||
|
@ -267,7 +267,7 @@ pub fn split_paths<T: BytesContainer>(unparsed: T) -> Vec<Path> {
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// use std::os;
|
/// use std::os;
|
||||||
/// use std::path::Path;
|
/// use std::old_path::Path;
|
||||||
///
|
///
|
||||||
/// let key = "PATH";
|
/// let key = "PATH";
|
||||||
/// let mut paths = os::getenv_as_bytes(key).map_or(Vec::new(), os::split_paths);
|
/// let mut paths = os::getenv_as_bytes(key).map_or(Vec::new(), os::split_paths);
|
||||||
|
@ -470,7 +470,7 @@ pub fn tmpdir() -> Path {
|
||||||
/// # Example
|
/// # Example
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// use std::os;
|
/// use std::os;
|
||||||
/// use std::path::Path;
|
/// use std::old_path::Path;
|
||||||
///
|
///
|
||||||
/// // Assume we're in a path like /home/someuser
|
/// // Assume we're in a path like /home/someuser
|
||||||
/// let rel_path = Path::new("..");
|
/// let rel_path = Path::new("..");
|
||||||
|
@ -500,7 +500,7 @@ pub fn make_absolute(p: &Path) -> IoResult<Path> {
|
||||||
/// # Example
|
/// # Example
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// use std::os;
|
/// use std::os;
|
||||||
/// use std::path::Path;
|
/// use std::old_path::Path;
|
||||||
///
|
///
|
||||||
/// let root = Path::new("/");
|
/// let root = Path::new("/");
|
||||||
/// assert!(os::change_dir(&root).is_ok());
|
/// assert!(os::change_dir(&root).is_ok());
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
#[doc(no_inline)] pub use vec::Vec;
|
#[doc(no_inline)] pub use vec::Vec;
|
||||||
|
|
||||||
// NB: remove when path reform lands
|
// NB: remove when path reform lands
|
||||||
#[doc(no_inline)] pub use path::{Path, GenericPath};
|
#[doc(no_inline)] pub use old_path::{Path, GenericPath};
|
||||||
// NB: remove when I/O reform lands
|
// NB: remove when I/O reform lands
|
||||||
#[doc(no_inline)] pub use old_io::{Buffer, Writer, Reader, Seek, BufferPrelude};
|
#[doc(no_inline)] pub use old_io::{Buffer, Writer, Reader, Seek, BufferPrelude};
|
||||||
// NB: remove when range syntax lands
|
// NB: remove when range syntax lands
|
||||||
|
|
|
@ -20,7 +20,7 @@ mod imp {
|
||||||
use self::OsRngInner::*;
|
use self::OsRngInner::*;
|
||||||
|
|
||||||
use old_io::{IoResult, File};
|
use old_io::{IoResult, File};
|
||||||
use path::Path;
|
use old_path::Path;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use rand::reader::ReaderRng;
|
use rand::reader::ReaderRng;
|
||||||
use result::Result::Ok;
|
use result::Result::Ok;
|
||||||
|
|
|
@ -16,7 +16,7 @@ use prelude::v1::*;
|
||||||
use sys::{last_error, retry};
|
use sys::{last_error, retry};
|
||||||
use ffi::CString;
|
use ffi::CString;
|
||||||
use num::Int;
|
use num::Int;
|
||||||
use path::BytesContainer;
|
use old_path::BytesContainer;
|
||||||
use collections;
|
use collections;
|
||||||
|
|
||||||
pub mod backtrace;
|
pub mod backtrace;
|
||||||
|
|
|
@ -20,7 +20,7 @@ use old_io::{self, IoResult, IoError, EndOfFile};
|
||||||
use libc::{self, pid_t, c_void, c_int};
|
use libc::{self, pid_t, c_void, c_int};
|
||||||
use mem;
|
use mem;
|
||||||
use os;
|
use os;
|
||||||
use path::BytesContainer;
|
use old_path::BytesContainer;
|
||||||
use ptr;
|
use ptr;
|
||||||
use sync::mpsc::{channel, Sender, Receiver};
|
use sync::mpsc::{channel, Sender, Receiver};
|
||||||
use sys::fs::FileDesc;
|
use sys::fs::FileDesc;
|
||||||
|
|
|
@ -32,7 +32,7 @@ use libc;
|
||||||
use mem;
|
use mem;
|
||||||
use ops::Drop;
|
use ops::Drop;
|
||||||
use option::Option::{Some};
|
use option::Option::{Some};
|
||||||
use path::Path;
|
use old_path::Path;
|
||||||
use ptr;
|
use ptr;
|
||||||
use result::Result::{Ok, Err};
|
use result::Result::{Ok, Err};
|
||||||
use slice::SliceExt;
|
use slice::SliceExt;
|
||||||
|
|
|
@ -23,7 +23,7 @@ use old_io::process::{ProcessExit, ExitStatus};
|
||||||
use old_io::{IoResult, IoError};
|
use old_io::{IoResult, IoError};
|
||||||
use old_io;
|
use old_io;
|
||||||
use os;
|
use os;
|
||||||
use path::BytesContainer;
|
use old_path::BytesContainer;
|
||||||
use ptr;
|
use ptr;
|
||||||
use str;
|
use str;
|
||||||
use sync::{StaticMutex, MUTEX_INIT};
|
use sync::{StaticMutex, MUTEX_INIT};
|
||||||
|
|
|
@ -25,7 +25,7 @@ use serialize::{Decodable, Decoder, Encodable, Encoder};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::path::BytesContainer;
|
use std::old_path::BytesContainer;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
|
|
|
@ -13,4 +13,4 @@
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let r = 1..2..3;
|
let r = 1..2..3;
|
||||||
//~^ ERROR expected one of `.`, `;`, or an operator, found `..`
|
//~^ ERROR expected one of `.`, `;`, or an operator, found `..`
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,4 +13,4 @@
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let r = ..1..2;
|
let r = ..1..2;
|
||||||
//~^ ERROR expected one of `.`, `;`, or an operator, found `..`
|
//~^ ERROR expected one of `.`, `;`, or an operator, found `..`
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,4 +149,4 @@ fn main() {
|
||||||
assoc_enum(Enum::Variant2(8i64, 9i32));
|
assoc_enum(Enum::Variant2(8i64, 9i32));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn zzz() { () }
|
fn zzz() { () }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue