-
-
Save Nemo157/0d1f02b08c132f1a00da to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git src/liballoc_system/lib.rs src/liballoc_system/lib.rs | |
| index 6a62e00..164bbe8 100644 | |
| --- src/liballoc_system/lib.rs | |
| +++ src/liballoc_system/lib.rs | |
| @@ -70,56 +70,56 @@ pub extern "C" fn __rust_usable_size(size: usize, align: usize) -> usize { | |
| imp::usable_size(size, align) | |
| } | |
| -#[cfg(unix)] | |
| -mod imp { | |
| - use core::cmp; | |
| - use core::ptr; | |
| - use libc; | |
| - use MIN_ALIGN; | |
| +// #[cfg(unix)] | |
| +// mod imp { | |
| +// use core::cmp; | |
| +// use core::ptr; | |
| +// use libc; | |
| +// use MIN_ALIGN; | |
| +// | |
| +// pub unsafe fn allocate(size: usize, align: usize) -> *mut u8 { | |
| +// if align <= MIN_ALIGN { | |
| +// libc::malloc(size as libc::size_t) as *mut u8 | |
| +// } else { | |
| +// let mut out = ptr::null_mut(); | |
| +// let ret = libc::posix_memalign(&mut out, align as libc::size_t, size as libc::size_t); | |
| +// if ret != 0 { | |
| +// ptr::null_mut() | |
| +// } else { | |
| +// out as *mut u8 | |
| +// } | |
| +// } | |
| +// } | |
| +// | |
| +// pub unsafe fn reallocate(ptr: *mut u8, old_size: usize, size: usize, align: usize) -> *mut u8 { | |
| +// if align <= MIN_ALIGN { | |
| +// libc::realloc(ptr as *mut libc::c_void, size as libc::size_t) as *mut u8 | |
| +// } else { | |
| +// let new_ptr = allocate(size, align); | |
| +// ptr::copy(ptr, new_ptr, cmp::min(size, old_size)); | |
| +// deallocate(ptr, old_size, align); | |
| +// new_ptr | |
| +// } | |
| +// } | |
| +// | |
| +// pub unsafe fn reallocate_inplace(_ptr: *mut u8, | |
| +// old_size: usize, | |
| +// _size: usize, | |
| +// _align: usize) | |
| +// -> usize { | |
| +// old_size | |
| +// } | |
| +// | |
| +// pub unsafe fn deallocate(ptr: *mut u8, _old_size: usize, _align: usize) { | |
| +// libc::free(ptr as *mut libc::c_void) | |
| +// } | |
| +// | |
| +// pub fn usable_size(size: usize, _align: usize) -> usize { | |
| +// size | |
| +// } | |
| +// } | |
| - pub unsafe fn allocate(size: usize, align: usize) -> *mut u8 { | |
| - if align <= MIN_ALIGN { | |
| - libc::malloc(size as libc::size_t) as *mut u8 | |
| - } else { | |
| - let mut out = ptr::null_mut(); | |
| - let ret = libc::posix_memalign(&mut out, align as libc::size_t, size as libc::size_t); | |
| - if ret != 0 { | |
| - ptr::null_mut() | |
| - } else { | |
| - out as *mut u8 | |
| - } | |
| - } | |
| - } | |
| - | |
| - pub unsafe fn reallocate(ptr: *mut u8, old_size: usize, size: usize, align: usize) -> *mut u8 { | |
| - if align <= MIN_ALIGN { | |
| - libc::realloc(ptr as *mut libc::c_void, size as libc::size_t) as *mut u8 | |
| - } else { | |
| - let new_ptr = allocate(size, align); | |
| - ptr::copy(ptr, new_ptr, cmp::min(size, old_size)); | |
| - deallocate(ptr, old_size, align); | |
| - new_ptr | |
| - } | |
| - } | |
| - | |
| - pub unsafe fn reallocate_inplace(_ptr: *mut u8, | |
| - old_size: usize, | |
| - _size: usize, | |
| - _align: usize) | |
| - -> usize { | |
| - old_size | |
| - } | |
| - | |
| - pub unsafe fn deallocate(ptr: *mut u8, _old_size: usize, _align: usize) { | |
| - libc::free(ptr as *mut libc::c_void) | |
| - } | |
| - | |
| - pub fn usable_size(size: usize, _align: usize) -> usize { | |
| - size | |
| - } | |
| -} | |
| - | |
| -#[cfg(windows)] | |
| +//#[cfg(windows)] | |
| #[allow(bad_style)] | |
| mod imp { | |
| use MIN_ALIGN; | |
| diff --git src/liblibc/src/lib.rs src/liblibc/src/lib.rs | |
| index c9d7701..af0af08 100644 | |
| --- src/lib.rs | |
| +++ src/lib.rs | |
| @@ -254,12 +254,12 @@ extern { | |
| pub fn srand(seed: c_uint); | |
| } | |
| -cfg_if! { | |
| - if #[cfg(windows)] { | |
| +//cfg_if! { | |
| +// if #[cfg(windows)] { | |
| mod windows; | |
| pub use windows::*; | |
| - } else { | |
| - mod unix; | |
| - pub use unix::*; | |
| - } | |
| -} | |
| +// } else { | |
| +// mod unix; | |
| +// pub use unix::*; | |
| +// } | |
| +//} | |
| diff --git src/libstd/dynamic_lib.rs src/libstd/dynamic_lib.rs | |
| index 08e33fa..f8177a3 100644 | |
| --- src/libstd/dynamic_lib.rs | |
| +++ src/libstd/dynamic_lib.rs | |
| @@ -188,82 +188,82 @@ mod tests { | |
| } | |
| } | |
| -#[cfg(any(target_os = "linux", | |
| - target_os = "android", | |
| - target_os = "macos", | |
| - target_os = "ios", | |
| - target_os = "freebsd", | |
| - target_os = "dragonfly", | |
| - target_os = "bitrig", | |
| - target_os = "netbsd", | |
| - target_os = "openbsd", | |
| - target_os = "solaris", | |
| - target_os = "emscripten"))] | |
| -mod dl { | |
| - use prelude::v1::*; | |
| - | |
| - use ffi::{CStr, OsStr}; | |
| - use str; | |
| - use libc; | |
| - use ptr; | |
| - | |
| - pub fn open(filename: Option<&OsStr>) -> Result<*mut u8, String> { | |
| - check_for_errors_in(|| { | |
| - unsafe { | |
| - match filename { | |
| - Some(filename) => open_external(filename), | |
| - None => open_internal(), | |
| - } | |
| - } | |
| - }) | |
| - } | |
| - | |
| - const LAZY: libc::c_int = 1; | |
| - | |
| - unsafe fn open_external(filename: &OsStr) -> *mut u8 { | |
| - let s = filename.to_cstring().unwrap(); | |
| - libc::dlopen(s.as_ptr(), LAZY) as *mut u8 | |
| - } | |
| - | |
| - unsafe fn open_internal() -> *mut u8 { | |
| - libc::dlopen(ptr::null(), LAZY) as *mut u8 | |
| - } | |
| - | |
| - pub fn check_for_errors_in<T, F>(f: F) -> Result<T, String> where | |
| - F: FnOnce() -> T, | |
| - { | |
| - use sync::StaticMutex; | |
| - static LOCK: StaticMutex = StaticMutex::new(); | |
| - unsafe { | |
| - // dlerror isn't thread safe, so we need to lock around this entire | |
| - // sequence | |
| - let _guard = LOCK.lock(); | |
| - let _old_error = libc::dlerror(); | |
| - | |
| - let result = f(); | |
| - | |
| - let last_error = libc::dlerror() as *const _; | |
| - let ret = if ptr::null() == last_error { | |
| - Ok(result) | |
| - } else { | |
| - let s = CStr::from_ptr(last_error).to_bytes(); | |
| - Err(str::from_utf8(s).unwrap().to_owned()) | |
| - }; | |
| - | |
| - ret | |
| - } | |
| - } | |
| - | |
| - pub unsafe fn symbol(handle: *mut u8, | |
| - symbol: *const libc::c_char) -> *mut u8 { | |
| - libc::dlsym(handle as *mut libc::c_void, symbol) as *mut u8 | |
| - } | |
| - pub unsafe fn close(handle: *mut u8) { | |
| - libc::dlclose(handle as *mut libc::c_void); () | |
| - } | |
| -} | |
| - | |
| -#[cfg(target_os = "windows")] | |
| +// #[cfg(any(target_os = "linux", | |
| +// target_os = "android", | |
| +// target_os = "macos", | |
| +// target_os = "ios", | |
| +// target_os = "freebsd", | |
| +// target_os = "dragonfly", | |
| +// target_os = "bitrig", | |
| +// target_os = "netbsd", | |
| +// target_os = "openbsd", | |
| +// target_os = "solaris", | |
| +// target_os = "emscripten"))] | |
| +// mod dl { | |
| +// use prelude::v1::*; | |
| +// | |
| +// use ffi::{CStr, OsStr}; | |
| +// use str; | |
| +// use libc; | |
| +// use ptr; | |
| +// | |
| +// pub fn open(filename: Option<&OsStr>) -> Result<*mut u8, String> { | |
| +// check_for_errors_in(|| { | |
| +// unsafe { | |
| +// match filename { | |
| +// Some(filename) => open_external(filename), | |
| +// None => open_internal(), | |
| +// } | |
| +// } | |
| +// }) | |
| +// } | |
| +// | |
| +// const LAZY: libc::c_int = 1; | |
| +// | |
| +// unsafe fn open_external(filename: &OsStr) -> *mut u8 { | |
| +// let s = filename.to_cstring().unwrap(); | |
| +// libc::dlopen(s.as_ptr(), LAZY) as *mut u8 | |
| +// } | |
| +// | |
| +// unsafe fn open_internal() -> *mut u8 { | |
| +// libc::dlopen(ptr::null(), LAZY) as *mut u8 | |
| +// } | |
| +// | |
| +// pub fn check_for_errors_in<T, F>(f: F) -> Result<T, String> where | |
| +// F: FnOnce() -> T, | |
| +// { | |
| +// use sync::StaticMutex; | |
| +// static LOCK: StaticMutex = StaticMutex::new(); | |
| +// unsafe { | |
| +// // dlerror isn't thread safe, so we need to lock around this entire | |
| +// // sequence | |
| +// let _guard = LOCK.lock(); | |
| +// let _old_error = libc::dlerror(); | |
| +// | |
| +// let result = f(); | |
| +// | |
| +// let last_error = libc::dlerror() as *const _; | |
| +// let ret = if ptr::null() == last_error { | |
| +// Ok(result) | |
| +// } else { | |
| +// let s = CStr::from_ptr(last_error).to_bytes(); | |
| +// Err(str::from_utf8(s).unwrap().to_owned()) | |
| +// }; | |
| +// | |
| +// ret | |
| +// } | |
| +// } | |
| +// | |
| +// pub unsafe fn symbol(handle: *mut u8, | |
| +// symbol: *const libc::c_char) -> *mut u8 { | |
| +// libc::dlsym(handle as *mut libc::c_void, symbol) as *mut u8 | |
| +// } | |
| +// pub unsafe fn close(handle: *mut u8) { | |
| +// libc::dlclose(handle as *mut libc::c_void); () | |
| +// } | |
| +// } | |
| +// | |
| +// #[cfg(target_os = "windows")] | |
| mod dl { | |
| use prelude::v1::*; | |
| diff --git src/libstd/ffi/os_str.rs src/libstd/ffi/os_str.rs | |
| index 90ea739..5acc47e 100644 | |
| --- src/libstd/ffi/os_str.rs | |
| +++ src/libstd/ffi/os_str.rs | |
| @@ -72,13 +72,13 @@ impl OsString { | |
| Self::_from_bytes(bytes.into()) | |
| } | |
| - #[cfg(unix)] | |
| - fn _from_bytes(vec: Vec<u8>) -> Option<OsString> { | |
| - use os::unix::ffi::OsStringExt; | |
| - Some(OsString::from_vec(vec)) | |
| - } | |
| + // #[cfg(unix)] | |
| + // fn _from_bytes(vec: Vec<u8>) -> Option<OsString> { | |
| + // use os::unix::ffi::OsStringExt; | |
| + // Some(OsString::from_vec(vec)) | |
| + // } | |
| - #[cfg(windows)] | |
| + // #[cfg(windows)] | |
| fn _from_bytes(vec: Vec<u8>) -> Option<OsString> { | |
| String::from_utf8(vec).ok().map(OsString::from) | |
| } | |
| diff --git src/libstd/io/stdio.rs src/libstd/io/stdio.rs | |
| index cd2d5e5..cfb71d8 100644 | |
| --- src/libstd/io/stdio.rs | |
| +++ src/libstd/io/stdio.rs | |
| @@ -119,10 +119,10 @@ impl<R: io::Read> io::Read for Maybe<R> { | |
| } | |
| fn handle_ebadf<T>(r: io::Result<T>, default: T) -> io::Result<T> { | |
| - #[cfg(windows)] | |
| + // #[cfg(windows)] | |
| const ERR: i32 = ::sys::c::ERROR_INVALID_HANDLE as i32; | |
| - #[cfg(not(windows))] | |
| - const ERR: i32 = ::libc::EBADF as i32; | |
| + // #[cfg(not(windows))] | |
| + // const ERR: i32 = ::libc::EBADF as i32; | |
| match r { | |
| Err(ref e) if e.raw_os_error() == Some(ERR) => Ok(default), | |
| diff --git src/libstd/lib.rs src/libstd/lib.rs | |
| index 416c01b..7573e0e 100644 | |
| --- src/libstd/lib.rs | |
| +++ src/libstd/lib.rs | |
| @@ -428,9 +428,9 @@ mod memchr; | |
| #[macro_use] | |
| #[path = "sys/common/mod.rs"] mod sys_common; | |
| -#[cfg(unix)] | |
| -#[path = "sys/unix/mod.rs"] mod sys; | |
| -#[cfg(windows)] | |
| +//#[cfg(unix)] | |
| +//#[path = "sys/unix/mod.rs"] mod sys; | |
| +//#[cfg(windows)] | |
| #[path = "sys/windows/mod.rs"] mod sys; | |
| pub mod rt; | |
| diff --git src/libstd/os/mod.rs src/libstd/os/mod.rs | |
| index e15c8d6..4099be7 100644 | |
| --- src/libstd/os/mod.rs | |
| +++ src/libstd/os/mod.rs | |
| @@ -16,7 +16,7 @@ | |
| #[cfg(unix)] | |
| #[stable(feature = "rust1", since = "1.0.0")] | |
| pub use sys::ext as unix; | |
| -#[cfg(windows)] | |
| +// #[cfg(windows)] | |
| #[stable(feature = "rust1", since = "1.0.0")] | |
| pub use sys::ext as windows; | |
| @@ -26,7 +26,7 @@ pub use sys::ext as windows; | |
| #[cfg(target_os = "freebsd")] pub mod freebsd; | |
| #[cfg(target_os = "ios")] pub mod ios; | |
| #[cfg(target_os = "linux")] pub mod linux; | |
| -#[cfg(target_os = "macos")] pub mod macos; | |
| +// #[cfg(target_os = "macos")] pub mod macos; | |
| #[cfg(target_os = "nacl")] pub mod nacl; | |
| #[cfg(target_os = "netbsd")] pub mod netbsd; | |
| #[cfg(target_os = "openbsd")] pub mod openbsd; | |
| diff --git src/libstd/os/raw.rs src/libstd/os/raw.rs | |
| index 55d8ad1..de396d1 100644 | |
| --- src/libstd/os/raw.rs | |
| +++ src/libstd/os/raw.rs | |
| @@ -32,14 +32,14 @@ | |
| #[stable(feature = "raw_os", since = "1.1.0")] pub type c_ushort = u16; | |
| #[stable(feature = "raw_os", since = "1.1.0")] pub type c_int = i32; | |
| #[stable(feature = "raw_os", since = "1.1.0")] pub type c_uint = u32; | |
| -#[cfg(any(target_pointer_width = "32", windows))] | |
| +// #[cfg(any(target_pointer_width = "32", windows))] | |
| #[stable(feature = "raw_os", since = "1.1.0")] pub type c_long = i32; | |
| -#[cfg(any(target_pointer_width = "32", windows))] | |
| +// #[cfg(any(target_pointer_width = "32", windows))] | |
| #[stable(feature = "raw_os", since = "1.1.0")] pub type c_ulong = u32; | |
| -#[cfg(all(target_pointer_width = "64", not(windows)))] | |
| -#[stable(feature = "raw_os", since = "1.1.0")] pub type c_long = i64; | |
| -#[cfg(all(target_pointer_width = "64", not(windows)))] | |
| -#[stable(feature = "raw_os", since = "1.1.0")] pub type c_ulong = u64; | |
| +// #[cfg(all(target_pointer_width = "64", not(windows)))] | |
| +// #[stable(feature = "raw_os", since = "1.1.0")] pub type c_long = i64; | |
| +// #[cfg(all(target_pointer_width = "64", not(windows)))] | |
| +// #[stable(feature = "raw_os", since = "1.1.0")] pub type c_ulong = u64; | |
| #[stable(feature = "raw_os", since = "1.1.0")] pub type c_longlong = i64; | |
| #[stable(feature = "raw_os", since = "1.1.0")] pub type c_ulonglong = u64; | |
| #[stable(feature = "raw_os", since = "1.1.0")] pub type c_float = f32; | |
| diff --git src/libstd/sys/windows/backtrace.rs src/libstd/sys/windows/backtrace.rs | |
| index d106bc3..fc9142d 100644 | |
| --- src/libstd/sys/windows/backtrace.rs | |
| +++ src/libstd/sys/windows/backtrace.rs | |
| @@ -43,7 +43,7 @@ macro_rules! sym{ ($lib:expr, $e:expr, $t:ident) => (unsafe { | |
| } | |
| }) } | |
| -#[cfg(target_env = "msvc")] | |
| +// #[cfg(target_env = "msvc")] | |
| #[path = "printing/msvc.rs"] | |
| mod printing; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment