Skip to content
New issue

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

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

Already on GitHub? # to your account

Ambiguous usage of std::io::ErrorKind::InvalidInput #906

Closed
mzabaluev opened this issue Feb 25, 2015 · 3 comments · Fixed by rust-lang/rust#25246
Closed

Ambiguous usage of std::io::ErrorKind::InvalidInput #906

mzabaluev opened this issue Feb 25, 2015 · 3 comments · Fixed by rust-lang/rust#25246

Comments

@mzabaluev
Copy link
Contributor

The error code InvalidInput on std::io::Error is currently used for at least two different purposes:

  • Indicate invalid programmatic usage, as in seeking to a negative position.
  • Report invalid data, such as when read_to_string reads content that is not valid UTF-8.

I think these two conditions are sufficiently different to deserve separate error codes.

@alexcrichton
Copy link
Member

cc rust-lang/rust#16666 (somewhat related)

@bluss
Copy link
Member

bluss commented May 10, 2015

This clarification is needed, but does it count as a breaking change?

To minimize impact to users it would be better to change the definition of InvalidInput to cover invalid data, and move programmer errors to a different error code?

@mzabaluev
Copy link
Contributor Author

@bluss Yes, the change could go the other way around, and the name InvalidInput describes data format errors better.

bors added a commit to rust-lang/rust that referenced this issue Jun 1, 2015
This takes the cases from `InvalidInput` where a data format error
was encountered. This is different from the documented semantics
of `InvalidInput`, which more likely indicate a programming error.

Fixes rust-lang/rfcs#906
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
3 participants