-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Unclear example in io::Error #106937
Comments
can you give us a running example to help us reproduce the issue? |
I apologize if I missed this in the doc report template, but I've never reported a doc issue before. Can you clarify what you mean by a running example? Do you mean the command to build the docs highlighted in the link? |
The variant is |
To summarise the above points, the relevant part of the example is the following: fn main() {
// Will print "Uncategorized".
print_error(Error::last_os_error()); This is weird for two reasons:
Maybe the example could use |
…idden-documentation, r=ChrisDenton Clarify `Error::last_os_error` can be weird Fundamentally, querying the OS for error codes is a process that is deeply subject to the whims of chance and fortune. We can account for OS, but not for every combination of platform APIs. A compiled binary may not recognize new errors introduced years later. We should clarify a few especially odd situations, and what they mean: We can effectively promise nothing... if you ask for Rust to decode errors where none have occurred. This allows removing mention of ErrorKind::Uncategorized. That error variant is hidden deliberately, so we should not explicitly mention it. This fixes rust-lang#106937. Since you had an opinion also: Does this solution seem acceptable? r? `@ChrisDenton`
Location
The unclear example is located here.
Summary
I originally interpreted this example to mean that constructing an error from a raw error code always resulted in
ErrorKind::Uncategorized
. I think it might help to be explicit that no error has occurred yet and that is the reason that this shows up as uncategorized.The text was updated successfully, but these errors were encountered: