]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfcs/rfc-1014.rs
Rollup merge of #75837 - GuillaumeGomez:fix-font-color-help-button, r=Cldfire
[rust.git] / src / test / ui / rfcs / rfc-1014.rs
1 // run-pass
2 #![allow(dead_code)]
3 // ignore-cloudabi stdout does not map to file descriptor 1 by default
4 // ignore-wasm32-bare no libc
5 // ignore-sgx no libc
6
7 #![feature(rustc_private)]
8
9 extern crate libc;
10
11 type DWORD = u32;
12 type HANDLE = *mut u8;
13
14 #[cfg(windows)]
15 extern "system" {
16     fn GetStdHandle(which: DWORD) -> HANDLE;
17     fn CloseHandle(handle: HANDLE) -> i32;
18 }
19
20 #[cfg(windows)]
21 fn close_stdout() {
22     const STD_OUTPUT_HANDLE: DWORD = -11i32 as DWORD;
23     unsafe { CloseHandle(GetStdHandle(STD_OUTPUT_HANDLE)); }
24 }
25
26 #[cfg(not(windows))]
27 fn close_stdout() {
28     unsafe { libc::close(1); }
29 }
30
31 fn main() {
32     close_stdout();
33     println!("hello");
34     println!("world");
35 }