]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfcs/rfc-1014.rs
Require Drop impls to have the same constness on its bounds as the bounds on the...
[rust.git] / src / test / ui / rfcs / rfc-1014.rs
1 // run-pass
2 #![allow(dead_code)]
3 // ignore-wasm32-bare no libc
4 // ignore-sgx no libc
5
6 #![feature(rustc_private)]
7
8 extern crate libc;
9
10 type DWORD = u32;
11 type HANDLE = *mut u8;
12
13 #[cfg(windows)]
14 extern "system" {
15     fn GetStdHandle(which: DWORD) -> HANDLE;
16     fn CloseHandle(handle: HANDLE) -> i32;
17 }
18
19 #[cfg(windows)]
20 fn close_stdout() {
21     const STD_OUTPUT_HANDLE: DWORD = -11i32 as DWORD;
22     unsafe { CloseHandle(GetStdHandle(STD_OUTPUT_HANDLE)); }
23 }
24
25 #[cfg(not(windows))]
26 fn close_stdout() {
27     unsafe { libc::close(1); }
28 }
29
30 fn main() {
31     close_stdout();
32     println!("hello");
33     println!("world");
34 }