4 fn borrow<T>(_: &T) { }
7 fn different_vars_after_borrows() {
8 let x1: Box<_> = Box::new(1);
10 let x2: Box<_> = Box::new(2);
12 thread::spawn(move|| {
13 //~^ ERROR cannot move out of `x1` because it is borrowed
14 //~| ERROR cannot move out of `x2` because it is borrowed
22 fn different_vars_after_moves() {
23 let x1: Box<_> = Box::new(1);
25 let x2: Box<_> = Box::new(2);
27 thread::spawn(move|| {
28 //~^ ERROR use of moved value: `x1`
29 //~| ERROR use of moved value: `x2`
35 fn same_var_after_borrow() {
36 let x: Box<_> = Box::new(1);
38 thread::spawn(move|| {
39 //~^ ERROR cannot move out of `x` because it is borrowed
41 drop(x); //~ ERROR use of moved value: `x`
46 fn same_var_after_move() {
47 let x: Box<_> = Box::new(1);
49 thread::spawn(move|| {
50 //~^ ERROR use of moved value: `x`
52 drop(x); //~ ERROR use of moved value: `x`
57 different_vars_after_borrows();
58 different_vars_after_moves();
59 same_var_after_borrow();
60 same_var_after_move();