]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/offset_from_ub.stderr
Rollup merge of #107004 - compiler-errors:new-solver-new-candidates-2, r=lcnr
[rust.git] / tests / ui / consts / offset_from_ub.stderr
1 error[E0080]: evaluation of constant value failed
2   --> $DIR/offset_from_ub.rs:18: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    = note: `ptr_offset_from` called on pointers into different allocations
11    |
12 note: inside `ptr::const_ptr::<impl *const u8>::offset_from`
13   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
14 note: inside `NOT_PTR`
15   --> $DIR/offset_from_ub.rs:24:14
16    |
17 LL |     unsafe { (42 as *const u8).offset_from(&5u8) as usize }
18    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19
20 error[E0080]: evaluation of constant value failed
21   --> $DIR/offset_from_ub.rs:31:14
22    |
23 LL |     unsafe { ptr_offset_from(field_ptr, base_ptr as *const u16) }
24    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ exact_div: 1_isize cannot be divided by 2_isize without remainder
25
26 error[E0080]: evaluation of constant value failed
27   --> $DIR/offset_from_ub.rs:37:14
28    |
29 LL |     unsafe { ptr_offset_from(ptr, ptr) }
30    |              ^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: null pointer is a dangling pointer (it has no provenance)
31
32 error[E0080]: evaluation of constant value failed
33   --> $DIR/offset_from_ub.rs:44:14
34    |
35 LL |     unsafe { ptr_offset_from(ptr2, ptr1) }
36    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: 0x8[noalloc] is a dangling pointer (it has no provenance)
37
38 error[E0080]: evaluation of constant value failed
39   --> $DIR/offset_from_ub.rs:53:14
40    |
41 LL |     unsafe { ptr_offset_from(end_ptr, start_ptr) }
42    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc18 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds
43
44 error[E0080]: evaluation of constant value failed
45   --> $DIR/offset_from_ub.rs:62:14
46    |
47 LL |     unsafe { ptr_offset_from(start_ptr, end_ptr) }
48    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc21 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds
49
50 error[E0080]: evaluation of constant value failed
51   --> $DIR/offset_from_ub.rs:70:14
52    |
53 LL |     unsafe { ptr_offset_from(end_ptr, end_ptr) }
54    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc24 has size 4, so pointer at offset 10 is out-of-bounds
55
56 error[E0080]: evaluation of constant value failed
57   --> $DIR/offset_from_ub.rs:79:14
58    |
59 LL |     unsafe { ptr_offset_from_unsigned(field_ptr, base_ptr) }
60    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from_unsigned` called on pointers into different allocations
61
62 error[E0080]: evaluation of constant value failed
63   --> $DIR/offset_from_ub.rs:86:14
64    |
65 LL |     unsafe { ptr_offset_from(ptr2, ptr1) }
66    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called when first pointer is too far ahead of second
67
68 error[E0080]: evaluation of constant value failed
69   --> $DIR/offset_from_ub.rs:92:14
70    |
71 LL |     unsafe { ptr_offset_from(ptr1, ptr2) }
72    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called when first pointer is too far before second
73
74 error[E0080]: evaluation of constant value failed
75   --> $DIR/offset_from_ub.rs:99:14
76    |
77 LL |     unsafe { ptr_offset_from_unsigned(p, p.add(2) ) }
78    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from_unsigned` called when first pointer has smaller offset than second: 0 < 8
79
80 error[E0080]: evaluation of constant value failed
81   --> $DIR/offset_from_ub.rs:106:14
82    |
83 LL |     unsafe { ptr_offset_from_unsigned(ptr2, ptr1) }
84    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from_unsigned` called when first pointer is too far ahead of second
85
86 error[E0080]: evaluation of constant value failed
87   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
88    |
89    = note: out-of-bounds offset_from: null pointer is a dangling pointer (it has no provenance)
90    |
91 note: inside `ptr::const_ptr::<impl *const u8>::offset_from`
92   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
93 note: inside `OFFSET_VERY_FAR1`
94   --> $DIR/offset_from_ub.rs:115:14
95    |
96 LL |     unsafe { ptr2.offset_from(ptr1) }
97    |              ^^^^^^^^^^^^^^^^^^^^^^
98
99 error[E0080]: evaluation of constant value failed
100   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
101    |
102    = note: out-of-bounds offset_from: null pointer is a dangling pointer (it has no provenance)
103    |
104 note: inside `ptr::const_ptr::<impl *const u8>::offset_from`
105   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
106 note: inside `OFFSET_VERY_FAR2`
107   --> $DIR/offset_from_ub.rs:121:14
108    |
109 LL |     unsafe { ptr1.offset_from(ptr2.wrapping_offset(1)) }
110    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
111
112 error: aborting due to 15 previous errors
113
114 For more information about this error, try `rustc --explain E0080`.