windows: Don't link rust_builtin

This library has no shims which are actually needed on Windows now, so translate
that last easy one into Rust and then don't link it at all on Windows.
This commit is contained in:
Alex Crichton
2015-06-30 21:55:00 -07:00
parent 18c39e126a
commit 83ee47b054
4 changed files with 35 additions and 40 deletions

View File

@@ -872,7 +872,7 @@ fn run_tests<F>(opts: &TestOpts,
#[allow(deprecated)]
fn get_concurrency() -> usize {
match env::var("RUST_TEST_THREADS") {
return match env::var("RUST_TEST_THREADS") {
Ok(s) => {
let opt_n: Option<usize> = s.parse().ok();
match opt_n {
@@ -884,10 +884,24 @@ fn get_concurrency() -> usize {
if std::rt::util::limit_thread_creation_due_to_osx_and_valgrind() {
1
} else {
extern { fn rust_get_num_cpus() -> libc::uintptr_t; }
unsafe { rust_get_num_cpus() as usize }
num_cpus()
}
}
};
#[cfg(windows)]
fn num_cpus() -> usize {
unsafe {
let mut sysinfo = std::mem::zeroed();
libc::GetSystemInfo(&mut sysinfo);
sysinfo.dwNumberOfProcessors as usize
}
}
#[cfg(unix)]
fn num_cpus() -> usize {
extern { fn rust_get_num_cpus() -> libc::uintptr_t; }
unsafe { rust_get_num_cpus() as usize }
}
}