@@ -12,6 +12,10 @@ const_eval_already_reported =
1212const_eval_assume_false =
1313 `assume` called with `false`
1414
15+ const_eval_bad_pointer_arithmetic = in-bounds pointer arithmetic failed
16+ const_eval_bad_pointer_dereferenceable = pointer not dereferenceable
17+ const_eval_bad_pointer_memory_access = memory access failed
18+
1519const_eval_bounds_check_failed =
1620 indexing out of bounds: the len is { $len } but the index is { $index }
1721const_eval_call_nonzero_intrinsic =
@@ -39,9 +43,9 @@ const_eval_copy_nonoverlapping_overlapping =
3943 `copy_nonoverlapping` called on overlapping ranges
4044
4145const_eval_dangling_int_pointer =
42- { $bad_pointer_message } : { const_eval_expected_inbounds_pointer } , but got { $pointer } which is a dangling pointer (it has no provenance)
46+ { $bad_pointer_message } : got { $pointer } which is a dangling pointer (it has no provenance)
4347const_eval_dangling_null_pointer =
44- { $bad_pointer_message } : { const_eval_expected_inbounds_pointer } , but got a null pointer
48+ { $bad_pointer_message } : got a null pointer
4549
4650const_eval_dangling_ptr_in_final = encountered dangling pointer in final value of { const_eval_intern_kind }
4751const_eval_dead_local =
@@ -77,21 +81,6 @@ const_eval_error = {$error_kind ->
7781const_eval_exact_div_has_remainder =
7882 exact_div: { $a } cannot be divided by { $b } without remainder
7983
80- const_eval_expected_inbounds_pointer =
81- expected a pointer to { $inbounds_size_abs ->
82- [ 0 ] some allocation
83- *[ x ] { $inbounds_size_is_neg ->
84- [ false ] { $inbounds_size_abs ->
85- [ 1 ] 1 byte of memory
86- *[ x ] { $inbounds_size_abs } bytes of memory
87- }
88- *[ true ] the end of { $inbounds_size_abs ->
89- [ 1 ] 1 byte of memory
90- *[ x ] { $inbounds_size_abs } bytes of memory
91- }
92- }
93- }
94-
9584const_eval_extern_static =
9685 cannot access extern static `{ $did } `
9786const_eval_extern_type_field = `extern type` field does not have a known offset
@@ -111,7 +100,6 @@ const_eval_frame_note_inner = inside {$where_ ->
111100
112101const_eval_frame_note_last = the failure occurred here
113102
114- const_eval_in_bounds_test = out-of-bounds pointer use
115103const_eval_incompatible_calling_conventions =
116104 calling a function with calling convention { $callee_conv } using calling convention { $caller_conv }
117105
@@ -206,7 +194,6 @@ const_eval_long_running =
206194
207195const_eval_max_num_nodes_in_const = maximum number of nodes exceeded in constant { $global_const_id }
208196
209- const_eval_memory_access_test = memory access failed
210197const_eval_memory_exhausted =
211198 tried to allocate more memory than available to compiler
212199
@@ -287,8 +274,6 @@ const_eval_offset_from_out_of_bounds =
287274 `{ $name } ` called on two different pointers where the memory range between them is not in-bounds of an allocation
288275const_eval_offset_from_overflow =
289276 `{ $name } ` called when first pointer is too far ahead of second
290- const_eval_offset_from_test =
291- out-of-bounds `offset_from` origin
292277const_eval_offset_from_underflow =
293278 `{ $name } ` called when first pointer is too far before second
294279const_eval_offset_from_unsigned_overflow =
@@ -312,24 +297,36 @@ const_eval_partial_pointer_overwrite =
312297 unable to overwrite parts of a pointer in memory at { $ptr }
313298const_eval_pointer_arithmetic_overflow =
314299 overflowing pointer arithmetic: the total offset in bytes does not fit in an `isize`
315- const_eval_pointer_arithmetic_test = out-of-bounds pointer arithmetic
316- const_eval_pointer_out_of_bounds =
317- { $bad_pointer_message } : { const_eval_expected_inbounds_pointer } , but got { $pointer } { $ptr_offset_is_neg ->
318- [ true ] which points to before the beginning of the allocation
319- *[ false ] { $inbounds_size_is_neg ->
320- [ true ] { $ptr_offset_abs ->
321- [ 0 ] which is at the beginning of the allocation
322- *[ other ] which does not have enough space to the beginning of the allocation
323- }
324- *[ false ] { $alloc_size_minus_ptr_offset ->
325- [ 0 ] which is at or beyond the end of the allocation of size { $alloc_size ->
300+
301+ const_eval_pointer_out_of_bounds_access =
302+ { $bad_pointer_message } : attempting to access { $inbounds_size ->
303+ [ 1 ] 1 byte
304+ *[ x ] { $inbounds_size } bytes
305+ } at { $pointer } , but { const_eval_pointer_out_of_bounds_details }
306+ const_eval_pointer_out_of_bounds_arithmetic =
307+ { $bad_pointer_message } : attempting to offset pointer to { $pointer } by { $inbounds_size ->
308+ [ 1 ] 1 byte
309+ *[ x ] { $inbounds_size } bytes
310+ } , but { const_eval_pointer_out_of_bounds_details }
311+ const_eval_pointer_out_of_bounds_dereferenceable =
312+ { $bad_pointer_message } : pointer to { $pointer } must be dereferenceable for { $inbounds_size ->
313+ [ 1 ] 1 byte
314+ *[ x ] { $inbounds_size } bytes
315+ } , but { const_eval_pointer_out_of_bounds_details }
316+ const_eval_pointer_out_of_bounds_details =
317+ { $inbounds_size_is_neg ->
318+ [ false ] the pointer { $alloc_size_minus_ptr_offset ->
319+ [ 0 ] is at or beyond the end of the allocation of size { $alloc_size ->
326320 [ 1 ] 1 byte
327321 *[ x ] { $alloc_size } bytes
328322 }
329- [ 1 ] which is only 1 byte from the end of the allocation
330- *[ x ] which is only { $alloc_size_minus_ptr_offset } bytes from the end of the allocation
323+ [ 1 ] is only 1 byte from the end of the allocation
324+ *[ x ] is only { $alloc_size_minus_ptr_offset } bytes from the end of the allocation
325+ }
326+ *[ true ] the pointer { $ptr_offset_abs ->
327+ [ 0 ] is at the beginning of the allocation
328+ *[ other ] is only { $ptr_offset_abs } bytes from the beginning of the allocation
331329 }
332- }
333330 }
334331const_eval_pointer_use_after_free =
335332 { $bad_pointer_message } : { $alloc_id } has been freed, so this pointer is dangling
0 commit comments