summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/borrowck-issue-48962.rs
blob: 86061c8cd6e87de991958b3f6c5b9da565a03aca (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
struct Node {
    elem: i32,
    next: Option<Box<Node>>,
}

fn a() {
    let mut node = Node {
        elem: 5,
        next: None,
    };

    let mut src = &mut node;
    {src};
    src.next = None; //~ ERROR use of moved value: `src` [E0382]
}

fn b() {
    let mut src = &mut (22, 44);
    {src};
    src.0 = 66; //~ ERROR use of moved value: `src` [E0382]
}

fn main() {
    a();
    b();
}