File: raw-pointer-ub.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 (38 lines) | stat: -rw-r--r-- 1,497 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
error[E0080]: evaluation of constant value failed
  --> $DIR/raw-pointer-ub.rs:4:16
   |
LL |     let _val = *ptr;
   |                ^^^^ accessing memory based on pointer with alignment 1, but alignment 4 is required

error[E0080]: evaluation of constant value failed
  --> $DIR/raw-pointer-ub.rs:11:5
   |
LL |     *ptr = 0;
   |     ^^^^^^^^ accessing memory based on pointer with alignment 1, but alignment 4 is required

error[E0080]: evaluation of constant value failed
  --> $DIR/raw-pointer-ub.rs:19:5
   |
LL |     y.copy_to_nonoverlapping(&mut z, 1);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ accessing memory with alignment 1, but alignment 4 is required
   |
note: inside `std::ptr::const_ptr::<impl *const u32>::copy_to_nonoverlapping`
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
note: inside `copy_nonoverlapping::<u32>`
  --> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL

error[E0080]: evaluation of constant value failed
  --> $DIR/raw-pointer-ub.rs:34:16
   |
LL |     let _val = (*ptr).0;
   |                ^^^^^^^^ accessing memory based on pointer with alignment 4, but alignment 16 is required

error[E0080]: evaluation of constant value failed
  --> $DIR/raw-pointer-ub.rs:41:16
   |
LL |     let _val = *ptr;
   |                ^^^^ memory access failed: attempting to access 8 bytes, but got ALLOC0 which is only 4 bytes from the end of the allocation

error: aborting due to 5 previous errors

For more information about this error, try `rustc --explain E0080`.