mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-11 08:05:12 +00:00
37 lines
613 B
Rust
37 lines
613 B
Rust
#![allow(unused_variables)]
|
|
#![allow(unused_assignments)]
|
|
#![allow(dead_code)]
|
|
#![deny(unreachable_code)]
|
|
|
|
fn a() {
|
|
loop { return; }
|
|
println!("I am dead.");
|
|
//~^ ERROR unreachable statement
|
|
}
|
|
|
|
fn b() {
|
|
loop {
|
|
break;
|
|
}
|
|
println!("I am not dead.");
|
|
}
|
|
|
|
fn c() {
|
|
loop { return; }
|
|
println!("I am dead.");
|
|
//~^ ERROR unreachable statement
|
|
}
|
|
|
|
fn d() {
|
|
'outer: loop { loop { break 'outer; } }
|
|
println!("I am not dead.");
|
|
}
|
|
|
|
fn e() {
|
|
loop { 'middle: loop { loop { break 'middle; } } }
|
|
println!("I am dead.");
|
|
//~^ ERROR unreachable statement
|
|
}
|
|
|
|
fn main() { }
|