File: borrowck-errors.classic2024.stderr

package info (click to toggle)
rustc 1.88.0%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 934,128 kB
  • sloc: xml: 158,127; python: 36,062; javascript: 19,855; sh: 19,700; cpp: 18,947; ansic: 12,993; asm: 4,792; makefile: 690; lisp: 29; perl: 29; ruby: 19; sql: 11
file content (79 lines) | stat: -rw-r--r-- 2,718 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
error[E0508]: cannot move out of type `[&mut i32; 1]`, a non-copy array
  --> $DIR/borrowck-errors.rs:17:16
   |
LL |     let [&x] = &[&mut 0];
   |           -    ^^^^^^^^^ cannot move out of here
   |           |
   |           data moved here
   |           move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait
   |
help: consider borrowing the pattern binding
   |
LL |     let [&ref x] = &[&mut 0];
   |           +++

error[E0508]: cannot move out of type `[&mut i32; 1]`, a non-copy array
  --> $DIR/borrowck-errors.rs:24:16
   |
LL |     let [&x] = &mut [&mut 0];
   |           -    ^^^^^^^^^^^^^ cannot move out of here
   |           |
   |           data moved here
   |           move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait
   |
help: consider borrowing the pattern binding
   |
LL |     let [&ref x] = &mut [&mut 0];
   |           +++

error[E0507]: cannot move out of a shared reference
  --> $DIR/borrowck-errors.rs:33:29
   |
LL |     if let Some(&Some(x)) = Some(&Some(&mut 0)) {
   |                       -     ^^^^^^^^^^^^^^^^^^^
   |                       |
   |                       data moved here
   |                       move occurs because `x` has type `&mut u32`, which does not implement the `Copy` trait
   |
help: consider removing the borrow
   |
LL -     if let Some(&Some(x)) = Some(&Some(&mut 0)) {
LL +     if let Some(Some(x)) = Some(&Some(&mut 0)) {
   |

error[E0596]: cannot borrow data in a `&` reference as mutable
  --> $DIR/borrowck-errors.rs:38:10
   |
LL |     let &ref mut x = &0;
   |          ^^^^^^^^^ cannot borrow as mutable

error[E0596]: cannot borrow data in a `&` reference as mutable
  --> $DIR/borrowck-errors.rs:43:23
   |
LL |     if let &Some(Some(x)) = &Some(&mut Some(0)) {
   |                       ^ cannot borrow as mutable

error[E0596]: cannot borrow data in a `&` reference as mutable
  --> $DIR/borrowck-errors.rs:48:11
   |
LL |     let &[x] = &&mut [0];
   |           ^ cannot borrow as mutable

error[E0508]: cannot move out of type `[&mut i32; 1]`, a non-copy array
  --> $DIR/borrowck-errors.rs:52:20
   |
LL |     let [&mut x] = &mut [&mut 0];
   |               -    ^^^^^^^^^^^^^ cannot move out of here
   |               |
   |               data moved here
   |               move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait
   |
help: consider borrowing the pattern binding
   |
LL |     let [&mut ref x] = &mut [&mut 0];
   |               +++

error: aborting due to 7 previous errors

Some errors have detailed explanations: E0507, E0508, E0596.
For more information about an error, try `rustc --explain E0507`.