summaryrefslogtreecommitdiffstats
path: root/tests/ui/rfcs/rfc-2294-if-let-guard/partially-macro-expanded.rs
blob: d91b3a358da1cc7e2c7de86ac9a6c0c13ec6aa4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Macros can be used for (parts of) the pattern and expression in an if let guard
// check-pass

#![feature(if_let_guard)]
#![feature(let_chains)]

macro_rules! m {
    (pattern $i:ident) => { Some($i) };
    (expression $e:expr) => { $e };
}

fn main() {
    match () {
        () if let m!(pattern x) = m!(expression Some(4)) => {}
        () if let [m!(pattern y)] = [Some(8 + m!(expression 4))] => {}
        _ => {}
    }
}