rust/tests/compile-fail/fs/read_from_stdout.rs
Samrat Man Singh bea7113eb8 Add impl FileDescriptor for stdin, stdout, stderr
- Use `FileDescriptor::read` for stdin reads
- Use `FileDescriptor::write` for stdout/err writes
- Handle stdout/err reads in `FileDescriptor::read`
2020-08-04 01:14:52 +05:30

15 lines
332 B
Rust

// compile-flags: -Zmiri-disable-isolation
// ignore-windows: No libc on Windows
#![feature(rustc_private)]
extern crate libc;
fn main() -> std::io::Result<()> {
let mut bytes = [0u8; 512];
unsafe {
libc::read(1, bytes.as_mut_ptr() as *mut libc::c_void, 512); //~ ERROR cannot read from stdout
}
Ok(())
}