2019-01-12 03:10:59 +00:00
|
|
|
// run-pass
|
|
|
|
|
2019-09-01 21:30:19 +00:00
|
|
|
#[allow(dead_code)]
|
2014-10-03 04:59:32 +00:00
|
|
|
fn macros() {
|
|
|
|
macro_rules! foo{
|
|
|
|
($p:pat, $e:expr, $b:block) => {{
|
|
|
|
while let $p = $e $b
|
2021-02-17 10:26:38 +00:00
|
|
|
//~^ WARN irrefutable `while let`
|
|
|
|
//~| WARN irrefutable `while let`
|
2014-10-03 04:59:32 +00:00
|
|
|
}}
|
|
|
|
}
|
|
|
|
macro_rules! bar{
|
|
|
|
($p:pat, $e:expr, $b:block) => {{
|
|
|
|
foo!($p, $e, $b)
|
|
|
|
}}
|
|
|
|
}
|
|
|
|
|
2019-10-24 00:00:00 +00:00
|
|
|
foo!(_a, 1, {
|
2014-10-03 04:59:32 +00:00
|
|
|
println!("irrefutable pattern");
|
|
|
|
});
|
2019-10-24 00:00:00 +00:00
|
|
|
bar!(_a, 1, {
|
2014-10-03 04:59:32 +00:00
|
|
|
println!("irrefutable pattern");
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn main() {
|
2021-02-17 10:26:38 +00:00
|
|
|
while let _a = 1 { //~ WARN irrefutable `while let`
|
2014-10-03 04:59:32 +00:00
|
|
|
println!("irrefutable pattern");
|
2019-01-12 03:10:59 +00:00
|
|
|
break;
|
2014-10-03 04:59:32 +00:00
|
|
|
}
|
|
|
|
}
|