about summary refs log tree commit diff
path: root/tests/ui/nll/self-assign-ref-mut.rs
blob: 1ad005e1af33333039206fe11324e73495e1c264 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Check that `*y` isn't borrowed after `y = y`.

//@ check-pass

fn main() {
    let mut x = 1;
    {
        let mut y = &mut x;
        y = y;
        y;
    }
    x;
    {
        let mut y = &mut x;
        y = y;
        y = y;
        y;
    }
    x;
}