diff options
| author | bors <bors@rust-lang.org> | 2021-07-02 09:01:42 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-07-02 09:01:42 +0000 |
| commit | f9fa13f705bb8b1c57c6b6fe95055ec4995a40f0 (patch) | |
| tree | bbb013fe0b9af5703ce1a04f75d6435d61f473ad /src | |
| parent | 1aa6c7cbc6d2582e7407cde9c65014aef8a189bb (diff) | |
| parent | cc907330083a18a9067664c1db3db1959f58d00c (diff) | |
| download | rust-f9fa13f705bb8b1c57c6b6fe95055ec4995a40f0.tar.gz rust-f9fa13f705bb8b1c57c6b6fe95055ec4995a40f0.zip | |
Auto merge of #85746 - m-ou-se:io-error-other, r=joshtriplett
Redefine `ErrorKind::Other` and stop using it in std. This implements the idea I shared yesterday in the libs meeting when we were discussing how to handle adding new `ErrorKind`s to the standard library: This redefines `Other` to be for *user defined errors only*, and changes all uses of `Other` in the standard library to a `#[doc(hidden)]` and permanently `#[unstable]` `ErrorKind` that users can not match on. This ensures that adding `ErrorKind`s at a later point in time is not a breaking change, since the user couldn't match on these errors anyway. This way, we use the `#[non_exhaustive]` property of the enum in a more effective way. Open questions: - How do we check this change doesn't cause too much breakage? Will a crate run help and be enough? - How do we ensure we don't accidentally start using `Other` again in the standard library? We don't have a `pub(not crate)` or `#[deprecated(in this crate only)]`. cc https://github.com/rust-lang/rust/pull/79965 cc `@rust-lang/libs` `@ijackson` r? `@dtolnay`
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/write-fmt-errors.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/test/ui/write-fmt-errors.rs b/src/test/ui/write-fmt-errors.rs index 7dd98564425..3fcaefaa63e 100644 --- a/src/test/ui/write-fmt-errors.rs +++ b/src/test/ui/write-fmt-errors.rs @@ -1,5 +1,7 @@ // run-pass +#![feature(io_error_uncategorized)] + use std::fmt; use std::io::{self, Error, Write, sink}; @@ -13,7 +15,7 @@ impl fmt::Display for ErrorDisplay { struct ErrorWriter; -const FORMAT_ERROR: io::ErrorKind = io::ErrorKind::Other; +const FORMAT_ERROR: io::ErrorKind = io::ErrorKind::Uncategorized; const WRITER_ERROR: io::ErrorKind = io::ErrorKind::NotConnected; impl Write for ErrorWriter { |
