Remove 2 tests

This commit is contained in:
hyd-dev 2021-06-06 11:22:25 +08:00
parent 3871c493b2
commit d7aff96053
No known key found for this signature in database
GPG key ID: 74FA7FD5B8DA14B8
2 changed files with 0 additions and 51 deletions

View file

@ -1,12 +0,0 @@
//! `GetProcessHeap()` is special on Windows that it's only supported within libstd.
//! (On Linux and macOS, it's just always unsupported.)
fn main() {
extern "system" {
fn GetProcessHeap() -> *mut std::ffi::c_void;
}
unsafe {
GetProcessHeap();
//~^ ERROR unsupported operation: can't call foreign function: GetProcessHeap
}
}

View file

@ -1,39 +0,0 @@
//! Make sure we can call foreign functions that are only allowed within libstd if we are "libstd"
//! (defining the `start` lang item).
#![feature(lang_items, rustc_private, core_intrinsics)]
#![no_std]
use core::{intrinsics, panic::PanicInfo};
#[lang = "eh_personality"]
fn rust_eh_personality() {}
#[panic_handler]
fn panic_handler(_: &PanicInfo<'_>) -> ! {
intrinsics::abort()
}
#[lang = "start"]
fn start(main: fn(), _argc: isize, _argv: *const *const u8) -> isize {
main();
0
}
fn main() {
#[cfg(unix)]
unsafe {
extern crate libc;
assert_eq!(libc::signal(libc::SIGPIPE, libc::SIG_IGN), 0);
}
#[cfg(windows)]
unsafe {
extern "system" {
fn GetProcessHeap() -> *mut core::ffi::c_void;
fn ExitProcess(code: u32) -> !;
}
assert_eq!(GetProcessHeap() as usize, 1);
// Early exit to avoid the requirement of
// `std::sys::windows::thread_local_key::p_thread_callback`.
ExitProcess(0);
}
}