Skip to content

poem: type annotations needed #196

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

Open
lcnr opened this issue May 5, 2025 · 3 comments
Open

poem: type annotations needed #196

lcnr opened this issue May 5, 2025 · 3 comments
Assignees
Labels
from-crater A regression found via a crater run, not part of our test suite

Comments

@lcnr
Copy link
Contributor

lcnr commented May 5, 2025

[INFO] [stdout] error[E0282]: type annotations needed
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/poem-3.0.4/src/route/router_method.rs:186:33
[INFO] [stdout]     |
[INFO] [stdout] 186 | ...                   let mut resp = self.call(req).await?;
[INFO] [stdout]     |                           ^^^^^^^^
[INFO] [stdout] 187 | ...                   resp.set_body(());
[INFO] [stdout]     |                            -------- type must be known at this point
[INFO] [stdout]     |
[INFO] [stdout] help: consider giving `resp` an explicit type
[INFO] [stdout]     |
[INFO] [stdout] 186 |                             let mut resp: /* Type */ = self.call(req).await?;
[INFO] [stdout]     |                                         ++++++++++++
[INFO] [stdout] 
[INFO] [stdout] 
[INFO] [stdout] error[E0271]: type mismatch resolving `impl Future<Output = Result<<RouteMethod as Endpoint>::Output, Error>> + Send normalizes-to _`
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/poem-3.0.4/src/route/router_method.rs:186:44
[INFO] [stdout]     |
[INFO] [stdout] 186 | ...                   let mut resp = self.call(req).await?;
[INFO] [stdout]     |                                      ^^^^^^^^^^^^^^ types differ
[INFO] [stdout] 
@lcnr lcnr added the from-crater A regression found via a crater run, not part of our test suite label May 5, 2025
@lcnr
Copy link
Contributor Author

lcnr commented May 5, 2025

it encounters a debug assert

trait Trait<'a> {}
impl<'a, T: Send> Trait<'a> for T {}

fn needs_trait<T: for<'a> Trait<'a>>(_: T) {}
fn main() {
    let x = ();
    needs_trait(async { x });
}

@lcnr
Copy link
Contributor Author

lcnr commented May 5, 2025

fixing that issue, given us the actual bug here

use std::future::Future;
fn call() -> impl Future<Output = String> {
    Box::pin(async {
        let mut resp = call().await;
        resp.len();
        resp
    })
}

@lcnr
Copy link
Contributor Author

lcnr commented May 5, 2025

with iterator

fn iterator(b: bool) -> impl Iterator<Item = String> {
    if b {
        for i in iterator(false) {
            i.len();
        }
    }

    vec![].into_iter()
}

@lcnr lcnr moved this from unknown to in progress in -Znext-solver=globally May 5, 2025
@lcnr lcnr moved this from in progress to todo in -Znext-solver=globally May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
from-crater A regression found via a crater run, not part of our test suite
Projects
Development

No branches or pull requests

1 participant