[GH-ISSUE #40] Compiling errors: error[E0277]: the trait bound... #31

Closed
opened 2026-02-27 10:15:23 +03:00 by kerem · 8 comments
Owner

Originally created by @yonas on GitHub (Nov 23, 2023).
Original GitHub issue: https://github.com/matze/wastebin/issues/40

   Compiling rusqlite_migration v1.1.0 (https://github.com/cljoly/rusqlite_migration?rev=dff7b6ba305d0d5b334c40fde72a88e28984242a#dff7b6ba)
   Compiling wastebin v2.4.2 (/home/yonas/.cargo/git/checkouts/wastebin-881bf3cc3acc814d/fff2b13)
error[E0277]: the trait bound `Compression<tower_http::trace::Trace<tower_http::timeout::Timeout<Route>, SharedClassifier<ServerErrorsAsFailures>>>: Service<axum::http::Request<_>>` is not satisfied
  --> src/main.rs:44:43
   |
44 |     Router::new().merge(routes::routes()).layer(
   |                                           ^^^^^ the trait `Service<axum::http::Request<_>>` is not implemented for `Compression<tower_http::trace::Trace<tower_http::timeout::Timeout<Route>, SharedClassifier<ServerErrorsAsFailures>>>`
   |
   = help: the trait `Service<http::request::Request<ReqBody>>` is implemented for `Compression<S, P>`
   = note: required for `axum_core::extract::default_body_limit::private::DefaultBodyLimitService<Compression<tower_http::trace::Trace<tower_http::timeout::Timeout<Route>, SharedClassifier<ServerErrorsAsFailures>>>>` to implement `Service<axum::http::Request<_>>`

error[E0277]: the trait bound `Compression<tower_http::trace::Trace<tower_http::timeout::Timeout<Route>, SharedClassifier<ServerErrorsAsFailures>>>: Service<axum::http::Request<_>>` is not satisfied
   --> src/main.rs:45:9
    |
44  |       Router::new().merge(routes::routes()).layer(
    |                                             ----- required by a bound introduced by this call
45  | /         ServiceBuilder::new()
46  | |             .layer(DefaultBodyLimit::max(max_body_size))
47  | |             .layer(DefaultBodyLimit::disable())
48  | |             .layer(CompressionLayer::new())
49  | |             .layer(TraceLayer::new_for_http())
50  | |             .layer(TimeoutLayer::new(timeout)),
    | |______________________________________________^ the trait `Service<axum::http::Request<_>>` is not implemented for `Compression<tower_http::trace::Trace<tower_http::timeout::Timeout<Route>, SharedClassifier<ServerErrorsAsFailures>>>`
    |
    = help: the trait `Service<http::request::Request<ReqBody>>` is implemented for `Compression<S, P>`
    = note: required for `axum_core::extract::default_body_limit::private::DefaultBodyLimitService<Compression<tower_http::trace::Trace<tower_http::timeout::Timeout<Route>, SharedClassifier<ServerErrorsAsFailures>>>>` to implement `Service<axum::http::Request<_>>`
    = note: 1 redundant requirement hidden
    = note: required for `DefaultBodyLimitService<DefaultBodyLimitService<Compression<Trace<Timeout<Route>, SharedClassifier<ServerErrorsAsFailures>>>>>` to implement `Service<axum::http::Request<_>>`
    = note: the full type name has been written to '/tmp/cargo-installuH09C3/release/deps/wastebin-12b14d5f94a91f94.long-type-12565228264898541124.txt'
note: required by a bound in `Router::<S, B>::layer`
   --> /home/yonas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/axum-0.6.20/src/routing/mod.rs:236:21
    |
233 |     pub fn layer<L, NewReqBody>(self, layer: L) -> Router<S, NewReqBody>
    |            ----- required by a bound in this associated function
...
236 |         L::Service: Service<Request<NewReqBody>> + Clone + Send + 'static,
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Router::<S, B>::layer`

For more information about this error, try `rustc --explain E0277`.

wastebin: fff2b13
FreeBSD 14.0-RELEASE

Originally created by @yonas on GitHub (Nov 23, 2023). Original GitHub issue: https://github.com/matze/wastebin/issues/40 ``` Compiling rusqlite_migration v1.1.0 (https://github.com/cljoly/rusqlite_migration?rev=dff7b6ba305d0d5b334c40fde72a88e28984242a#dff7b6ba) Compiling wastebin v2.4.2 (/home/yonas/.cargo/git/checkouts/wastebin-881bf3cc3acc814d/fff2b13) error[E0277]: the trait bound `Compression<tower_http::trace::Trace<tower_http::timeout::Timeout<Route>, SharedClassifier<ServerErrorsAsFailures>>>: Service<axum::http::Request<_>>` is not satisfied --> src/main.rs:44:43 | 44 | Router::new().merge(routes::routes()).layer( | ^^^^^ the trait `Service<axum::http::Request<_>>` is not implemented for `Compression<tower_http::trace::Trace<tower_http::timeout::Timeout<Route>, SharedClassifier<ServerErrorsAsFailures>>>` | = help: the trait `Service<http::request::Request<ReqBody>>` is implemented for `Compression<S, P>` = note: required for `axum_core::extract::default_body_limit::private::DefaultBodyLimitService<Compression<tower_http::trace::Trace<tower_http::timeout::Timeout<Route>, SharedClassifier<ServerErrorsAsFailures>>>>` to implement `Service<axum::http::Request<_>>` error[E0277]: the trait bound `Compression<tower_http::trace::Trace<tower_http::timeout::Timeout<Route>, SharedClassifier<ServerErrorsAsFailures>>>: Service<axum::http::Request<_>>` is not satisfied --> src/main.rs:45:9 | 44 | Router::new().merge(routes::routes()).layer( | ----- required by a bound introduced by this call 45 | / ServiceBuilder::new() 46 | | .layer(DefaultBodyLimit::max(max_body_size)) 47 | | .layer(DefaultBodyLimit::disable()) 48 | | .layer(CompressionLayer::new()) 49 | | .layer(TraceLayer::new_for_http()) 50 | | .layer(TimeoutLayer::new(timeout)), | |______________________________________________^ the trait `Service<axum::http::Request<_>>` is not implemented for `Compression<tower_http::trace::Trace<tower_http::timeout::Timeout<Route>, SharedClassifier<ServerErrorsAsFailures>>>` | = help: the trait `Service<http::request::Request<ReqBody>>` is implemented for `Compression<S, P>` = note: required for `axum_core::extract::default_body_limit::private::DefaultBodyLimitService<Compression<tower_http::trace::Trace<tower_http::timeout::Timeout<Route>, SharedClassifier<ServerErrorsAsFailures>>>>` to implement `Service<axum::http::Request<_>>` = note: 1 redundant requirement hidden = note: required for `DefaultBodyLimitService<DefaultBodyLimitService<Compression<Trace<Timeout<Route>, SharedClassifier<ServerErrorsAsFailures>>>>>` to implement `Service<axum::http::Request<_>>` = note: the full type name has been written to '/tmp/cargo-installuH09C3/release/deps/wastebin-12b14d5f94a91f94.long-type-12565228264898541124.txt' note: required by a bound in `Router::<S, B>::layer` --> /home/yonas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/axum-0.6.20/src/routing/mod.rs:236:21 | 233 | pub fn layer<L, NewReqBody>(self, layer: L) -> Router<S, NewReqBody> | ----- required by a bound in this associated function ... 236 | L::Service: Service<Request<NewReqBody>> + Clone + Send + 'static, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Router::<S, B>::layer` For more information about this error, try `rustc --explain E0277`. ``` wastebin: fff2b13 FreeBSD 14.0-RELEASE
kerem closed this issue 2026-02-27 10:15:23 +03:00
Author
Owner

@yonas commented on GitHub (Nov 23, 2023):

This error doesn't appear for v2.4.2:

$ git checkout tags/2.4.2
$ cargo build --release
...
   Compiling wastebin v2.4.1 (/memfs/git/wastebin)
    Finished release [optimized] target(s) in 4m 30s
<!-- gh-comment-id:1824651818 --> @yonas commented on GitHub (Nov 23, 2023): This error doesn't appear for v2.4.2: ``` $ git checkout tags/2.4.2 $ cargo build --release ... Compiling wastebin v2.4.1 (/memfs/git/wastebin) Finished release [optimized] target(s) in 4m 30s ```
Author
Owner

@matze commented on GitHub (Nov 24, 2023):

Strange, what's your rustc version?

<!-- gh-comment-id:1826039852 --> @matze commented on GitHub (Nov 24, 2023): Strange, what's your rustc version?
Author
Owner

@yonas commented on GitHub (Nov 24, 2023):

@matze rustc 1.75.0-nightly (e0d7ed1f4 2023-10-01)

<!-- gh-comment-id:1826134359 --> @yonas commented on GitHub (Nov 24, 2023): @matze `rustc 1.75.0-nightly (e0d7ed1f4 2023-10-01)`
Author
Owner

@matze commented on GitHub (Nov 24, 2023):

I cannot reproduce the issue with neither rustc 1.75.0-beta.3 (b66b7951b 2023-11-20) nor rustc 1.76.0-nightly (a1a37735c 2023-11-23). Does it happen with a newer nightly or stable for you?

<!-- gh-comment-id:1826138633 --> @matze commented on GitHub (Nov 24, 2023): I cannot reproduce the issue with neither `rustc 1.75.0-beta.3 (b66b7951b 2023-11-20)` nor `rustc 1.76.0-nightly (a1a37735c 2023-11-23)`. Does it happen with a newer nightly or stable for you?
Author
Owner

@yonas commented on GitHub (Nov 24, 2023):

@matze I don't think I can get a newer version yet. Are you on FreeBSD 14.0-RELEASE as well?

<!-- gh-comment-id:1826147399 --> @yonas commented on GitHub (Nov 24, 2023): @matze I don't think I can get a newer version yet. Are you on FreeBSD 14.0-RELEASE as well?
Author
Owner

@matze commented on GitHub (Nov 25, 2023):

Nope, I am on Linux. And it's weird, I was trying to install your version but it does not seem to exist:

$ rustup install nightly-2023-10-01
info: syncing channel updates for 'nightly-2023-10-01-x86_64-unknown-linux-gnu'
info: latest update on 2023-10-01, rust version 1.74.0-nightly (ca62d2c44 2023-09-30)
<!-- gh-comment-id:1826253528 --> @matze commented on GitHub (Nov 25, 2023): Nope, I am on Linux. And it's weird, I was trying to install your version but it does not seem to exist: ``` $ rustup install nightly-2023-10-01 info: syncing channel updates for 'nightly-2023-10-01-x86_64-unknown-linux-gnu' info: latest update on 2023-10-01, rust version 1.74.0-nightly (ca62d2c44 2023-09-30) ```
Author
Owner

@matze commented on GitHub (Nov 28, 2023):

Could you test current master? I moved to axum 0.7 and hyper 1.0, perhaps it changes anything for you.

<!-- gh-comment-id:1830284780 --> @matze commented on GitHub (Nov 28, 2023): Could you test current master? I moved to axum 0.7 and hyper 1.0, perhaps it changes anything for you.
Author
Owner

@yonas commented on GitHub (Dec 11, 2023):

@matze It works, thanks! 🎉

<!-- gh-comment-id:1849230128 --> @yonas commented on GitHub (Dec 11, 2023): @matze It works, thanks! :tada:
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/wastebin-matze#31
No description provided.