Skip to content

Commit 7c0421e

Browse files
committed
feat(error): add private __Nonexhaustive variant to Error
BREAKING CHANGE: Adds a new variant to public Error enum. The proper fix is to stop matching exhaustively on `hyper::Error`.
1 parent 486a219 commit 7c0421e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/error.rs

+13
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,18 @@ pub enum Error {
4545
Ssl(SslError),
4646
/// An HTTP/2-specific error, coming from the `solicit` library.
4747
Http2(Http2Error),
48+
49+
#[doc(hidden)]
50+
__Nonexhaustive(Void)
51+
}
52+
53+
#[doc(hidden)]
54+
pub enum Void {}
55+
56+
impl fmt::Debug for Void {
57+
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
58+
match *self {}
59+
}
4860
}
4961

5062
impl fmt::Display for Error {
@@ -65,6 +77,7 @@ impl StdError for Error {
6577
Io(ref e) => e.description(),
6678
Ssl(ref e) => e.description(),
6779
Http2(ref e) => e.description(),
80+
Error::__Nonexhaustive(ref void) => match *void {}
6881
}
6982
}
7083

0 commit comments

Comments
 (0)