From ea505fd60b09bbfb127c874a27abac52d44bfe00 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 15 Aug 2018 16:57:06 +0100 Subject: [PATCH] Make std::io::Error #[non_exhaustive] --- src/libstd/io/error.rs | 11 +---------- src/libstd/lib.rs | 1 + 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index 02a3ce8b9c4..3e50988a68b 100644 --- a/src/libstd/io/error.rs +++ b/src/libstd/io/error.rs @@ -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 @@ impl ErrorKind { ErrorKind::Interrupted => "operation interrupted", ErrorKind::Other => "other os error", ErrorKind::UnexpectedEof => "unexpected end of file", - ErrorKind::__Nonexhaustive => unreachable!() } } } diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 5d463225ae9..60ad330bb9b 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -311,6 +311,7 @@ #![feature(doc_keyword)] #![feature(panic_info_message)] #![feature(panic_implementation)] +#![feature(non_exhaustive)] #![default_lib_allocator]