Skip to content

Incorrect unreachable_code lint for loops in try_blocks #63324

Closed
@varkor

Description

@varkor
#![feature(try_blocks)]

pub fn foo() {
    let _: Result<(), ()> = try {
        loop {
            // anything here
        }
    };
}

Here, the entire loop expression is reported unreachable, despite not being so.
This is similar to #54165, and probably has the same underlying issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.F-try_blocks`#![feature(try_blocks)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions