From 7c0421e3fc1d5a8b4868b57acca87abd685f3430 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Tue, 2 Jun 2015 10:25:01 -0700 Subject: [PATCH] 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`. --- src/error.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/error.rs b/src/error.rs index 299d2c02b5..96844f45d0 100644 --- a/src/error.rs +++ b/src/error.rs @@ -45,6 +45,18 @@ pub enum Error { Ssl(SslError), /// An HTTP/2-specific error, coming from the `solicit` library. Http2(Http2Error), + + #[doc(hidden)] + __Nonexhaustive(Void) +} + +#[doc(hidden)] +pub enum Void {} + +impl fmt::Debug for Void { + fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result { + match *self {} + } } impl fmt::Display for Error { @@ -65,6 +77,7 @@ impl StdError for Error { Io(ref e) => e.description(), Ssl(ref e) => e.description(), Http2(ref e) => e.description(), + Error::__Nonexhaustive(ref void) => match *void {} } }