File: deriving-with-repr-packed.stderr

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (60 lines) | stat: -rw-r--r-- 2,594 bytes parent folder | download | duplicates (3)
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
error[E0507]: cannot move out of `self` which is behind a shared reference
  --> $DIR/deriving-with-repr-packed.rs:22:10
   |
LL | #[derive(Debug, Default)]
   |          ----- in this derive macro expansion
LL | #[repr(packed)]
LL | struct X(Y);
   |          ^ move occurs because `self.0` has type `Y`, which does not implement the `Copy` trait
   |
note: if `Y` implemented `Clone`, you could clone the value
  --> $DIR/deriving-with-repr-packed.rs:16:1
   |
LL | struct Y(usize);
   | ^^^^^^^^ consider implementing `Clone` for this type
...
LL | struct X(Y);
   |          - you could clone this value
   = note: `#[derive(Debug)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0161]: cannot move a value of type `[u8]`
  --> $DIR/deriving-with-repr-packed.rs:29:5
   |
LL |     data: [u8],
   |     ^^^^^^^^^^ the size of `[u8]` cannot be statically determined

error[E0507]: cannot move out of `self.data` which is behind a shared reference
  --> $DIR/deriving-with-repr-packed.rs:29:5
   |
LL | #[derive(Debug)]
   |          ----- in this derive macro expansion
...
LL |     data: [u8],
   |     ^^^^^^^^^^ move occurs because `self.data` has type `[u8]`, which does not implement the `Copy` trait
   |
   = note: `#[derive(Debug)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0161]: cannot move a value of type `str`
  --> $DIR/deriving-with-repr-packed.rs:38:5
   |
LL |     data: str,
   |     ^^^^^^^^^ the size of `str` cannot be statically determined

error[E0507]: cannot move out of `self.data` which is behind a shared reference
  --> $DIR/deriving-with-repr-packed.rs:38:5
   |
LL | #[derive(Debug)]
   |          ----- in this derive macro expansion
...
LL |     data: str,
   |     ^^^^^^^^^ move occurs because `self.data` has type `str`, which does not implement the `Copy` trait
   |
   = note: `#[derive(Debug)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 5 previous errors

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