-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.F-try_blocks`#![feature(try_blocks)]``#![feature(try_blocks)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
#![feature(try_blocks)]
fn first_some() -> Option<()> {
let _: Option<_> = try { return Some(foo()?) };
let _: Option<_> = try { return Some(bar()?) };
None
}
https://play.rust-lang.org/?gist=363157c898e0d067260e711db131b256&version=nightly&edition=2018
warning: unreachable expression
--> src/main.rs:4:30
|
4 | let _: Option<_> = try { return Some(foo()?) };
| ^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(unreachable_code)] on by default
warning: unreachable expression
--> src/main.rs:5:30
|
5 | let _: Option<_> = try { return Some(bar()?) };
| ^^^^^^^^^^^^^^^^^^^
The desugar should probably just suppress this warning for the code it generates.
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.F-try_blocks`#![feature(try_blocks)]``#![feature(try_blocks)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.