diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
commit | 64d98f8ee037282c35007b64c2649055c56af1db (patch) | |
tree | 5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /tests/ui/abi/x86stdcall2.rs | |
parent | Adding debian version 1.67.1+dfsg1-1. (diff) | |
download | rustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/abi/x86stdcall2.rs')
-rw-r--r-- | tests/ui/abi/x86stdcall2.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/ui/abi/x86stdcall2.rs b/tests/ui/abi/x86stdcall2.rs new file mode 100644 index 000000000..4d508ecb2 --- /dev/null +++ b/tests/ui/abi/x86stdcall2.rs @@ -0,0 +1,27 @@ +// run-pass +// only-windows + +#![allow(non_camel_case_types)] +pub type HANDLE = usize; +pub type DWORD = u32; +pub type SIZE_T = u32; +pub type LPVOID = usize; +pub type BOOL = u8; + +mod kernel32 { + use super::{BOOL, DWORD, HANDLE, LPVOID, SIZE_T}; + + extern "system" { + pub fn GetProcessHeap() -> HANDLE; + pub fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T) -> LPVOID; + pub fn HeapFree(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPVOID) -> BOOL; + } +} + +pub fn main() { + let heap = unsafe { kernel32::GetProcessHeap() }; + let mem = unsafe { kernel32::HeapAlloc(heap, 0, 100) }; + assert!(mem != 0); + let res = unsafe { kernel32::HeapFree(heap, 0, mem) }; + assert!(res != 0); +} |