Skip to content

implementation of Reply is not general enough #1130

@dhedberg

Description

@dhedberg

Version
warp v0.4.1

Platform
Linux fedora 6.15.8-200.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jul 24 13:26:52 UTC 2025 x86_64 GNU/Linux

Tested with rust 1.88.0, 1.89.0

Description

Code like this no longer compiles with v0.4.1, while it does compile with v0.3.7:

use warp::Filter;

#[tokio::main]
async fn main() {
    let task = tokio::spawn(async move {
        let hello = warp::path("test").map(|| "hello");
        let server = warp::serve(hello);
        server
            .run(([0, 0, 0, 0], 9000))
            .await;
    });

    let _ = tokio::join!(task);
}

.. giving the errors:

error: implementation of `Reply` is not general enough
  --> src/main.rs:5:16
   |
5  |       let task = tokio::spawn(async move {
   |  ________________^
6  | |         let hello = warp::path("test").map(|| "hello");
7  | |         let server = warp::serve(hello);
8  | |         server
9  | |             .run(([0, 0, 0, 0], 9000))
10 | |             .await;
11 | |     });
   | |______^ implementation of `Reply` is not general enough
   |
   = note: `&'0 str` must implement `Reply`, for any lifetime `'0`...
   = note: ...but `Reply` is actually implemented for the type `&'static str`

error: implementation of `Send` is not general enough
  --> src/main.rs:5:16
   |
5  |       let task = tokio::spawn(async move {
   |  ________________^
6  | |         let hello = warp::path("test").map(|| "hello");
7  | |         let server = warp::serve(hello);
8  | |         server
9  | |             .run(([0, 0, 0, 0], 9000))
10 | |             .await;
11 | |     });
   | |______^ implementation of `Send` is not general enough
   |
   = note: `Send` would have to be implemented for the type `&'0 str`, for any lifetime `'0`...
   = note: ...but `Send` is actually implemented for the type `&'1 str`, for some specific lifetime `'1`

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions