rust/tests/ui/unreachable-code.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
495 B
Rust
Raw Normal View History

//@ run-pass
#![allow(unused_must_use)]
#![allow(dead_code)]
#![allow(path_statements)]
#![allow(unreachable_code)]
#![allow(unused_variables)]
2023-09-18 23:18:51 +08:00
#![feature(if_let_guard)]
2023-09-18 23:18:51 +08:00
fn id(x: bool) -> bool {
x
}
fn call_id() {
let c = panic!();
id(c);
}
2023-09-18 23:18:51 +08:00
fn call_id_2() {
id(true) && id(return);
}
2023-09-18 23:18:51 +08:00
fn call_id_3() {
id(return) && id(return);
}
fn ret_guard() {
2015-01-26 05:05:03 +08:00
match 2 {
2012-08-04 10:59:04 +08:00
x if (return) => { x; }
2023-09-18 23:18:51 +08:00
x if let true = return => { x; }
2012-08-04 10:59:04 +08:00
_ => {}
}
}
pub fn main() {}