summaryrefslogtreecommitdiffstats
path: root/tests/ui/issues/issue-65131.rs
blob: 8b5345da900aa20196770817950cf595bf65ed8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
fn get_pair(_a: &mut u32, _b: &mut u32) {}

macro_rules! x10 {
    ($($t:tt)*) => {
        $($t)* $($t)* $($t)* $($t)* $($t)*
        $($t)* $($t)* $($t)* $($t)* $($t)*
    }
}

#[allow(unused_assignments)]
fn main() {
    let mut x = 1;

    get_pair(&mut x, &mut x);
    //~^ ERROR: cannot borrow `x` as mutable more than once at a time

    x10! { x10!{ x10!{ if x > 0 { x += 2 } else { x += 1 } } } }
}