]> git.lizzy.rs Git - rust.git/commitdiff
Make std::io::Error #[non_exhaustive]
authorvarkor <github@varkor.com>
Wed, 15 Aug 2018 15:57:06 +0000 (16:57 +0100)
committervarkor <github@varkor.com>
Wed, 15 Aug 2018 16:16:48 +0000 (17:16 +0100)
src/libstd/io/error.rs
src/libstd/lib.rs

index 02a3ce8b9c4d475a0dcdb366fcdcd44a9344521b..3e50988a68ba2e13fa34e29e17e3f902f6abfbaf 100644 (file)
@@ -97,6 +97,7 @@ struct Custom {
 #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
 #[stable(feature = "rust1", since = "1.0.0")]
 #[allow(deprecated)]
+#[non_exhaustive]
 pub enum ErrorKind {
     /// An entity was not found, often a file.
     #[stable(feature = "rust1", since = "1.0.0")]
@@ -180,15 +181,6 @@ pub enum ErrorKind {
     /// read.
     #[stable(feature = "read_exact", since = "1.6.0")]
     UnexpectedEof,
-
-    /// 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",
-               issue = "0")]
-    #[doc(hidden)]
-    __Nonexhaustive,
 }
 
 impl ErrorKind {
@@ -212,7 +204,6 @@ fn as_str(&self) -> &'static str {
             ErrorKind::Interrupted => "operation interrupted",
             ErrorKind::Other => "other os error",
             ErrorKind::UnexpectedEof => "unexpected end of file",
-            ErrorKind::__Nonexhaustive => unreachable!()
         }
     }
 }
index 5d463225ae93b646f3ef3e8612806a6870e9f2b5..60ad330bb9b72a280dd9f888de474e6888c916ba 100644 (file)
 #![feature(doc_keyword)]
 #![feature(panic_info_message)]
 #![feature(panic_implementation)]
+#![feature(non_exhaustive)]
 
 #![default_lib_allocator]