improve dangling/oob errors and make them more uniform
This commit is contained in:
parent
5b38b149dc
commit
f8ebe8d783
75 changed files with 225 additions and 182 deletions
|
@ -45,9 +45,9 @@ const_eval_copy_nonoverlapping_overlapping =
|
|||
`copy_nonoverlapping` called on overlapping ranges
|
||||
|
||||
const_eval_dangling_int_pointer =
|
||||
{$bad_pointer_message}: {$pointer} is a dangling pointer (it has no provenance)
|
||||
{$bad_pointer_message}: {const_eval_expected_inbounds_pointer}, but got {$pointer} which is a dangling pointer (it has no provenance)
|
||||
const_eval_dangling_null_pointer =
|
||||
{$bad_pointer_message}: null pointer is a dangling pointer (it has no provenance)
|
||||
{$bad_pointer_message}: {const_eval_expected_inbounds_pointer}, but got a null pointer
|
||||
|
||||
const_eval_dangling_ptr_in_final = encountered dangling pointer in final value of {const_eval_intern_kind}
|
||||
const_eval_dead_local =
|
||||
|
@ -87,6 +87,13 @@ const_eval_error = {$error_kind ->
|
|||
const_eval_exact_div_has_remainder =
|
||||
exact_div: {$a} cannot be divided by {$b} without remainder
|
||||
|
||||
const_eval_expected_inbounds_pointer =
|
||||
expected {$inbounds_size ->
|
||||
[0] a pointer to some allocation
|
||||
[1] a pointer to 1 byte of memory
|
||||
*[x] a pointer to {$inbounds_size} bytes of memory
|
||||
}
|
||||
|
||||
const_eval_extern_static =
|
||||
cannot access extern static ({$did})
|
||||
const_eval_extern_type_field = `extern type` field does not have a known offset
|
||||
|
@ -265,10 +272,16 @@ const_eval_pointer_arithmetic_overflow =
|
|||
overflowing in-bounds pointer arithmetic
|
||||
const_eval_pointer_arithmetic_test = out-of-bounds pointer arithmetic
|
||||
const_eval_pointer_out_of_bounds =
|
||||
{$bad_pointer_message}: {$alloc_id} has size {$alloc_size}, so pointer to {$ptr_size} {$ptr_size ->
|
||||
[1] byte
|
||||
*[many] bytes
|
||||
} starting at offset {$ptr_offset} is out-of-bounds
|
||||
{$bad_pointer_message}: {const_eval_expected_inbounds_pointer}, but got {$pointer} {$ptr_offset_is_neg ->
|
||||
[true] which points to before the beginning of the allocation
|
||||
*[false] {$alloc_size_minus_ptr_offset ->
|
||||
[0] which is at or beyond the end of the allocation of size {$alloc_size ->
|
||||
[1] 1 byte
|
||||
*[x] {$alloc_size} bytes
|
||||
}
|
||||
*[x] and there are only {$alloc_size_minus_ptr_offset} bytes starting at that pointer
|
||||
}
|
||||
}
|
||||
const_eval_pointer_use_after_free =
|
||||
{$bad_pointer_message}: {$alloc_id} has been freed, so this pointer is dangling
|
||||
const_eval_ptr_as_bytes_1 =
|
||||
|
@ -466,5 +479,3 @@ const_eval_write_through_immutable_pointer =
|
|||
|
||||
const_eval_write_to_read_only =
|
||||
writing to {$allocation} which is read-only
|
||||
const_eval_zst_pointer_out_of_bounds =
|
||||
{$bad_pointer_message}: {$alloc_id} has size {$alloc_size}, so pointer at offset {$ptr_offset} is out-of-bounds
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue