Round 5 test fixes and rebase conflicts
This commit is contained in:
parent
cb29c468f3
commit
0cd54b85ef
@ -158,7 +158,7 @@ pub trait Hasher {
|
|||||||
#[inline]
|
#[inline]
|
||||||
#[unstable(feature = "hash", reason = "module was recently redesigned")]
|
#[unstable(feature = "hash", reason = "module was recently redesigned")]
|
||||||
fn write_usize(&mut self, i: usize) {
|
fn write_usize(&mut self, i: usize) {
|
||||||
if cfg!(target_pointer_size = "32") {
|
if cfg!(target_pointer_width = "32") {
|
||||||
self.write_u32(i as u32)
|
self.write_u32(i as u32)
|
||||||
} else {
|
} else {
|
||||||
self.write_u64(i as u64)
|
self.write_u64(i as u64)
|
||||||
@ -241,7 +241,7 @@ mod impls {
|
|||||||
#[inline]
|
#[inline]
|
||||||
fn hash(&self, state: &mut S) {
|
fn hash(&self, state: &mut S) {
|
||||||
let a: [u8; ::$ty::BYTES] = unsafe {
|
let a: [u8; ::$ty::BYTES] = unsafe {
|
||||||
mem::transmute((*self as $uty).to_le() as $ty)
|
mem::transmute(*self)
|
||||||
};
|
};
|
||||||
state.write(&a)
|
state.write(&a)
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ struct EnvKey(CString);
|
|||||||
#[derive(Eq, Clone, Debug)]
|
#[derive(Eq, Clone, Debug)]
|
||||||
struct EnvKey(CString);
|
struct EnvKey(CString);
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(all(windows, stage0))]
|
||||||
impl<H: hash::Writer + hash::Hasher> hash::Hash<H> for EnvKey {
|
impl<H: hash::Writer + hash::Hasher> hash::Hash<H> for EnvKey {
|
||||||
fn hash(&self, state: &mut H) {
|
fn hash(&self, state: &mut H) {
|
||||||
let &EnvKey(ref x) = self;
|
let &EnvKey(ref x) = self;
|
||||||
@ -116,6 +116,18 @@ impl<H: hash::Writer + hash::Hasher> hash::Hash<H> for EnvKey {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(all(windows, not(stage0)))]
|
||||||
|
impl hash::Hash for EnvKey {
|
||||||
|
fn hash<H: hash::Hasher>(&self, state: &mut H) {
|
||||||
|
let &EnvKey(ref x) = self;
|
||||||
|
match str::from_utf8(x.as_bytes()) {
|
||||||
|
Ok(s) => for ch in s.chars() {
|
||||||
|
(ch as u8 as char).to_lowercase().hash(state);
|
||||||
|
},
|
||||||
|
Err(..) => x.hash(state)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
impl PartialEq for EnvKey {
|
impl PartialEq for EnvKey {
|
||||||
|
@ -561,10 +561,11 @@ pub fn get_exit_status() -> int {
|
|||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
unsafe fn load_argc_and_argv(argc: int,
|
unsafe fn load_argc_and_argv(argc: int,
|
||||||
argv: *const *const c_char) -> Vec<Vec<u8>> {
|
argv: *const *const c_char) -> Vec<Vec<u8>> {
|
||||||
|
use ffi::CStr;
|
||||||
use iter::range;
|
use iter::range;
|
||||||
|
|
||||||
(0..argc as uint).map(|i| {
|
(0..argc).map(|i| {
|
||||||
ffi::c_str_to_bytes(&*argv.offset(i as int)).to_vec()
|
CStr::from_ptr(*argv.offset(i)).to_bytes().to_vec()
|
||||||
}).collect()
|
}).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ pub fn args() -> Args {
|
|||||||
let (argc, argv) = (*_NSGetArgc() as isize,
|
let (argc, argv) = (*_NSGetArgc() as isize,
|
||||||
*_NSGetArgv() as *const *const c_char);
|
*_NSGetArgv() as *const *const c_char);
|
||||||
range(0, argc as isize).map(|i| {
|
range(0, argc as isize).map(|i| {
|
||||||
let bytes = CStr::from_ptr(&*argv.offset(i)).to_bytes().to_vec();
|
let bytes = CStr::from_ptr(*argv.offset(i)).to_bytes().to_vec();
|
||||||
OsStringExt::from_vec(bytes)
|
OsStringExt::from_vec(bytes)
|
||||||
}).collect::<Vec<_>>()
|
}).collect::<Vec<_>>()
|
||||||
};
|
};
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
use dynamic_lib::DynamicLibrary;
|
use dynamic_lib::DynamicLibrary;
|
||||||
use ffi;
|
use ffi::CStr;
|
||||||
use intrinsics;
|
use intrinsics;
|
||||||
use old_io::{IoResult, Writer};
|
use old_io::{IoResult, Writer};
|
||||||
use libc;
|
use libc;
|
||||||
@ -362,7 +362,7 @@ pub fn write(w: &mut Writer) -> IoResult<()> {
|
|||||||
if ret == libc::TRUE {
|
if ret == libc::TRUE {
|
||||||
try!(write!(w, " - "));
|
try!(write!(w, " - "));
|
||||||
let ptr = info.Name.as_ptr() as *const libc::c_char;
|
let ptr = info.Name.as_ptr() as *const libc::c_char;
|
||||||
let bytes = unsafe { ffi::c_str_to_bytes(&ptr) };
|
let bytes = unsafe { CStr::from_ptr(ptr).to_bytes() };
|
||||||
match str::from_utf8(bytes) {
|
match str::from_utf8(bytes) {
|
||||||
Ok(s) => try!(demangle(w, s)),
|
Ok(s) => try!(demangle(w, s)),
|
||||||
Err(..) => try!(w.write_all(&bytes[..bytes.len()-1])),
|
Err(..) => try!(w.write_all(&bytes[..bytes.len()-1])),
|
||||||
|
@ -589,6 +589,7 @@ fn make_command_line(prog: &CString, args: &[CString]) -> String {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(stage0)]
|
||||||
fn with_envp<K, V, T, F>(env: Option<&collections::HashMap<K, V>>, cb: F) -> T
|
fn with_envp<K, V, T, F>(env: Option<&collections::HashMap<K, V>>, cb: F) -> T
|
||||||
where K: BytesContainer + Eq + Hash<Hasher>,
|
where K: BytesContainer + Eq + Hash<Hasher>,
|
||||||
V: BytesContainer,
|
V: BytesContainer,
|
||||||
@ -616,6 +617,34 @@ fn with_envp<K, V, T, F>(env: Option<&collections::HashMap<K, V>>, cb: F) -> T
|
|||||||
_ => cb(ptr::null_mut())
|
_ => cb(ptr::null_mut())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(not(stage0))]
|
||||||
|
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,
|
||||||
|
{
|
||||||
|
// 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
|
||||||
|
// \0 to terminate.
|
||||||
|
match env {
|
||||||
|
Some(env) => {
|
||||||
|
let mut blk = Vec::new();
|
||||||
|
|
||||||
|
for pair in env {
|
||||||
|
let kv = format!("{}={}",
|
||||||
|
pair.0.container_as_str().unwrap(),
|
||||||
|
pair.1.container_as_str().unwrap());
|
||||||
|
blk.extend(kv.utf16_units());
|
||||||
|
blk.push(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
blk.push(0);
|
||||||
|
|
||||||
|
cb(blk.as_mut_ptr() as *mut c_void)
|
||||||
|
}
|
||||||
|
_ => cb(ptr::null_mut())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn with_dirp<T, F>(d: Option<&CString>, cb: F) -> T where
|
fn with_dirp<T, F>(d: Option<&CString>, cb: F) -> T where
|
||||||
F: FnOnce(*const u16) -> T,
|
F: FnOnce(*const u16) -> T,
|
||||||
|
@ -18,7 +18,7 @@ use std::marker::PhantomFn;
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
pub trait TheTrait<'b> : PhantomFn<Self,Self> {
|
pub trait TheTrait<'b> : PhantomFn<&'b Self,Self> {
|
||||||
type TheAssocType;
|
type TheAssocType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ use std::mem::size_of;
|
|||||||
static uni: &'static str = "Les Miséééééééérables";
|
static uni: &'static str = "Les Miséééééééérables";
|
||||||
static yy: usize = 25;
|
static yy: usize = 25;
|
||||||
|
|
||||||
static bob: Option<std::borrow::Cow<'static, [isize]>> = None;
|
static bob: Option<&'static [isize]> = None;
|
||||||
|
|
||||||
// buglink test - see issue #1337.
|
// buglink test - see issue #1337.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user