diff --git a/actix-http/CHANGES.md b/actix-http/CHANGES.md index 849839378..6820626f5 100644 --- a/actix-http/CHANGES.md +++ b/actix-http/CHANGES.md @@ -6,6 +6,9 @@ * Add support for sending HTTP requests with `Rc` in addition to sending HTTP requests with `RequestHead` +* Allow to use `std::convert::Infallible` as `actix_http::error::Error` + + ### Fixed * h2 will use error response #1080 diff --git a/actix-http/src/error.rs b/actix-http/src/error.rs index 2c01c86db..90c35e486 100644 --- a/actix-http/src/error.rs +++ b/actix-http/src/error.rs @@ -132,6 +132,14 @@ impl std::error::Error for Error { } } +impl From for Error { + fn from(_: std::convert::Infallible) -> Self { + // `std::convert::Infallible` indicates an error + // that will never happen + unreachable!() + } +} + /// Convert `Error` to a `Response` instance impl From for Response { fn from(err: Error) -> Self {