-
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.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.
Description
pub fn main() {
std::process::Command::new("test").output().unwrap_or(panic!("oh no"));
}
rustc warns that the entire line is an unreachable expression
warning: unreachable expression
--> src/main.rs:3:6
|
3 | std::process::Command::new("test").output().unwrap_or(panic!("oh no"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(unreachable_code)] on by default
however the code is clearly executed as can be see on the playground
Compiling playground v0.0.1 (/playground)
warning: unreachable expression
--> src/main.rs:2:6
|
2 | std::process::Command::new("test").output().unwrap_or(panic!("oh no"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(unreachable_code)] on by default
Finished dev [unoptimized + debuginfo] target(s) in 0.60s
Running `target/debug/playground`
thread 'main' panicked at 'oh no', src/main.rs:2:60
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
If the line was truly unreachable, there would be no panic...
This bug appears on stable, beta and nightly
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.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.