]> git.lizzy.rs Git - rust.git/commitdiff
Implement more traits for `std::io::ErrorKind`
authorTobias Bucher <tobiasbucher5991@gmail.com>
Tue, 23 Aug 2016 00:07:50 +0000 (02:07 +0200)
committerTobias Bucher <tobiasbucher5991@gmail.com>
Tue, 23 Aug 2016 00:10:22 +0000 (02:10 +0200)
This makes it possible to use it as key in various maps.

src/libstd/io/error.rs

index 5333b0a531eaebd671245e8081c71a4cb72cc028..aa6ec75e3fc0cdbc976e29fffe9eda62efb87212 100644 (file)
@@ -83,7 +83,7 @@ struct Custom {
 /// It is used with the [`io::Error`] type.
 ///
 /// [`io::Error`]: struct.Error.html
-#[derive(Copy, PartialEq, Eq, Clone, Debug)]
+#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
 #[stable(feature = "rust1", since = "1.0.0")]
 #[allow(deprecated)]
 pub enum ErrorKind {
@@ -152,10 +152,6 @@ pub enum ErrorKind {
     /// Interrupted operations can typically be retried.
     #[stable(feature = "rust1", since = "1.0.0")]
     Interrupted,
-    /// Any I/O error not part of this list.
-    #[stable(feature = "rust1", since = "1.0.0")]
-    Other,
-
     /// An error returned when an operation could not be completed because an
     /// "end of file" was reached prematurely.
     ///
@@ -164,8 +160,12 @@ pub enum ErrorKind {
     /// read.
     #[stable(feature = "read_exact", since = "1.6.0")]
     UnexpectedEof,
-
     /// Any I/O error not part of this list.
+    #[stable(feature = "rust1", since = "1.0.0")]
+    Other,
+
+    /// A marker variant that tells the compiler that users of this enum cannot
+    /// match it exhaustively.
     #[unstable(feature = "io_error_internals",
                reason = "better expressed through extensible enums that this \
                          enum cannot be exhaustively matched against",