Skip to content

Commit ae64da2

Browse files
committed
io::ErrorKind: Discuss matching
Closes rust-lang#89175 Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
1 parent 3e3890c commit ae64da2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

library/std/src/io/error.rs

+9
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,15 @@ struct Custom {
8888
/// It is used with the [`io::Error`] type.
8989
///
9090
/// [`io::Error`]: Error
91+
///
92+
/// # Handling errors and matching on `ErrorKind`
93+
///
94+
/// In application code, use `match` for the `ErrorKind` values you are expecting; use `_` to match
95+
/// "all other errors".
96+
///
97+
/// In comprehensive and thorough tests, you may need to cut-and-paste the current list of
98+
/// errors from here into your test code. This seems counterintuitive, but is correct,
99+
/// as set out in [this blog post](https://diziet.dreamwidth.org/9894.html#diziet-what-to-do).
91100
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
92101
#[stable(feature = "rust1", since = "1.0.0")]
93102
#[allow(deprecated)]

0 commit comments

Comments
 (0)