-
Notifications
You must be signed in to change notification settings - Fork 13.3k
false positive "unreachable expression" #64103
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
Comments
The |
Hmm, so the span is wrong?
|
the order of execution is panic! and then everything else, so in some sense everything but the panic is unreachable. I'm not sure what a good span for that would be. |
The method receiver is evaluated first, so the |
Ah, hm, I didn't expect that to be the case, but it makes sense. Then this seems relatively straightforward as to what the expected output is at least. |
I feel like this should also add a note that the panic is called before everything else. It could also suggest |
Similar case: pub fn main() {
loop {
std::process::Command::new("test").output().unwrap_or(continue);
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// warning: unreachable expression
println!("done");
}
} Maybe we can simply add a note that If this is acceptable, I would like to pick it up! As long as it's fine for me to progress more slowly than normal 😝 |
GitHub wasn't clever enough to read that the PR said "might close" instead of "close." The PR seems to imply more work can be done on this. |
rustc warns that the entire line is an unreachable expression
however the code is clearly executed as can be see on the playground
If the line was truly unreachable, there would be no panic...
This bug appears on stable, beta and nightly
The text was updated successfully, but these errors were encountered: