Closed
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