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 InvalidData #25246

Merged
merged 2 commits into from
Jun 2, 2015
Merged
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
7 changes: 7 additions & 0 deletions src/libstd/io/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ pub enum ErrorKind {
/// A parameter was incorrect.
#[stable(feature = "rust1", since = "1.0.0")]
InvalidInput,
/// Data not valid for the operation were encountered.
///
/// Unlike `InvalidInput`, this typically means that the operation
/// parameters were valid, however the error was caused by malformed
/// input data.
#[stable(feature = "io_invalid_data", since = "1.2.0")]
InvalidData,
/// The I/O operation's timeout expired, causing it to be canceled.
#[stable(feature = "rust1", since = "1.0.0")]
TimedOut,
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ fn append_to_string<F>(buf: &mut String, f: F) -> Result<usize>
let ret = f(g.s);
if str::from_utf8(&g.s[g.len..]).is_err() {
ret.and_then(|_| {
Err(Error::new(ErrorKind::InvalidInput,
Err(Error::new(ErrorKind::InvalidData,
"stream did not contain valid UTF-8"))
})
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/sys/windows/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,5 @@ impl Output {
}

fn invalid_encoding() -> io::Error {
io::Error::new(io::ErrorKind::InvalidInput, "text was not valid unicode")
io::Error::new(io::ErrorKind::InvalidData, "text was not valid unicode")
}