Skip to content

Commit 3e39f0b

Browse files
committed
Rename std::path to std::old_path
As part of [RFC 474](rust-lang/rfcs#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]
1 parent 3b2ed14 commit 3e39f0b

File tree

26 files changed

+38
-37
lines changed

26 files changed

+38
-37
lines changed

src/libcore/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
//! use std::error::FromError;
5252
//! use std::old_io::{File, IoError};
5353
//! use std::os::{MemoryMap, MapError};
54-
//! use std::path::Path;
54+
//! use std::old_path::Path;
5555
//!
5656
//! enum MyError {
5757
//! Io(IoError),

src/libgraphviz/maybe_owned_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use std::cmp::Ordering;
1717
use std::default::Default;
1818
use std::fmt;
1919
use std::iter::FromIterator;
20-
use std::path::BytesContainer;
20+
use std::old_path::BytesContainer;
2121
use std::slice;
2222

2323
// Note 1: It is not clear whether the flexibility of providing both

src/librustc_back/target/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ impl Target {
306306
use std::env;
307307
use std::ffi::OsString;
308308
use std::old_io::File;
309-
use std::path::Path;
309+
use std::old_path::Path;
310310
use serialize::json;
311311

312312
fn load_file(path: &Path) -> Result<Target, String> {

src/librustc_trans/trans/debuginfo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1590,7 +1590,7 @@ fn compile_unit_metadata(cx: &CrateContext) -> DIDescriptor {
15901590
Some(ref p) if p.is_relative() => {
15911591
// prepend "./" if necessary
15921592
let dotdot = b"..";
1593-
let prefix: &[u8] = &[dotdot[0], ::std::path::SEP_BYTE];
1593+
let prefix: &[u8] = &[dotdot[0], ::std::old_path::SEP_BYTE];
15941594
let mut path_bytes = p.as_vec().to_vec();
15951595

15961596
if &path_bytes[..2] != prefix &&

src/librustdoc/clean/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ use rustc::middle::stability;
4949
use std::rc::Rc;
5050
use std::u32;
5151
use std::str::Str as StrTrait; // Conflicts with Str variant
52-
use std::path::Path as FsPath; // Conflicts with Path struct
52+
use std::old_path::Path as FsPath; // Conflicts with Path struct
5353

5454
use core::DocContext;
5555
use doctree;

src/libserialize/serialize.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
Core encoding and decoding interfaces.
1515
*/
1616

17-
use std::path;
17+
use std::old_path;
1818
use std::rc::Rc;
1919
use std::cell::{Cell, RefCell};
2020
use std::sync::Arc;
@@ -538,29 +538,29 @@ macro_rules! tuple {
538538

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

541-
impl Encodable for path::posix::Path {
541+
impl Encodable for old_path::posix::Path {
542542
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
543543
self.as_vec().encode(e)
544544
}
545545
}
546546

547-
impl Decodable for path::posix::Path {
548-
fn decode<D: Decoder>(d: &mut D) -> Result<path::posix::Path, D::Error> {
547+
impl Decodable for old_path::posix::Path {
548+
fn decode<D: Decoder>(d: &mut D) -> Result<old_path::posix::Path, D::Error> {
549549
let bytes: Vec<u8> = try!(Decodable::decode(d));
550-
Ok(path::posix::Path::new(bytes))
550+
Ok(old_path::posix::Path::new(bytes))
551551
}
552552
}
553553

554-
impl Encodable for path::windows::Path {
554+
impl Encodable for old_path::windows::Path {
555555
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
556556
self.as_vec().encode(e)
557557
}
558558
}
559559

560-
impl Decodable for path::windows::Path {
561-
fn decode<D: Decoder>(d: &mut D) -> Result<path::windows::Path, D::Error> {
560+
impl Decodable for old_path::windows::Path {
561+
fn decode<D: Decoder>(d: &mut D) -> Result<old_path::windows::Path, D::Error> {
562562
let bytes: Vec<u8> = try!(Decodable::decode(d));
563-
Ok(path::windows::Path::new(bytes))
563+
Ok(old_path::windows::Path::new(bytes))
564564
}
565565
}
566566

src/libstd/env.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub fn current_dir() -> IoResult<Path> {
5757
///
5858
/// ```rust
5959
/// use std::env;
60-
/// use std::path::Path;
60+
/// use std::old_path::Path;
6161
///
6262
/// let root = Path::new("/");
6363
/// assert!(env::set_current_dir(&root).is_ok());

src/libstd/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ pub mod old_io;
251251
pub mod os;
252252
pub mod env;
253253
pub mod path;
254+
pub mod old_path;
254255
pub mod rand;
255256
pub mod time;
256257

src/libstd/old_io/fs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ use old_io;
6161
use iter::{Iterator, Extend};
6262
use option::Option;
6363
use option::Option::{Some, None};
64-
use path::{Path, GenericPath};
65-
use path;
64+
use old_path::{Path, GenericPath};
65+
use old_path;
6666
use result::Result::{Err, Ok};
6767
use slice::SliceExt;
6868
use string::String;
@@ -782,7 +782,7 @@ pub trait PathExtensions {
782782
fn is_dir(&self) -> bool;
783783
}
784784

785-
impl PathExtensions for path::Path {
785+
impl PathExtensions for old_path::Path {
786786
fn stat(&self) -> IoResult<FileStat> { stat(self) }
787787
fn lstat(&self) -> IoResult<FileStat> { lstat(self) }
788788
fn exists(&self) -> bool {

src/libstd/old_io/net/pipe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
use prelude::v1::*;
2424

2525
use ffi::CString;
26-
use path::BytesContainer;
26+
use old_path::BytesContainer;
2727
use old_io::{Listener, Acceptor, IoResult, TimedOut, standard_error};
2828
use sys::pipe::UnixAcceptor as UnixAcceptorImp;
2929
use sys::pipe::UnixListener as UnixListenerImp;

src/libstd/old_io/process.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use old_io::{IoResult, IoError};
2525
use old_io;
2626
use libc;
2727
use os;
28-
use path::BytesContainer;
28+
use old_path::BytesContainer;
2929
use sync::mpsc::{channel, Receiver};
3030
use sys::fs::FileDesc;
3131
use sys::process::Process as ProcessImp;

src/libstd/old_io/tempfile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use old_io;
1717
use ops::Drop;
1818
use option::Option::{None, Some};
1919
use option::Option;
20-
use path::{Path, GenericPath};
20+
use old_path::{Path, GenericPath};
2121
use rand::{Rng, thread_rng};
2222
use result::Result::{Ok, Err};
2323
use str::StrExt;
File renamed without changes.

src/libstd/path/posix.rs renamed to src/libstd/old_path/posix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ mod tests {
445445
use clone::Clone;
446446
use iter::IteratorExt;
447447
use option::Option::{self, Some, None};
448-
use path::GenericPath;
448+
use old_path::GenericPath;
449449
use slice::{AsSlice, SliceExt};
450450
use str::{self, Str, StrExt};
451451
use string::ToString;

src/libstd/path/windows.rs renamed to src/libstd/old_path/windows.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,7 @@ mod tests {
11241124
use clone::Clone;
11251125
use iter::IteratorExt;
11261126
use option::Option::{self, Some, None};
1127-
use path::GenericPath;
1127+
use old_path::GenericPath;
11281128
use slice::{AsSlice, SliceExt};
11291129
use str::Str;
11301130
use string::ToString;

src/libstd/os.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ use old_io::{IoResult, IoError};
4848
use ops::{Drop, FnOnce};
4949
use option::Option::{Some, None};
5050
use option::Option;
51-
use path::{Path, GenericPath, BytesContainer};
51+
use old_path::{Path, GenericPath, BytesContainer};
5252
use ptr::PtrExt;
5353
use ptr;
5454
use result::Result::{Err, Ok};
@@ -267,7 +267,7 @@ pub fn split_paths<T: BytesContainer>(unparsed: T) -> Vec<Path> {
267267
///
268268
/// ```rust
269269
/// use std::os;
270-
/// use std::path::Path;
270+
/// use std::old_path::Path;
271271
///
272272
/// let key = "PATH";
273273
/// let mut paths = os::getenv_as_bytes(key).map_or(Vec::new(), os::split_paths);
@@ -470,7 +470,7 @@ pub fn tmpdir() -> Path {
470470
/// # Example
471471
/// ```rust
472472
/// use std::os;
473-
/// use std::path::Path;
473+
/// use std::old_path::Path;
474474
///
475475
/// // Assume we're in a path like /home/someuser
476476
/// let rel_path = Path::new("..");
@@ -500,7 +500,7 @@ pub fn make_absolute(p: &Path) -> IoResult<Path> {
500500
/// # Example
501501
/// ```rust
502502
/// use std::os;
503-
/// use std::path::Path;
503+
/// use std::old_path::Path;
504504
///
505505
/// let root = Path::new("/");
506506
/// assert!(os::change_dir(&root).is_ok());

src/libstd/prelude/v1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
#[doc(no_inline)] pub use vec::Vec;
5757

5858
// NB: remove when path reform lands
59-
#[doc(no_inline)] pub use path::{Path, GenericPath};
59+
#[doc(no_inline)] pub use old_path::{Path, GenericPath};
6060
// NB: remove when I/O reform lands
6161
#[doc(no_inline)] pub use old_io::{Buffer, Writer, Reader, Seek, BufferPrelude};
6262
// NB: remove when range syntax lands

src/libstd/rand/os.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ mod imp {
2020
use self::OsRngInner::*;
2121

2222
use old_io::{IoResult, File};
23-
use path::Path;
23+
use old_path::Path;
2424
use rand::Rng;
2525
use rand::reader::ReaderRng;
2626
use result::Result::Ok;

src/libstd/sys/common/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use prelude::v1::*;
1616
use sys::{last_error, retry};
1717
use ffi::CString;
1818
use num::Int;
19-
use path::BytesContainer;
19+
use old_path::BytesContainer;
2020
use collections;
2121

2222
pub mod backtrace;

src/libstd/sys/unix/process.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use old_io::{self, IoResult, IoError, EndOfFile};
2020
use libc::{self, pid_t, c_void, c_int};
2121
use mem;
2222
use os;
23-
use path::BytesContainer;
23+
use old_path::BytesContainer;
2424
use ptr;
2525
use sync::mpsc::{channel, Sender, Receiver};
2626
use sys::fs::FileDesc;

src/libstd/sys/windows/backtrace.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use libc;
3232
use mem;
3333
use ops::Drop;
3434
use option::Option::{Some};
35-
use path::Path;
35+
use old_path::Path;
3636
use ptr;
3737
use result::Result::{Ok, Err};
3838
use slice::SliceExt;

src/libstd/sys/windows/process.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use old_io::process::{ProcessExit, ExitStatus};
2323
use old_io::{IoResult, IoError};
2424
use old_io;
2525
use os;
26-
use path::BytesContainer;
26+
use old_path::BytesContainer;
2727
use ptr;
2828
use str;
2929
use sync::{StaticMutex, MUTEX_INIT};

src/libsyntax/parse/token.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use serialize::{Decodable, Decoder, Encodable, Encoder};
2525
use std::fmt;
2626
use std::mem;
2727
use std::ops::Deref;
28-
use std::path::BytesContainer;
28+
use std::old_path::BytesContainer;
2929
use std::rc::Rc;
3030

3131
#[allow(non_camel_case_types)]

src/test/compile-fail/range-3.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
pub fn main() {
1414
let r = 1..2..3;
1515
//~^ ERROR expected one of `.`, `;`, or an operator, found `..`
16-
}
16+
}

src/test/compile-fail/range-4.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
pub fn main() {
1414
let r = ..1..2;
1515
//~^ ERROR expected one of `.`, `;`, or an operator, found `..`
16-
}
16+
}

src/test/debuginfo/associated-types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,4 @@ fn main() {
149149
assoc_enum(Enum::Variant2(8i64, 9i32));
150150
}
151151

152-
fn zzz() { () }
152+
fn zzz() { () }

0 commit comments

Comments
 (0)