summary refs log tree commit diff
path: root/src/test/ui/consts/offset_from_ub.stderr
blob: 4c98fd72cacc3ba2ba96fa265f970a1b51bc3d0b (plain)
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
error[E0080]: evaluation of constant value failed
  --> $DIR/offset_from_ub.rs:17:27
   |
LL |     let offset = unsafe { ptr_offset_from(field_ptr, base_ptr) };
   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ptr_offset_from cannot compute offset of pointers into different allocations.

error[E0080]: evaluation of constant value failed
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
   |
LL |         unsafe { intrinsics::ptr_offset_from(self, origin) }
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |                  |
   |                  out-of-bounds offset_from: 0x2a is not a valid pointer
   |                  inside `ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
   |
  ::: $DIR/offset_from_ub.rs:23:14
   |
LL |     unsafe { (42 as *const u8).offset_from(&5u8) as usize }
   |              ----------------------------------- inside `NOT_PTR` at $DIR/offset_from_ub.rs:23:14

error[E0080]: evaluation of constant value failed
  --> $DIR/offset_from_ub.rs:30:14
   |
LL |     unsafe { ptr_offset_from(field_ptr, base_ptr as *const u16) }
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ exact_div: 1_isize cannot be divided by 2_isize without remainder

error[E0080]: evaluation of constant value failed
  --> $DIR/offset_from_ub.rs:36:14
   |
LL |     unsafe { ptr_offset_from(ptr, ptr) }
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: null pointer is not a valid pointer

error[E0080]: evaluation of constant value failed
  --> $DIR/offset_from_ub.rs:43:14
   |
LL |     unsafe { ptr_offset_from(ptr2, ptr1) }
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: 0x10 is not a valid pointer

error[E0080]: evaluation of constant value failed
  --> $DIR/offset_from_ub.rs:52:14
   |
LL |     unsafe { ptr_offset_from(end_ptr, start_ptr) }
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc20 has size 4, so pointer at offset 10 is out-of-bounds

error[E0080]: evaluation of constant value failed
  --> $DIR/offset_from_ub.rs:61:14
   |
LL |     unsafe { ptr_offset_from(start_ptr, end_ptr) }
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc23 has size 4, so pointer at offset 10 is out-of-bounds

error[E0080]: evaluation of constant value failed
  --> $DIR/offset_from_ub.rs:69:14
   |
LL |     unsafe { ptr_offset_from(end_ptr, end_ptr) }
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc26 has size 4, so pointer at offset 10 is out-of-bounds

error[E0080]: evaluation of constant value failed
  --> $DIR/offset_from_ub.rs:78:27
   |
LL |     let offset = unsafe { ptr_offset_from_unsigned(field_ptr, base_ptr) };
   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ptr_offset_from_unsigned cannot compute offset of pointers into different allocations.

error[E0080]: evaluation of constant value failed
  --> $DIR/offset_from_ub.rs:86:14
   |
LL |     unsafe { ptr_offset_from_unsigned(p, p.add(2) ) }
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ptr_offset_from_unsigned cannot compute a negative offset, but 0 < 8

error: aborting due to 10 previous errors

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