about summary refs log tree commit diff
path: root/src/libstd/sys
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/sys')
-rw-r--r--src/libstd/sys/common/backtrace.rs7
-rw-r--r--src/libstd/sys/common/net.rs2
-rw-r--r--src/libstd/sys/unix/c.rs4
-rw-r--r--src/libstd/sys/unix/process.rs9
-rw-r--r--src/libstd/sys/unix/stack_overflow.rs6
-rw-r--r--src/libstd/sys/windows/backtrace.rs2
-rw-r--r--src/libstd/sys/windows/fs.rs2
-rw-r--r--src/libstd/sys/windows/os.rs2
-rw-r--r--src/libstd/sys/windows/pipe.rs2
-rw-r--r--src/libstd/sys/windows/process.rs9
-rw-r--r--src/libstd/sys/windows/timer.rs2
11 files changed, 28 insertions, 19 deletions
diff --git a/src/libstd/sys/common/backtrace.rs b/src/libstd/sys/common/backtrace.rs
index be44aa99f49..f6161ec193d 100644
--- a/src/libstd/sys/common/backtrace.rs
+++ b/src/libstd/sys/common/backtrace.rs
@@ -12,8 +12,11 @@ use prelude::v1::*;
 
 use io::IoResult;
 
-#[cfg(target_word_size = "64")] pub const HEX_WIDTH: uint = 18;
-#[cfg(target_word_size = "32")] pub const HEX_WIDTH: uint = 10;
+#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
+pub const HEX_WIDTH: uint = 18;
+
+#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
+pub const HEX_WIDTH: uint = 10;
 
 // All rust symbols are in theory lists of "::"-separated identifiers. Some
 // assemblers, however, can't handle these characters in symbol names. To get
diff --git a/src/libstd/sys/common/net.rs b/src/libstd/sys/common/net.rs
index 902942d7244..4cf891ac498 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.index(&(written..)).as_ptr();
+            let ptr = buf[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/unix/c.rs b/src/libstd/sys/unix/c.rs
index cc661877bc0..1d523ed6edd 100644
--- a/src/libstd/sys/unix/c.rs
+++ b/src/libstd/sys/unix/c.rs
@@ -169,13 +169,13 @@ mod signal {
     unsafe impl ::marker::Sync for sigaction { }
 
     #[repr(C)]
-    #[cfg(target_word_size = "32")]
+    #[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
     pub struct sigset_t {
         __val: [libc::c_ulong; 32],
     }
 
     #[repr(C)]
-    #[cfg(target_word_size = "64")]
+    #[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
     pub struct sigset_t {
         __val: [libc::c_ulong; 16],
     }
diff --git a/src/libstd/sys/unix/process.rs b/src/libstd/sys/unix/process.rs
index 1357bbdd5a3..36bf696dba5 100644
--- a/src/libstd/sys/unix/process.rs
+++ b/src/libstd/sys/unix/process.rs
@@ -11,7 +11,8 @@
 use prelude::v1::*;
 use self::Req::*;
 
-use collections;
+use collections::HashMap;
+use collections::hash_map::Hasher;
 use ffi::CString;
 use hash::Hash;
 use io::process::{ProcessExit, ExitStatus, ExitSignal};
@@ -60,7 +61,7 @@ impl Process {
                               out_fd: Option<P>, err_fd: Option<P>)
                               -> IoResult<Process>
         where C: ProcessConfig<K, V>, P: AsInner<FileDesc>,
-              K: BytesContainer + Eq + Hash, V: BytesContainer
+              K: BytesContainer + Eq + Hash<Hasher>, V: BytesContainer
     {
         use libc::funcs::posix88::unistd::{fork, dup2, close, chdir, execvp};
         use libc::funcs::bsd44::getdtablesize;
@@ -553,11 +554,11 @@ fn with_argv<T,F>(prog: &CString, args: &[CString],
     cb(ptrs.as_ptr())
 }
 
-fn with_envp<K,V,T,F>(env: Option<&collections::HashMap<K, V>>,
+fn with_envp<K,V,T,F>(env: Option<&HashMap<K, V>>,
                       cb: F)
                       -> T
     where F : FnOnce(*const c_void) -> T,
-          K : BytesContainer + Eq + Hash,
+          K : BytesContainer + Eq + Hash<Hasher>,
           V : BytesContainer
 {
     // On posixy systems we can pass a char** for envp, which is a
diff --git a/src/libstd/sys/unix/stack_overflow.rs b/src/libstd/sys/unix/stack_overflow.rs
index 1fd619a28db..48a51813ba4 100644
--- a/src/libstd/sys/unix/stack_overflow.rs
+++ b/src/libstd/sys/unix/stack_overflow.rs
@@ -182,12 +182,14 @@ mod imp {
             sa_restorer: *mut libc::c_void,
         }
 
-        #[cfg(target_word_size = "32")]
+        #[cfg(any(all(stage0, target_word_size = "32"),
+                  all(not(stage0), target_pointer_width = "32")))]
         #[repr(C)]
         pub struct sigset_t {
             __val: [libc::c_ulong; 32],
         }
-        #[cfg(target_word_size = "64")]
+        #[cfg(any(all(stage0, target_word_size = "64"),
+                  all(not(stage0), target_pointer_width = "64")))]
         #[repr(C)]
         pub struct sigset_t {
             __val: [libc::c_ulong; 16],
diff --git a/src/libstd/sys/windows/backtrace.rs b/src/libstd/sys/windows/backtrace.rs
index eb76f13afe7..ee2dd14955b 100644
--- a/src/libstd/sys/windows/backtrace.rs
+++ b/src/libstd/sys/windows/backtrace.rs
@@ -362,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.index(&(..(bytes.len()-1))))),
+                Err(..) => try!(w.write(&bytes[..(bytes.len()-1)])),
             }
         }
         try!(w.write(&['\n' as u8]));
