mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-24 14:34:23 +00:00
30 lines
522 B
Rust
30 lines
522 B
Rust
#![allow(unused_variables)]
|
|
#![allow(unused_assignments)]
|
|
#![allow(dead_code)]
|
|
#![deny(unreachable_code)]
|
|
|
|
fn foo() {
|
|
while {return} {
|
|
//~^ ERROR unreachable block in `if`
|
|
println!("Hello, world!");
|
|
}
|
|
}
|
|
|
|
fn bar() {
|
|
while {true} {
|
|
return;
|
|
}
|
|
println!("I am not dead.");
|
|
}
|
|
|
|
fn baz() {
|
|
// Here, we cite the `while` loop as dead.
|
|
while {return} {
|
|
//~^ ERROR unreachable block in `if`
|
|
println!("I am dead.");
|
|
}
|
|
println!("I am, too.");
|
|
}
|
|
|
|
fn main() { }
|