Skip to content

errors silenced by presence of async function with errors #111537

Open
@clubby789

Description

@clubby789

I tried this code:

pub fn bar() {
    match true {};
}

pub async fn foo() {
    match false {};
}

I expected to see this happen: Two error[E0004]: non-exhaustive patterns: type bool is non-empty

Instead, this happened: Only one is reported, in the async function. The error in the async function is still reported if the order is flipped. Making both functions sync or async correctly reports both errors. If there is any code following the faulty match, it is always reported as unreachable, despite no error being emitted for the preceding line in the sync function.

Found in #111533 test

Meta

rustc --version --verbose:

rustc 1.71.0-nightly (4a59ba4d5 2023-05-12)
binary: rustc
commit-hash: 4a59ba4d54a3ec0d8ea1e82b7eeb5c8b0162de04
commit-date: 2023-05-12
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions