Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

axum 0.8 is not compatible with askama_axum 0.5 #1115

@networkhermit

Description

@networkhermit

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions