mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-24 21:53:56 +00:00
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.
This commit is contained in:
commit
2db48d7fcb
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user