]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-closures-unique-imm.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / borrowck-closures-unique-imm.rs
1 struct Foo {
2     x: isize,
3 }
4
5 pub fn main() {
6     let mut this = &mut Foo {
7         x: 1,
8     };
9     let mut r = || {
10         let p = &this.x;
11         &mut this.x; //~ ERROR cannot borrow
12         p.use_ref();
13     };
14     r()
15 }
16
17 trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { }  }
18 impl<T> Fake for T { }