]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-loan-blocks-move-cc.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / borrowck-loan-blocks-move-cc.rs
1 use std::thread;
2
3
4
5 fn borrow<F>(v: &isize, f: F) where F: FnOnce(&isize) {
6     f(v);
7 }
8
9
10
11 fn box_imm() {
12     let v: Box<_> = Box::new(3);
13     let w = &v;
14     thread::spawn(move|| {
15     //~^ ERROR cannot move out of `v` because it is borrowed
16         println!("v={}", *v);
17     });
18     w.use_ref();
19 }
20
21 fn box_imm_explicit() {
22     let v: Box<_> = Box::new(3);
23     let w = &v;
24     thread::spawn(move|| {
25     //~^ ERROR cannot move
26         println!("v={}", *v);
27     });
28     w.use_ref();
29 }
30
31 fn main() {
32 }
33
34 trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { }  }
35 impl<T> Fake for T { }