mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-03 13:37:37 +00:00
21 lines
460 B
Rust
21 lines
460 B
Rust
//@ run-pass
|
|
//! Tests that the addition of guard patterns does not change the behavior of the `pat` macro
|
|
//! fragment.
|
|
#![feature(guard_patterns)]
|
|
#![allow(incomplete_features)]
|
|
|
|
macro_rules! has_guard {
|
|
($p:pat) => {
|
|
false
|
|
};
|
|
($p:pat if $e:expr) => {
|
|
true
|
|
};
|
|
}
|
|
|
|
fn main() {
|
|
assert_eq!(has_guard!(Some(_)), false);
|
|
assert_eq!(has_guard!(Some(_) if true), true);
|
|
assert_eq!(has_guard!((Some(_) if true)), false);
|
|
}
|