Skip to content

Commit

Permalink
io::ErrorKind: Discuss matching
Browse files Browse the repository at this point in the history
Closes rust-lang#89175

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
  • Loading branch information
ijackson committed Nov 8, 2021
1 parent 3e3890c commit ae64da2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions library/std/src/io/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ struct Custom {
/// It is used with the [`io::Error`] type.
///
/// [`io::Error`]: Error
///
/// # Handling errors and matching on `ErrorKind`
///
/// In application code, use `match` for the `ErrorKind` values you are expecting; use `_` to match
/// "all other errors".
///
/// In comprehensive and thorough tests, you may need to cut-and-paste the current list of
/// errors from here into your test code. This seems counterintuitive, but is correct,
/// as set out in [this blog post](https://diziet.dreamwidth.org/9894.html#diziet-what-to-do).
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[stable(feature = "rust1", since = "1.0.0")]
#[allow(deprecated)]
Expand Down

0 comments on commit ae64da2

Please sign in to comment.