diff options
| author | bors <bors@rust-lang.org> | 2017-10-04 00:57:30 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-10-04 00:57:30 +0000 |
| commit | 2db48d7fcbf0a2a1ceb4d8bbcbc74cd37349f629 (patch) | |
| tree | 1ba91df6321403d5752d953ff33716bc20f6a7a1 | |
| parent | bd90aa6daa5b73c2be85f604129ee40a6734cb6b (diff) | |
| parent | a5296a5fb2bf41ea4a13f8546a9fcc1182c5bfaf (diff) | |
| download | rust-2db48d7fcbf0a2a1ceb4d8bbcbc74cd37349f629.tar.gz rust-2db48d7fcbf0a2a1ceb4d8bbcbc74cd37349f629.zip | |
Auto merge of #44979 - hinaria:master, r=dtolnay
make `backtrace = false` compile for windows targets. when building for windows with `backtrace = false`, `libstd` fails to compile because some modules that use items from `sys_common::backtrace::*` are still included, even though those modules aren't used or referenced by anything. `sys_common::backtrace` doesn't exist when the backtrace feature is turned off. -- i've also added `#[cfg(feature = "backtrace")]` to various items that exist exclusively to support `mod backtrace` since the compilation would fail since they would be unused in a configuration with backtraces turned off.
| -rw-r--r-- | src/libstd/sys/windows/c.rs | 11 | ||||
| -rw-r--r-- | src/libstd/sys/windows/mod.rs | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs index 9535ddfe5ca..762e39809cc 100644 --- a/src/libstd/sys/windows/c.rs +++ b/src/libstd/sys/windows/c.rs @@ -279,10 +279,13 @@ pub const WAIT_TIMEOUT: DWORD = 258; pub const WAIT_FAILED: DWORD = 0xFFFFFFFF; #[cfg(target_env = "msvc")] +#[cfg(feature = "backtrace")] pub const MAX_SYM_NAME: usize = 2000; #[cfg(target_arch = "x86")] +#[cfg(feature = "backtrace")] pub const IMAGE_FILE_MACHINE_I386: DWORD = 0x014c; #[cfg(target_arch = "x86_64")] +#[cfg(feature = "backtrace")] pub const IMAGE_FILE_MACHINE_AMD64: DWORD = 0x8664; pub const PROV_RSA_FULL: DWORD = 1; @@ -575,6 +578,7 @@ pub struct OVERLAPPED { #[repr(C)] #[cfg(target_env = "msvc")] +#[cfg(feature = "backtrace")] pub struct SYMBOL_INFO { pub SizeOfStruct: c_ulong, pub TypeIndex: c_ulong, @@ -598,6 +602,7 @@ pub struct SYMBOL_INFO { #[repr(C)] #[cfg(target_env = "msvc")] +#[cfg(feature = "backtrace")] pub struct IMAGEHLP_LINE64 { pub SizeOfStruct: u32, pub Key: *const c_void, @@ -616,6 +621,7 @@ pub enum ADDRESS_MODE { } #[repr(C)] +#[cfg(feature = "backtrace")] pub struct ADDRESS64 { pub Offset: u64, pub Segment: u16, @@ -623,6 +629,7 @@ pub struct ADDRESS64 { } #[repr(C)] +#[cfg(feature = "backtrace")] pub struct STACKFRAME64 { pub AddrPC: ADDRESS64, pub AddrReturn: ADDRESS64, @@ -638,6 +645,7 @@ pub struct STACKFRAME64 { } #[repr(C)] +#[cfg(feature = "backtrace")] pub struct KDHELP64 { pub Thread: u64, pub ThCallbackStack: DWORD, @@ -1089,6 +1097,7 @@ extern "system" { pub fn FindNextFileW(findFile: HANDLE, findFileData: LPWIN32_FIND_DATAW) -> BOOL; pub fn FindClose(findFile: HANDLE) -> BOOL; + #[cfg(feature = "backtrace")] pub fn RtlCaptureContext(ctx: *mut CONTEXT); pub fn getsockopt(s: SOCKET, level: c_int, @@ -1120,7 +1129,9 @@ extern "system" { res: *mut *mut ADDRINFOA) -> c_int; pub fn freeaddrinfo(res: *mut ADDRINFOA); + #[cfg(feature = "backtrace")] pub fn LoadLibraryW(name: LPCWSTR) -> HMODULE; + #[cfg(feature = "backtrace")] pub fn FreeLibrary(handle: HMODULE) -> BOOL; pub fn GetProcAddress(handle: HMODULE, name: LPCSTR) -> *mut c_void; diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs index ee58efc5144..e7a9a121b25 100644 --- a/src/libstd/sys/windows/mod.rs +++ b/src/libstd/sys/windows/mod.rs @@ -20,9 +20,11 @@ use time::Duration; #[macro_use] pub mod compat; pub mod args; +#[cfg(feature = "backtrace")] pub mod backtrace; pub mod c; pub mod condvar; +#[cfg(feature = "backtrace")] pub mod dynamic_lib; pub mod env; pub mod ext; |
