--- a/src/clircle_unix.rs +++ b/src/clircle_unix.rs @@ -4,7 +4,7 @@ use std::convert::TryFrom; use std::fs::File; use std::io::{self, Seek}; use std::os::unix::fs::MetadataExt; -use std::os::unix::io::{FromRawFd, IntoRawFd, RawFd}; +use std::os::unix::io::{AsRawFd,FromRawFd, IntoRawFd, RawFd}; use std::{cmp, hash, ops}; /// Re-export of libc @@ -186,7 +186,7 @@ mod tests { #[test] fn test_pty_equal_but_not_conflicting() -> Result<(), &'static str> { let OpenptyResult { master, slave } = openpty(None, None).expect("Could not open pty."); - let res = unsafe { UnixIdentifier::try_from_raw_fd(slave, false) } + let res = unsafe { UnixIdentifier::try_from_raw_fd(slave.as_raw_fd(), false) } .map_err(|_| "Error creating UnixIdentifier from pty fd") .and_then(|ident| { if !ident.eq(&ident) { @@ -196,7 +196,7 @@ mod tests { return Err("pty fd does not conflict with itself, but conflict detected"); } - let second_ident = unsafe { UnixIdentifier::try_from_raw_fd(slave, false) } + let second_ident = unsafe { UnixIdentifier::try_from_raw_fd(slave.as_raw_fd(), false) } .map_err(|_| "Error creating second Identifier to pty")?; if !ident.eq(&second_ident) { return Err("ident != second_ident"); @@ -209,8 +209,8 @@ mod tests { Ok(()) }); - let r1 = close(master); - let r2 = close(slave); + let r1 = close(master.as_raw_fd()); + let r2 = close(slave.as_raw_fd()); r1.expect("Error closing master end of pty"); r2.expect("Error closing slave end of pty");