diff --git a/actix-http/src/error.rs b/actix-http/src/error.rs index 2c01c86db..9e520c722 100644 --- a/actix-http/src/error.rs +++ b/actix-http/src/error.rs @@ -158,6 +158,14 @@ impl ResponseError for TimeoutError { } } +/// Return `INTERNAL_SERVER_ERROR` for `std::convert::Infallible` +impl ResponseError for std::convert::Infallible { + fn error_response(&self) -> Response { + // `std::convert::Infallible` should never happen + unreachable!() + } +} + #[derive(Debug, Display)] #[display(fmt = "UnknownError")] struct UnitError;