@@ -12,6 +12,10 @@ const_eval_already_reported =
12
12
const_eval_assume_false =
13
13
`assume` called with `false`
14
14
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
+
15
19
const_eval_bounds_check_failed =
16
20
indexing out of bounds: the len is { $len } but the index is { $index }
17
21
const_eval_call_nonzero_intrinsic =
@@ -39,9 +43,9 @@ const_eval_copy_nonoverlapping_overlapping =
39
43
`copy_nonoverlapping` called on overlapping ranges
40
44
41
45
const_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)
43
47
const_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
45
49
46
50
const_eval_dangling_ptr_in_final = encountered dangling pointer in final value of { const_eval_intern_kind }
47
51
const_eval_dead_local =
@@ -77,21 +81,6 @@ const_eval_error = {$error_kind ->
77
81
const_eval_exact_div_has_remainder =
78
82
exact_div: { $a } cannot be divided by { $b } without remainder
79
83
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
-
95
84
const_eval_extern_static =
96
85
cannot access extern static `{ $did } `
97
86
const_eval_extern_type_field = `extern type` field does not have a known offset
@@ -111,7 +100,6 @@ const_eval_frame_note_inner = inside {$where_ ->
111
100
112
101
const_eval_frame_note_last = the failure occurred here
113
102
114
- const_eval_in_bounds_test = out-of-bounds pointer use
115
103
const_eval_incompatible_calling_conventions =
116
104
calling a function with calling convention { $callee_conv } using calling convention { $caller_conv }
117
105
@@ -206,7 +194,6 @@ const_eval_long_running =
206
194
207
195
const_eval_max_num_nodes_in_const = maximum number of nodes exceeded in constant { $global_const_id }
208
196
209
- const_eval_memory_access_test = memory access failed
210
197
const_eval_memory_exhausted =
211
198
tried to allocate more memory than available to compiler
212
199
@@ -287,8 +274,6 @@ const_eval_offset_from_out_of_bounds =
287
274
`{ $name } ` called on two different pointers where the memory range between them is not in-bounds of an allocation
288
275
const_eval_offset_from_overflow =
289
276
`{ $name } ` called when first pointer is too far ahead of second
290
- const_eval_offset_from_test =
291
- out-of-bounds `offset_from` origin
292
277
const_eval_offset_from_underflow =
293
278
`{ $name } ` called when first pointer is too far before second
294
279
const_eval_offset_from_unsigned_overflow =
@@ -312,24 +297,36 @@ const_eval_partial_pointer_overwrite =
312
297
unable to overwrite parts of a pointer in memory at { $ptr }
313
298
const_eval_pointer_arithmetic_overflow =
314
299
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 ->
326
320
[ 1 ] 1 byte
327
321
*[ x ] { $alloc_size } bytes
328
322
}
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
331
329
}
332
- }
333
330
}
334
331
const_eval_pointer_use_after_free =
335
332
{ $bad_pointer_message } : { $alloc_id } has been freed, so this pointer is dangling
0 commit comments