summaryrefslogtreecommitdiffstats
path: root/tests/ui/nll/self-assign-ref-mut.rs
blob: 1ca4cf3a775ca728a63cc03aaa13e45a6bb6698b (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;
}