Skip to content

Commit 37cbc7d

Browse files
committed
add some more summary from pr discussion
1 parent 4905814 commit 37cbc7d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

library/std/src/io/error.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,10 @@ struct Custom {
147147
/// In application code, use `match` for the `ErrorKind` values you are expecting; use `_` to match
148148
/// "all other errors".
149149
///
150-
/// In comprehensive and thorough tests, you may need to cut-and-paste the current list of
151-
/// errors from here into your test code.
150+
/// In comprehensive and thorough tests that want to verify that a test doesn't return any known incorrect error kind,
151+
/// you may want to cut-and-paste the current list of errors from here into your test code. This seems counterintuitive,
152+
/// but it will make your tests more robust. In particular, if you want to verify that your code does produce an
153+
/// unrecognized error kind, the robust solution is to check for all the recognized error kinds and fail in those cases.
152154
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
153155
#[stable(feature = "rust1", since = "1.0.0")]
154156
#[allow(deprecated)]

0 commit comments

Comments
 (0)