Open
Description
- I have looked for existing issues (including closed) about this
Bug Report
Version
cargo tree | grep axum
├── axum v0.8.1
│ ├── axum-core v0.5.0
Platform
Linux linuxdesktop 6.12.8-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 02 Jan 2025 22:52:26 +0000 x86_64 GNU/Linux
Steps to reproduce code:
Cargo.toml
edition = "2024"
rust-version = "1.85.0"
main.rs
use axum::Router;
use axum::routing::get;
#[tokio::main]
async fn main() {
let app = Router::new()
.route("/fail2", get(|| async { panic!("panic") }));
let listener = tokio::net::TcpListener::bind("0.0.0.0").await.unwrap();
axum::serve(listener, app).await.unwrap();
}
compiler errors:
error[E0277]: the trait bound `!: IntoResponse` is not satisfied
--> crates/ae_api/src/main.rs:7:30
|
7 | .route("/fail2", get(|| async { panic!("panic") }));
| --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoResponse` is not implemented for `!`
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `IntoResponse`:
&'static [u8; N]
&'static [u8]
&'static str
()
(R,)
(Response<()>, R)
(Response<()>, T1, R)
(Response<()>, T1, T2, R)
and 120 others
= note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #48950 <https://github.com/rust-lang/rust/issues/48950> for more information)
= help: did you intend to use the type `()` here instead?
= note: required for `{closure@crates/ae_api/src/main.rs:7:30: 7:32}` to implement `Handler<((),), ()>`
note: required by a bound in `axum::routing::get`
--> /.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/axum-0.8.1/src/routing/method_routing.rs:440:1
|
440 | top_level_handler_fn!(get, GET);
| ^^^^^^^^^^^^^^^^^^^^^^---^^^^^^
| | |
| | required by a bound in this function
| required by this bound in `get`
= note: this error originates in the macro `top_level_handler_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
edition2021
compiles without errors.
Maybe its related to this: rust-lang/rust#123748