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

type-mismatch with async fn's + ? operator #14479

Closed
jhgg opened this issue Apr 4, 2023 · 3 comments · Fixed by #14486
Closed

type-mismatch with async fn's + ? operator #14479

jhgg opened this issue Apr 4, 2023 · 3 comments · Fixed by #14486
Assignees
Labels
A-ty type system / type inference / traits / method resolution Broken Window Bugs / technical debt to be addressed immediately C-bug Category: bug

Comments

@jhgg
Copy link
Contributor

jhgg commented Apr 4, 2023

minimal repro:

async fn foo() -> Result<(), ()> {
    Ok(())
}

async fn bar() -> Result<(), ()> {
    let x = foo().await?;
    Ok(x)
 // ^^^^^ type-mismatch: expected impl Future<Output = {unknown}>, found Result<(), {unknown}>
}

rust-analyzer version: 0.4.1460-standalone
rustc 1.66.1 (90743e729 2023-01-10)

I think this is a rather recent regression. It seems to first appear in nightly 0.4.1457 - so this is probably a broken window?

@jhgg jhgg added the C-bug Category: bug label Apr 4, 2023
@Veykril
Copy link
Member

Veykril commented Apr 4, 2023

LIkely has regressed with #14461

@Veykril Veykril added the A-ty type system / type inference / traits / method resolution label Apr 4, 2023
@HKalbasi HKalbasi self-assigned this Apr 4, 2023
@HKalbasi HKalbasi added the Broken Window Bugs / technical debt to be addressed immediately label Apr 4, 2023
@jplatte
Copy link
Contributor

jplatte commented Apr 4, 2023

I also get expected impl Future<Output = {unknown}>, found impl Future<Output = {unknown}> inside an async function for an expression that doesn't involve any futures..

Probably related.

Screenshot_2023-04-04_114815

@HKalbasi
Copy link
Member

HKalbasi commented Apr 4, 2023

Every async function with ? operator is affected.

@jhgg jhgg changed the title type-mismatch with async fn's type-mismatch with async fn's + ? operator Apr 4, 2023
@bors bors closed this as completed in a1ca52e Apr 5, 2023
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 Broken Window Bugs / technical debt to be addressed immediately C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants