Skip to content

Commit 2527f41

Browse files
committed
Auto merge of #41787 - jsheard:ulongptr, r=alexcrichton
Fix definitions of ULONG_PTR The Windows type `ULONG_PTR` is supposed to be equivalent to `usize`, but several parts of the codebase currently define it as `u64`. Evidently this hasn't broken anything yet but it might cause annoying 32-bit-specific breakage in future. See https://msdn.microsoft.com/en-gb/library/windows/desktop/aa383751(v=vs.85).aspx r? @alexcrichton
2 parents c1a960a + db8be04 commit 2527f41

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/libpanic_unwind/windows.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
#![allow(dead_code)]
1313
#![cfg(windows)]
1414

15-
use libc::{c_long, c_ulong, c_ulonglong, c_void};
15+
use libc::{c_long, c_ulong, c_void};
1616

1717
pub type DWORD = c_ulong;
1818
pub type LONG = c_long;
19-
pub type ULONG_PTR = c_ulonglong;
19+
pub type ULONG_PTR = usize;
2020
pub type LPVOID = *mut c_void;
2121

2222
pub const EXCEPTION_MAXIMUM_PARAMETERS: usize = 15;

src/librustc_data_structures/flock.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,11 @@ mod imp {
247247
use std::os::windows::raw::HANDLE;
248248
use std::path::Path;
249249
use std::fs::{File, OpenOptions};
250-
use std::os::raw::{c_ulong, c_ulonglong, c_int};
250+
use std::os::raw::{c_ulong, c_int};
251251

252252
type DWORD = c_ulong;
253253
type BOOL = c_int;
254-
type ULONG_PTR = c_ulonglong;
254+
type ULONG_PTR = usize;
255255

256256
type LPOVERLAPPED = *mut OVERLAPPED;
257257
const LOCKFILE_EXCLUSIVE_LOCK: DWORD = 0x00000002;

src/libstd/sys/windows/c.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
#![cfg_attr(test, allow(dead_code))]
1515
#![unstable(issue = "0", feature = "windows_c")]
1616

17-
use os::raw::{c_int, c_uint, c_ulong, c_long, c_longlong, c_ushort,};
18-
use os::raw::{c_char, c_ulonglong};
17+
use os::raw::{c_int, c_uint, c_ulong, c_long, c_longlong, c_ushort, c_char};
18+
#[cfg(target_arch = "x86_64")]
19+
use os::raw::c_ulonglong;
1920
use libc::{wchar_t, size_t, c_void};
2021
use ptr;
2122

@@ -45,7 +46,7 @@ pub type SIZE_T = usize;
4546
pub type WORD = u16;
4647
pub type CHAR = c_char;
4748
pub type HCRYPTPROV = LONG_PTR;
48-
pub type ULONG_PTR = c_ulonglong;
49+
pub type ULONG_PTR = usize;
4950
pub type ULONG = c_ulong;
5051
#[cfg(target_arch = "x86_64")]
5152
pub type ULONGLONG = u64;

0 commit comments

Comments
 (0)