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

#13354 diagnose some incorrect usages of the question mark operator creates incorrect error #13429

Closed
DaughterOfMars opened this issue Oct 17, 2022 · 2 comments · Fixed by #13433
Labels
A-ty type system / type inference / traits / method resolution

Comments

@DaughterOfMars
Copy link

DaughterOfMars commented Oct 17, 2022

The changes made by #13354 cause the following incorrect error in this minimal example using axum:

use axum::{routing::get, Router, Server};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    Server::bind(&([0, 0, 0, 0], 8080).into())
        .serve(
            Router::new()
                .route("test", get(|| async { "hello" }))
                .into_make_service(),
        )
        .await?;

    Ok(())
}
the trait `Try` is not implemented for `_`rust-analyzer[not-implemented](https://rust-analyzer.github.io/manual.html#not-implemented)

rust-analyzer version: 0.3.1248-standalone (0531aab52 2022-10-16)

rustc version: rustc 1.66.0-nightly (a37499ae6 2022-09-18)

@Veykril
Copy link
Member

Veykril commented Oct 17, 2022

Ah dammit, the type of the {...}.await expression is <Server<AddrIncoming, IntoMakeService<Router<Body>>, Exec> as IntoFuture>::Output, that is r-a can't deduce it, so it fails to figure out that the trait is implemented for it. @flodiebold is there an easy way to check whether we fail to solve a projection so that I can skip out on emitting the diagnostic for that?

@Veykril Veykril added the A-ty type system / type inference / traits / method resolution label Oct 17, 2022
@flodiebold
Copy link
Member

Hmm yeah this is the general "preventing follow-up errors" problem. I don't think you can really tell from the type that there was a problem, since these placeholders can also occur legitimately, but looking for placeholders and error types might be the best approach for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ty type system / type inference / traits / method resolution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants