Skip to content

Commit ea505fd

Browse files
committed
Make std::io::Error #[non_exhaustive]
1 parent a502248 commit ea505fd

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

src/libstd/io/error.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ struct Custom {
9797
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
9898
#[stable(feature = "rust1", since = "1.0.0")]
9999
#[allow(deprecated)]
100+
#[non_exhaustive]
100101
pub enum ErrorKind {
101102
/// An entity was not found, often a file.
102103
#[stable(feature = "rust1", since = "1.0.0")]
@@ -180,15 +181,6 @@ pub enum ErrorKind {
180181
/// read.
181182
#[stable(feature = "read_exact", since = "1.6.0")]
182183
UnexpectedEof,
183-
184-
/// A marker variant that tells the compiler that users of this enum cannot
185-
/// match it exhaustively.
186-
#[unstable(feature = "io_error_internals",
187-
reason = "better expressed through extensible enums that this \
188-
enum cannot be exhaustively matched against",
189-
issue = "0")]
190-
#[doc(hidden)]
191-
__Nonexhaustive,
192184
}
193185

194186
impl ErrorKind {
@@ -212,7 +204,6 @@ impl ErrorKind {
212204
ErrorKind::Interrupted => "operation interrupted",
213205
ErrorKind::Other => "other os error",
214206
ErrorKind::UnexpectedEof => "unexpected end of file",
215-
ErrorKind::__Nonexhaustive => unreachable!()
216207
}
217208
}
218209
}

src/libstd/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@
311311
#![feature(doc_keyword)]
312312
#![feature(panic_info_message)]
313313
#![feature(panic_implementation)]
314+
#![feature(non_exhaustive)]
314315

315316
#![default_lib_allocator]
316317

0 commit comments

Comments
 (0)