diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-01-06 15:05:53 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-01-06 15:05:53 -0800 |
| commit | 1afe8a4fb86fe54be8008b033de166d9c1f8f650 (patch) | |
| tree | c7f8c61d1f944c6f2b4a1c59979bfa4b0fae3cfa /src/libstd/sys | |
| parent | ea6f65c5f1a3f84e010d2cef02a0160804e9567a (diff) | |
| parent | 0c7f7a5fb8919c6a382f9acd1e921c51f807f625 (diff) | |
| download | rust-1afe8a4fb86fe54be8008b033de166d9c1f8f650.tar.gz rust-1afe8a4fb86fe54be8008b033de166d9c1f8f650.zip | |
rollup merge of #20562: nick29581/arrays-3
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/common/net.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/windows/backtrace.rs | 3 | ||||
| -rw-r--r-- | src/libstd/sys/windows/os.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/windows/pipe.rs | 2 |
4 files changed, 5 insertions, 4 deletions
diff --git a/src/libstd/sys/common/net.rs b/src/libstd/sys/common/net.rs index 4cf891ac498..902942d7244 100644 --- a/src/libstd/sys/common/net.rs +++ b/src/libstd/sys/common/net.rs @@ -469,7 +469,7 @@ pub fn write<T, L, W>(fd: sock_t, // Also as with read(), we use MSG_DONTWAIT to guard ourselves // against unforeseen circumstances. let _guard = lock(); - let ptr = buf[written..].as_ptr(); + let ptr = buf.index(&(written..)).as_ptr(); let len = buf.len() - written; match retry(|| write(deadline.is_some(), ptr, len)) { -1 if wouldblock() => {} diff --git a/src/libstd/sys/windows/backtrace.rs b/src/libstd/sys/windows/backtrace.rs index 4ccecfd1f5f..eb76f13afe7 100644 --- a/src/libstd/sys/windows/backtrace.rs +++ b/src/libstd/sys/windows/backtrace.rs @@ -23,6 +23,7 @@ use dynamic_lib::DynamicLibrary; use ffi; +use core::ops::Index; use intrinsics; use io::{IoResult, Writer}; use libc; @@ -361,7 +362,7 @@ pub fn write(w: &mut Writer) -> IoResult<()> { let bytes = unsafe { ffi::c_str_to_bytes(&ptr) }; match str::from_utf8(bytes) { Ok(s) => try!(demangle(w, s)), - Err(..) => try!(w.write(bytes[..bytes.len()-1])), + Err(..) => try!(w.write(bytes.index(&(..(bytes.len()-1))))), } } try!(w.write(&['\n' as u8])); diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs index dfdee0e0385..fcde5c01080 100644 --- a/src/libstd/sys/windows/os.rs +++ b/src/libstd/sys/windows/os.rs @@ -36,7 +36,7 @@ const BUF_BYTES : uint = 2048u; pub fn truncate_utf16_at_nul<'a>(v: &'a [u16]) -> &'a [u16] { match v.iter().position(|c| *c == 0) { // don't include the 0 - Some(i) => v[..i], + Some(i) => v.index(&(0..i)), None => v } } diff --git a/src/libstd/sys/windows/pipe.rs b/src/libstd/sys/windows/pipe.rs index 9996909f2f5..016757ef63e 100644 --- a/src/libstd/sys/windows/pipe.rs +++ b/src/libstd/sys/windows/pipe.rs @@ -453,7 +453,7 @@ impl UnixStream { } let ret = unsafe { libc::WriteFile(self.handle(), - buf[offset..].as_ptr() as libc::LPVOID, + buf.index(&(offset..)).as_ptr() as libc::LPVOID, (buf.len() - offset) as libc::DWORD, &mut bytes_written, &mut overlapped) |
