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 false positive when early return from match #11814

Closed
jhgg opened this issue Mar 25, 2022 · 0 comments · Fixed by #11844
Closed

type-mismatch false positive when early return from match #11814

jhgg opened this issue Mar 25, 2022 · 0 comments · Fixed by #11844
Labels
A-ty type system / type inference / traits / method resolution C-bug Category: bug S-actionable Someone could pick this issue up and work on it right now

Comments

@jhgg
Copy link
Contributor

jhgg commented Mar 25, 2022

consider the following code:

fn example() -> bool {
    match 1 {
        _ => return true,
    };
}

This shows the error diagnostic expected bool, found () (rust-analyzer)[type-mismatch]

@lnicola lnicola added A-ty type system / type inference / traits / method resolution S-actionable Someone could pick this issue up and work on it right now C-bug Category: bug labels Mar 25, 2022
bors bot added a commit that referenced this issue Mar 29, 2022
11844: Fix divergence detection for bare match arms r=flodiebold a=flodiebold

Fixes #11814 and #11837.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
@bors bors bot closed this as completed in ea1d0bc Mar 29, 2022
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 C-bug Category: bug S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants