Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

axum 0.8 is not compatible with askama_axum 0.5 #1115

Open
networkhermit opened this issue Jan 1, 2025 · 0 comments · May be fixed by #1116
Open

axum 0.8 is not compatible with askama_axum 0.5 #1115

networkhermit opened this issue Jan 1, 2025 · 0 comments · May be fixed by #1116

Comments

@networkhermit
Copy link

I tried to upgrade axum from 0.7.9 to 0.8.0, but it seems that the breaking changes introduced by axum also break askama_axum 0.5.

I managed to reproduce this issue within askama_axum:

-axum = { version = "0.7", default-features = false }
+axum = { version = "0.8", default-features = false }
cargo test
   Compiling askama_axum v0.5.0 (/home/vac/Downloads/askama/askama_axum)
error[E0277]: the trait bound `fn() -> impl Future<Output = HelloTemplate<'static>> {hello}: Handler<_, _>` is not satisfied
   --> askama_axum/tests/basic.rs:23:44
    |
23  |     let app = Router::new().route("/", get(hello));
    |                                        --- ^^^^^ the trait `Handler<_, _>` is not implemented for fn item `fn() -> impl Future<Output = HelloTemplate<'static>> {hello}`
    |                                        |
    |                                        required by a bound introduced by this call
    |
    = note: Consider using `#[axum::debug_handler]` to improve the error message
    = help: the following other types implement trait `Handler<T, S>`:
              `Layered<L, H, T, S>` implements `Handler<T, S>`
              `MethodRouter<S>` implements `Handler<(), S>`
note: required by a bound in `axum::routing::get`
   --> /home/vac/.cargo/registry/src/mirrors.ustc.edu.cn-4affec411d11e50f/axum-0.8.0/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)

For more information about this error, try `rustc --explain E0277`.
error: could not compile `askama_axum` (test "basic") due to 1 previous error

And bump the version of axum-core seems enough for this issue:

-axum-core = "0.4"
+axum-core = "0.5"
 http = "1.0"

 [dev-dependencies]
-axum = { version = "0.7", default-features = false }
+axum = { version = "0.8", default-features = false }
cargo test
    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.04s
     Running unittests src/lib.rs (/home/vac/Downloads/askama/target/debug/deps/askama_axum-f1829b4c98cc694b)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests/basic.rs (/home/vac/Downloads/askama/target/debug/deps/basic-deeae636f21ff6a1)

running 1 test
test template_to_response ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests askama_axum

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant