]> git.proxmox.com Git - rustc.git/blob - src/test/ui/consts/offset_from_ub.stderr
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / consts / offset_from_ub.stderr
1 error[E0080]: evaluation of constant value failed
2 --> $DIR/offset_from_ub.rs:17:27
3 |
4 LL | let offset = unsafe { ptr_offset_from(field_ptr, base_ptr) };
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ptr_offset_from called on pointers into different allocations
6
7 error[E0080]: evaluation of constant value failed
8 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
9 |
10 LL | unsafe { intrinsics::ptr_offset_from(self, origin) }
11 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12 | |
13 | ptr_offset_from called on pointers into different allocations
14 | inside `ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
15 |
16 ::: $DIR/offset_from_ub.rs:23:14
17 |
18 LL | unsafe { (42 as *const u8).offset_from(&5u8) as usize }
19 | ----------------------------------- inside `NOT_PTR` at $DIR/offset_from_ub.rs:23:14
20
21 error[E0080]: evaluation of constant value failed
22 --> $DIR/offset_from_ub.rs:30:14
23 |
24 LL | unsafe { ptr_offset_from(field_ptr, base_ptr as *const u16) }
25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ exact_div: 1_isize cannot be divided by 2_isize without remainder
26
27 error[E0080]: evaluation of constant value failed
28 --> $DIR/offset_from_ub.rs:36:14
29 |
30 LL | unsafe { ptr_offset_from(ptr, ptr) }
31 | ^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: null pointer is not a valid pointer
32
33 error[E0080]: evaluation of constant value failed
34 --> $DIR/offset_from_ub.rs:43:14
35 |
36 LL | unsafe { ptr_offset_from(ptr2, ptr1) }
37 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: 0x8 is not a valid pointer
38
39 error[E0080]: evaluation of constant value failed
40 --> $DIR/offset_from_ub.rs:52:14
41 |
42 LL | unsafe { ptr_offset_from(end_ptr, start_ptr) }
43 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc20 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds
44
45 error[E0080]: evaluation of constant value failed
46 --> $DIR/offset_from_ub.rs:61:14
47 |
48 LL | unsafe { ptr_offset_from(start_ptr, end_ptr) }
49 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc23 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds
50
51 error[E0080]: evaluation of constant value failed
52 --> $DIR/offset_from_ub.rs:69:14
53 |
54 LL | unsafe { ptr_offset_from(end_ptr, end_ptr) }
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc26 has size 4, so pointer at offset 10 is out-of-bounds
56
57 error[E0080]: evaluation of constant value failed
58 --> $DIR/offset_from_ub.rs:78:27
59 |
60 LL | let offset = unsafe { ptr_offset_from_unsigned(field_ptr, base_ptr) };
61 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ptr_offset_from_unsigned called on pointers into different allocations
62
63 error[E0080]: evaluation of constant value failed
64 --> $DIR/offset_from_ub.rs:86:14
65 |
66 LL | unsafe { ptr_offset_from_unsigned(p, p.add(2) ) }
67 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ptr_offset_from_unsigned called when first pointer has smaller offset than second: 0 < 8
68
69 error: aborting due to 10 previous errors
70
71 For more information about this error, try `rustc --explain E0080`.