diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-05-19 23:19:56 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-05-22 14:42:02 -0700 |
| commit | e878721d70349e2055f0ef854085de92e9498fde (patch) | |
| tree | 35940d52f145bca81dcf73e5e7da7f3847ceb413 /src/libnative | |
| parent | 5633d4641f7d63805e3c12c899f8401410bd825f (diff) | |
| download | rust-e878721d70349e2055f0ef854085de92e9498fde.tar.gz rust-e878721d70349e2055f0ef854085de92e9498fde.zip | |
libcore: Remove all uses of `~str` from `libcore`.
[breaking-change]
Diffstat (limited to 'src/libnative')
| -rw-r--r-- | src/libnative/io/file_win32.rs | 4 | ||||
| -rw-r--r-- | src/libnative/io/process.rs | 8 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/libnative/io/file_win32.rs b/src/libnative/io/file_win32.rs index 9693f772170..f320aca2bfc 100644 --- a/src/libnative/io/file_win32.rs +++ b/src/libnative/io/file_win32.rs @@ -450,7 +450,9 @@ pub fn readlink(p: &CString) -> IoResult<Path> { libc::VOLUME_NAME_DOS) }); let ret = match ret { - Some(ref s) if s.starts_with(r"\\?\") => Ok(Path::new(s.slice_from(4))), + Some(ref s) if s.as_slice().starts_with(r"\\?\") => { + Ok(Path::new(s.as_slice().slice_from(4))) + } Some(s) => Ok(Path::new(s)), None => Err(super::last_error()), }; diff --git a/src/libnative/io/process.rs b/src/libnative/io/process.rs index 04911bc5f1b..80b00dfb3fe 100644 --- a/src/libnative/io/process.rs +++ b/src/libnative/io/process.rs @@ -323,7 +323,7 @@ fn spawn_process_os(cfg: ProcessConfig, in_fd: c_int, out_fd: c_int, err_fd: c_i with_envp(cfg.env, |envp| { with_dirp(cfg.cwd, |dirp| { - os::win32::as_mut_utf16_p(cmd_str, |cmdp| { + os::win32::as_mut_utf16_p(cmd_str.as_slice(), |cmdp| { let created = CreateProcessW(ptr::null(), cmdp, ptr::mut_null(), @@ -396,7 +396,7 @@ fn zeroed_process_information() -> libc::types::os::arch::extra::PROCESS_INFORMA } #[cfg(windows)] -fn make_command_line(prog: &CString, args: &[CString]) -> ~str { +fn make_command_line(prog: &CString, args: &[CString]) -> StrBuf { let mut cmd = StrBuf::new(); append_arg(&mut cmd, prog.as_str() .expect("expected program name to be utf-8 encoded")); @@ -405,7 +405,7 @@ fn make_command_line(prog: &CString, args: &[CString]) -> ~str { append_arg(&mut cmd, arg.as_str() .expect("expected argument to be utf-8 encoded")); } - return cmd.into_owned(); + return cmd; fn append_arg(cmd: &mut StrBuf, arg: &str) { let quote = arg.chars().any(|c| c == ' ' || c == '\t'); @@ -1093,7 +1093,7 @@ mod tests { use std::c_str::CString; use super::make_command_line; - fn test_wrapper(prog: &str, args: &[&str]) -> ~str { + fn test_wrapper(prog: &str, args: &[&str]) -> StrBuf { make_command_line(&prog.to_c_str(), args.iter() .map(|a| a.to_c_str()) |
