fork/rust

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

borsAuto merge of #71868 - Mark-Simulacrum:stable-1.43.1, r=pietroalbini8d69840ab92

1.43.1
1.4 KiB39 linesraw
1error[E0382]: use of moved value: `x`
2  --> $DIR/closure-move-spans.rs:5:13
3   |
4LL | fn move_after_move(x: String) {
5   |                    - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
6LL |     || x;
7   |     -- - variable moved due to use in closure
8   |     |
9   |     value moved into closure here
10LL |     let y = x;
11   |             ^ value used here after move
12
13error[E0382]: borrow of moved value: `x`
14  --> $DIR/closure-move-spans.rs:10:13
15   |
16LL | fn borrow_after_move(x: String) {
17   |                      - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
18LL |     || x;
19   |     -- - variable moved due to use in closure
20   |     |
21   |     value moved into closure here
22LL |     let y = &x;
23   |             ^^ value borrowed here after move
24
25error[E0382]: borrow of moved value: `x`
26  --> $DIR/closure-move-spans.rs:15:13
27   |
28LL | fn borrow_mut_after_move(mut x: String) {
29   |                          ----- move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
30LL |     || x;
31   |     -- - variable moved due to use in closure
32   |     |
33   |     value moved into closure here
34LL |     let y = &mut x;
35   |             ^^^^^^ value borrowed here after move
36
37error: aborting due to 3 previous errors
38
39For more information about this error, try `rustc --explain E0382`.