fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

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