]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-asm.mir.stderr
When using value after move, point at span of local
[rust.git] / src / test / ui / borrowck / borrowck-asm.mir.stderr
1 error[E0382]: use of moved value: `x`
2   --> $DIR/borrowck-asm.rs:27:17
3    |
4 LL |         let x = &mut 0isize;
5    |             - move occurs because `x` has type `&mut isize`, which does not implement the `Copy` trait
6 LL |         unsafe {
7 LL |             asm!("nop" : : "r"(x));
8    |                                - value moved here
9 LL |         }
10 LL |         let z = x;  //[ast]~ ERROR use of moved value: `x`
11    |                 ^ value used here after move
12
13 error[E0503]: cannot use `x` because it was mutably borrowed
14   --> $DIR/borrowck-asm.rs:35:32
15    |
16 LL |         let y = &mut x;
17    |                 ------ borrow of `x` occurs here
18 LL |         unsafe {
19 LL |             asm!("nop" : : "r"(x)); //[ast]~ ERROR cannot use
20    |                                ^ use of borrowed `x`
21 ...
22 LL |         let z = y;
23    |                 - borrow later used here
24
25 error[E0384]: cannot assign twice to immutable variable `x`
26   --> $DIR/borrowck-asm.rs:44:31
27    |
28 LL |         let x = 3;
29    |             -
30    |             |
31    |             first assignment to `x`
32    |             help: make this binding mutable: `mut x`
33 LL |         unsafe {
34 LL |             asm!("nop" : "=r"(x));  //[ast]~ ERROR cannot assign twice
35    |                               ^ cannot assign twice to immutable variable
36
37 error[E0384]: cannot assign twice to immutable variable `x`
38   --> $DIR/borrowck-asm.rs:60:31
39    |
40 LL |         let x = 3;
41    |             -
42    |             |
43    |             first assignment to `x`
44    |             help: make this binding mutable: `mut x`
45 LL |         unsafe {
46 LL |             asm!("nop" : "+r"(x));  //[ast]~ ERROR cannot assign twice
47    |                               ^ cannot assign twice to immutable variable
48
49 error[E0381]: use of possibly uninitialized variable: `x`
50   --> $DIR/borrowck-asm.rs:68:32
51    |
52 LL |             asm!("nop" : "=*r"(x)); //[ast]~ ERROR use of possibly uninitialized variable
53    |                                ^ use of possibly uninitialized `x`
54
55 error[E0506]: cannot assign to `x` because it is borrowed
56   --> $DIR/borrowck-asm.rs:77:31
57    |
58 LL |         let y = &*x;
59    |                 --- borrow of `x` occurs here
60 LL |         unsafe {
61 LL |             asm!("nop" : "+r"(x));  //[ast]~ ERROR cannot assign to `x` because it is borrowed
62    |                               ^ assignment to borrowed `x` occurs here
63 ...
64 LL |         let z = y;
65    |                 - borrow later used here
66
67 error[E0382]: use of moved value: `x`
68   --> $DIR/borrowck-asm.rs:86:40
69    |
70 LL |         let x = &mut 2;
71    |             - move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait
72 LL |         unsafe {
73 LL |             asm!("nop" : : "r"(x), "r"(x) );    //[ast]~ ERROR use of moved value
74    |                                -       ^ value used here after move
75    |                                |
76    |                                value moved here
77
78 error: aborting due to 7 previous errors
79
80 Some errors occurred: E0381, E0382, E0384, E0503, E0506.
81 For more information about an error, try `rustc --explain E0381`.