summaryrefslogtreecommitdiff
path: root/tests/src/loops-borrow-check-fail.rs
blob: 24be052c4ffbca58df5e573de29c86ae3a7c50eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//@ [!borrow-check] skip
//@ [borrow-check] known-failure

// We need to use the general rules for joining the loans
fn loop_reborrow_mut() {
    let mut x = 0;
    let mut px = &mut x;
    while *px > 0 {
        x += 1;
        px = &mut x;
    }
}

// We need to imrpove [prepare_ashared_loans]
fn iter_local_shared_borrow() {
    let mut x = 0;
    let mut p = &x;
    loop {
        p = &(*p);
    }
}