]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-issue-48962.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / borrowck-issue-48962.rs
1 struct Node {
2     elem: i32,
3     next: Option<Box<Node>>,
4 }
5
6 fn a() {
7     let mut node = Node {
8         elem: 5,
9         next: None,
10     };
11
12     let mut src = &mut node;
13     {src};
14     src.next = None; //~ ERROR use of moved value: `src` [E0382]
15 }
16
17 fn b() {
18     let mut src = &mut (22, 44);
19     {src};
20     src.0 = 66; //~ ERROR use of moved value: `src` [E0382]
21 }
22
23 fn main() {
24     a();
25     b();
26 }