summaryrefslogtreecommitdiffstats
path: root/tests/ui/macros/issue-26322.rs
blob: c1dc80eb7c5919f34c9c0edf5f643e35fb87c6d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// run-pass
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]

macro_rules! columnline {
    () => (
        (column!(), line!())
    )
}

macro_rules! indirectcolumnline {
    () => (
        (||{ columnline!() })()
    )
}

fn main() {
    let closure = || {
        columnline!()
    };
    let iflet = if let Some(_) = Some(0) {
        columnline!()
    } else { (0, 0) };
    let cl = columnline!();
    assert_eq!(closure(), (9, 19));
    assert_eq!(iflet, (9, 22));
    assert_eq!(cl, (14, 24));
    let indirect = indirectcolumnline!();
    assert_eq!(indirect, (20, 28));
}