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

Incorrect unreachable_code lint for loops in try_blocks #63324

Closed
varkor opened this issue Aug 6, 2019 · 1 comment · Fixed by #64581
Closed

Incorrect unreachable_code lint for loops in try_blocks #63324

varkor opened this issue Aug 6, 2019 · 1 comment · Fixed by #64581
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. F-try_blocks `#![feature(try_blocks)]` requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@varkor
Copy link
Member

varkor commented Aug 6, 2019

#![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.

@varkor varkor added A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. labels Aug 6, 2019
@jonas-schievink jonas-schievink added requires-nightly This issue requires a nightly compiler in some way. F-try_blocks `#![feature(try_blocks)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 6, 2019
@jonas-schievink
Copy link
Contributor

Looks very similar to #54165

Centril added a commit to Centril/rust that referenced this issue Oct 1, 2019
…ode, r=Centril

Fix unreachable_code warnings for try{} block ok-wrapped expressions

Fixes rust-lang#54165 and fixes rust-lang#63324.
@bors bors closed this as completed in 18d0c03 Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. F-try_blocks `#![feature(try_blocks)]` requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants