Skip to content

Commit 3093bb8

Browse files
committed
Fix error during cross-platform documentation.
1 parent b4114eb commit 3093bb8

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/libstd/sys/unix/ext/net.rs

+11
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,19 @@
1212

1313
//! Unix-specific networking functionality
1414
15+
#[cfg(unix)]
1516
use libc;
1617

18+
// FIXME(#43348): Make libc adapt #[doc(cfg(...))] so we don't need these fake definitions here?
19+
#[cfg(not(unix))]
20+
mod libc {
21+
pub use libc::c_int;
22+
pub type socklen_t = u32;
23+
pub struct sockaddr;
24+
#[derive(Clone)]
25+
pub struct sockaddr_un;
26+
}
27+
1728
use ascii;
1829
use ffi::OsStr;
1930
use fmt;

src/libstd/sys/windows/c.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ pub const PIPE_READMODE_BYTE: DWORD = 0x00000000;
301301
pub const FD_SETSIZE: usize = 64;
302302

303303
#[repr(C)]
304-
#[cfg(target_arch = "x86")]
304+
#[cfg(not(target_pointer_width = "64"))]
305305
pub struct WSADATA {
306306
pub wVersion: WORD,
307307
pub wHighVersion: WORD,
@@ -312,7 +312,7 @@ pub struct WSADATA {
312312
pub lpVendorInfo: *mut u8,
313313
}
314314
#[repr(C)]
315-
#[cfg(target_arch = "x86_64")]
315+
#[cfg(target_pointer_width = "64")]
316316
pub struct WSADATA {
317317
pub wVersion: WORD,
318318
pub wHighVersion: WORD,
@@ -768,6 +768,14 @@ pub struct FLOATING_SAVE_AREA {
768768
_Dummy: [u8; 512] // FIXME: Fill this out
769769
}
770770

771+
// FIXME(#43348): This structure is used for backtrace only, and a fake
772+
// definition is provided here only to allow rustdoc to pass type-check. This
773+
// will not appear in the final documentation. This should be also defined for
774+
// other architectures supported by Windows such as ARM, and for historical
775+
// interest, maybe MIPS and PowerPC as well.
776+
#[cfg(all(dox, not(any(target_arch = "x86_64", target_arch = "x86"))))]
777+
pub enum CONTEXT {}
778+
771779
#[repr(C)]
772780
pub struct SOCKADDR_STORAGE_LH {
773781
pub ss_family: ADDRESS_FAMILY,

0 commit comments

Comments
 (0)