diff --git a/src/libstd/sys/windows/fs.rs b/src/libstd/sys/windows/fs.rs
index f8c75335b35..a7330f7c67c 100644
--- a/src/libstd/sys/windows/fs.rs
+++ b/src/libstd/sys/windows/fs.rs
@@ -270,7 +270,7 @@ pub fn readdir(p: &Path) -> IoResult<Vec<Path>> {
                             return Err(IoError {
                                 kind: io::InvalidInput,
                                 desc: "path was not valid UTF-16",
-                                detail: Some(format!("path was not valid UTF-16: {}", filename)),
+                                detail: Some(format!("path was not valid UTF-16: {:?}", filename)),
                             })
                         }, // FIXME #12056: Convert the UCS-2 to invalid utf-8 instead of erroring
                     }
diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs
index fcde5c01080..064633f321c 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.index(&(0..i)),
+        Some(i) => &v[0..i],
         None => v
     }
 }
diff --git a/src/libstd/sys/windows/pipe.rs b/src/libstd/sys/windows/pipe.rs
index 016757ef63e..9996909f2f5 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.index(&(offset..)).as_ptr() as libc::LPVOID,
+                                buf[offset..].as_ptr() as libc::LPVOID,
                                 (buf.len() - offset) as libc::DWORD,
                                 &mut bytes_written,
                                 &mut overlapped)
diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs
index 8e1f169b5cd..1b837385d1e 100644
--- a/src/libstd/sys/windows/process.rs
+++ b/src/libstd/sys/windows/process.rs
@@ -13,6 +13,7 @@ use prelude::v1::*;
 use collections;
 use ffi::CString;
 use hash::Hash;
+use collections::hash_map::Hasher;
 use io::fs::PathExtensions;
 use io::process::{ProcessExit, ExitStatus, ExitSignal};
 use io::{IoResult, IoError};
@@ -109,7 +110,7 @@ impl Process {
                               out_fd: Option<P>, err_fd: Option<P>)
                               -> IoResult<Process>
         where C: ProcessConfig<K, V>, P: AsInner<FileDesc>,
-              K: BytesContainer + Eq + Hash, V: BytesContainer
+              K: BytesContainer + Eq + Hash<Hasher>, V: BytesContainer
     {
         use libc::types::os::arch::extra::{DWORD, HANDLE, STARTUPINFO};
         use libc::consts::os::extra::{
@@ -424,8 +425,10 @@ fn make_command_line(prog: &CString, args: &[CString]) -> String {
     }
 }
 
-fn with_envp<K, V, T, F>(env: Option<&collections::HashMap<K, V>>, cb: F) -> T where
-    K: BytesContainer + Eq + Hash, V: BytesContainer, F: FnOnce(*mut c_void) -> T,
+fn with_envp<K, V, T, F>(env: Option<&collections::HashMap<K, V>>, cb: F) -> T
+    where K: BytesContainer + Eq + Hash<Hasher>,
+          V: BytesContainer,
+          F: FnOnce(*mut c_void) -> T,
 {
     // On Windows we pass an "environment block" which is not a char**, but
     // rather a concatenation of null-terminated k=v\0 sequences, with a final
diff --git a/src/libstd/sys/windows/timer.rs b/src/libstd/sys/windows/timer.rs
index 343b78543bf..1ae3979cd9a 100644
--- a/src/libstd/sys/windows/timer.rs
+++ b/src/libstd/sys/windows/timer.rs
@@ -91,7 +91,7 @@ fn helper(input: libc::HANDLE, messages: Receiver<Req>, _: ()) {
         } else {
             let remove = {
                 match &mut chans[idx as uint - 1] {
-                    &(ref mut c, oneshot) => { c.call(); oneshot }
+                    &mut (ref mut c, oneshot) => { c.call(); oneshot }
                 }
             };
             if remove {