afcb938116
This stabilises RFC 2086 (https://github.com/rust-lang/rust/issues/44495). Co-Authored-By: Sebastian Malton <sebastian@malton.name>
29 lines
582 B
Rust
29 lines
582 B
Rust
// run-pass
|
|
|
|
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
|
|
println!("irrefutable pattern");
|
|
});
|
|
bar!(a, 1, { //~ WARN irrefutable while-let
|
|
println!("irrefutable pattern");
|
|
});
|
|
}
|
|
|
|
pub fn main() {
|
|
while let a = 1 { //~ WARN irrefutable while-let
|
|
println!("irrefutable pattern");
|
|
break;
|
|
}
|
|
}
|