os-rust/src/test/ui/while-let.rs

30 lines
605 B
Rust
Raw Normal View History

// run-pass
#[allow(dead_code)]
2014-10-03 00:59:32 -04:00
fn macros() {
macro_rules! foo{
($p:pat, $e:expr, $b:block) => {{
while let $p = $e $b
}}
}
macro_rules! bar{
($p:pat, $e:expr, $b:block) => {{
foo!($p, $e, $b)
}}
}
foo!(_a, 1, { //~ WARN irrefutable while-let
2014-10-03 00:59:32 -04:00
println!("irrefutable pattern");
});
bar!(_a, 1, { //~ WARN irrefutable while-let
2014-10-03 00:59:32 -04:00
println!("irrefutable pattern");
});
}
pub fn main() {
while let _a = 1 { //~ WARN irrefutable while-let
2014-10-03 00:59:32 -04:00
println!("irrefutable pattern");
break;
2014-10-03 00:59:32 -04:00
}
}