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;

0 commit comments

Comments
 (0)