]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/fs/unix_open_missing_required_mode.rs
rustup
[rust.git] / tests / compile-fail / fs / unix_open_missing_required_mode.rs
1 // ignore-windows: No libc on Windows
2 // compile-flags: -Zmiri-disable-isolation
3
4 #![feature(rustc_private)]
5
6 extern crate libc;
7
8 fn main() {
9     test_file_open_missing_needed_mode();
10 }
11
12 fn test_file_open_missing_needed_mode() {
13     let name = b"missing_arg.txt\0";
14     let name_ptr = name.as_ptr().cast::<libc::c_char>();
15     let _fd = unsafe { libc::open(name_ptr, libc::O_CREAT) }; //~ ERROR Undefined Behavior: incorrect number of arguments for `open` with `O_CREAT`: got 2, expected 3
16 }