Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std::io: new ErrorKind value InvalidParam #25406

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libstd/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ pub fn copy<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<u64> {
let from = from.as_ref();
let to = to.as_ref();
if !from.is_file() {
return Err(Error::new(ErrorKind::InvalidInput,
return Err(Error::new(ErrorKind::InvalidParam,
"the source path is not an existing file"))
}

Expand Down
2 changes: 1 addition & 1 deletion src/libstd/io/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ macro_rules! seek {
};

if pos < 0 {
Err(Error::new(ErrorKind::InvalidInput,
Err(Error::new(ErrorKind::InvalidParam,
"invalid seek to a negative position"))
} else {
self.pos = pos as u64;
Expand Down
3 changes: 3 additions & 0 deletions src/libstd/io/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ pub enum ErrorKind {
WouldBlock,
/// A parameter was incorrect.
#[stable(feature = "rust1", since = "1.0.0")]
InvalidParam,
/// Invalid data were encountered in an I/O operation.
#[stable(feature = "rust1", since = "1.0.0")]
InvalidInput,
/// The I/O operation's timeout expired, causing it to be canceled.
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/net/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ impl ToSocketAddrs for str {
($e:expr, $msg:expr) => (
match $e {
Some(r) => r,
None => return Err(io::Error::new(io::ErrorKind::InvalidInput,
None => return Err(io::Error::new(io::ErrorKind::InvalidParam,
$msg)),
}
)
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fn each_addr<A: ToSocketAddrs, F, T>(addr: A, mut f: F) -> io::Result<T>
}
}
Err(last_err.unwrap_or_else(|| {
Error::new(ErrorKind::InvalidInput,
Error::new(ErrorKind::InvalidParam,
"could not resolve to any addresses")
}))
}
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/net/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ mod tests {
match TcpStream::connect("0.0.0.0:1") {
Ok(..) => panic!(),
Err(e) => assert!(e.kind() == ErrorKind::ConnectionRefused ||
e.kind() == ErrorKind::InvalidInput ||
e.kind() == ErrorKind::InvalidParam ||
e.kind() == ErrorKind::AddrInUse ||
e.kind() == ErrorKind::AddrNotAvailable,
"bad error: {} {:?}", e, e.kind()),
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/net/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl UdpSocket {
-> io::Result<usize> {
match try!(addr.to_socket_addrs()).next() {
Some(addr) => self.0.send_to(buf, &addr),
None => Err(Error::new(ErrorKind::InvalidInput,
None => Err(Error::new(ErrorKind::InvalidParam,
"no addresses to send data to")),
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ impl Child {
// newer process that happens to have the same (re-used) id
if self.status.is_some() {
return Err(Error::new(
ErrorKind::InvalidInput,
ErrorKind::InvalidParam,
"invalid argument: can't kill an exited process",
))
}
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/sys/common/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fn sockaddr_to_addr(storage: &libc::sockaddr_storage,
})))
}
_ => {
Err(Error::new(ErrorKind::InvalidInput, "invalid argument"))
Err(Error::new(ErrorKind::InvalidParam, "invalid argument"))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/sys/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ impl DirBuilder {

fn cstr(path: &Path) -> io::Result<CString> {
path.as_os_str().to_cstring().ok_or(
io::Error::new(io::ErrorKind::InvalidInput, "path contained a null"))
io::Error::new(io::ErrorKind::InvalidParam, "path contained a null"))
}

impl FromInner<c_int> for File {
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/sys/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind {
libc::EADDRINUSE => ErrorKind::AddrInUse,
libc::ENOENT => ErrorKind::NotFound,
libc::EINTR => ErrorKind::Interrupted,
libc::EINVAL => ErrorKind::InvalidInput,
libc::EINVAL => ErrorKind::InvalidParam,
libc::ETIMEDOUT => ErrorKind::TimedOut,
libc::consts::os::posix88::EEXIST => ErrorKind::AlreadyExists,

Expand Down
2 changes: 1 addition & 1 deletion src/libstd/sys/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind {
libc::WSAECONNABORTED => ErrorKind::ConnectionAborted,
libc::WSAECONNREFUSED => ErrorKind::ConnectionRefused,
libc::WSAECONNRESET => ErrorKind::ConnectionReset,
libc::WSAEINVAL => ErrorKind::InvalidInput,
libc::WSAEINVAL => ErrorKind::InvalidParam,
libc::WSAENOTCONN => ErrorKind::NotConnected,
libc::WSAEWOULDBLOCK => ErrorKind::WouldBlock,

Expand Down