diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-02-26 21:00:43 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-03-04 15:59:30 -0800 |
| commit | 95d904625b4d45af80b4e40d51a3a0fde1abaa8a (patch) | |
| tree | b0872e63b8d75543ce5141ceba44c12c459474f2 /src/librustdoc/flock.rs | |
| parent | 3b3bb0e682c2d252e9f62dd9df5cff9552af91ad (diff) | |
| download | rust-95d904625b4d45af80b4e40d51a3a0fde1abaa8a.tar.gz rust-95d904625b4d45af80b4e40d51a3a0fde1abaa8a.zip | |
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.
Diffstat (limited to 'src/librustdoc/flock.rs')
| -rw-r--r-- | src/librustdoc/flock.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/librustdoc/flock.rs b/src/librustdoc/flock.rs index 79e348cb03e..51c58861b4b 100644 --- a/src/librustdoc/flock.rs +++ b/src/librustdoc/flock.rs @@ -20,7 +20,9 @@ pub use self::imp::Lock; #[cfg(unix)] mod imp { - use std::ffi::CString; + use std::ffi::{AsOsStr, CString}; + use std::os::unix::prelude::*; + use std::path::Path; use libc; use std::os as stdos; @@ -114,7 +116,7 @@ mod imp { impl Lock { pub fn new(p: &Path) -> Lock { - let buf = CString::new(p.as_vec()).unwrap(); + let buf = CString::new(p.as_os_str().as_bytes()).unwrap(); let fd = unsafe { libc::open(buf.as_ptr(), libc::O_RDWR | libc::O_CREAT, libc::S_IRWXU) @@ -163,8 +165,11 @@ mod imp { #[cfg(windows)] mod imp { use libc; + use std::ffi::AsOsStr; use std::mem; + use std::os::windows::prelude::*; use std::os; + use std::path::Path; use std::ptr; const LOCKFILE_EXCLUSIVE_LOCK: libc::DWORD = 0x00000002; @@ -190,7 +195,7 @@ mod imp { impl Lock { pub fn new(p: &Path) -> Lock { - let mut p_16: Vec<u16> = p.as_str().unwrap().utf16_units().collect(); + let mut p_16: Vec<_> = p.as_os_str().encode_wide().collect(); p_16.push(0); let handle = unsafe { libc::CreateFileW(p_16.as_ptr(), |
