zig/test/cases/safety
Andrew Kelley 4d5e0a0434 Revert the last two commits in this branch
When the slice-by-length start position is runtime-known, it is likely
protected by a runtime-known condition and therefore a compile error is
less appropriate than a runtime panic check.

This is demonstrated in the json code that was updated and then reverted
in this commit.

When #3806 is implemented, this decision can be reassessed.

Revert "std: work around compiler unable to evaluate condition at compile time"
Revert "frontend: comptime array slice-by-length OOB detection"

This reverts commit 7741aca96c.
This reverts commit 2583b389ea.
2024-03-20 17:29:06 -07:00
..
@alignCast misaligned.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
@asyncCall with too small a frame.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
@enumFromInt - no matching tag value.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
@errorCast error not present in destination.zig Sema: add @errorCast which works for both error sets and error unions 2023-10-01 17:00:01 +03:00
@errorCast error union casted to disjoint set.zig Sema: fix issues in @errorCast with error unions 2023-10-03 00:45:48 -07:00
@intCast to u0.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
@intFromFloat cannot fit - negative out of range.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
@intFromFloat cannot fit - negative to unsigned.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
@intFromFloat cannot fit - positive out of range.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
@ptrFromInt address zero to non-optional byte-aligned pointer.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
@ptrFromInt address zero to non-optional pointer.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
@ptrFromInt with misaligned address.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
@tagName on corrupted enum value.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
@tagName on corrupted union value.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
array slice sentinel mismatch non-scalar.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
array slice sentinel mismatch vector.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
array slice sentinel mismatch.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
awaiting twice.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
bad union field access.zig all: zig fmt and rename "@XToY" to "@YFromX" 2023-06-19 12:34:42 -07:00
calling panic.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
cast []u8 to bigger slice of wrong size.zig all: zig fmt and rename "@XToY" to "@YFromX" 2023-06-19 12:34:42 -07:00
cast integer to global error and no code matches.zig all: zig fmt and rename "@XToY" to "@YFromX" 2023-06-19 12:34:42 -07:00
empty slice with sentinel out of bounds.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
error return trace across suspend points.zig all: zig fmt and rename "@XToY" to "@YFromX" 2023-06-19 12:34:42 -07:00
exact division failure - vectors.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
exact division failure.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
for_len_mismatch_three.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
for_len_mismatch.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
ignored expression integer overflow.zig Liveness: do not elide safety-checked instructions 2024-02-20 12:10:29 +00:00
integer addition overflow.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
integer division by zero - vectors.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
integer division by zero.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
integer multiplication overflow.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
integer negation overflow.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
integer subtraction overflow.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
invalid resume of async function.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
memcpy_alias.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
memcpy_len_mismatch.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
memset_array_undefined_bytes.zig update test cases for new memcpy/memset semantics 2023-04-25 11:23:41 -07:00
memset_array_undefined_large.zig update test cases for new memcpy/memset semantics 2023-04-25 11:23:41 -07:00
memset_slice_undefined_bytes.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
memset_slice_undefined_large.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
modrem by zero.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
modulus by zero.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
noreturn returned.zig add runtime safety for noreturn function returning 2023-05-16 11:33:38 +03:00
nosuspend function call, callee suspends.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
optional unwrap operator on C pointer.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
optional unwrap operator on null pointer.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
out of bounds array slice by length.zig Revert the last two commits in this branch 2024-03-20 17:29:06 -07:00
out of bounds slice access.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
pointer casting null to non-optional pointer.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
pointer casting to null function pointer.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
pointer slice sentinel mismatch.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
remainder division by zero.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
resuming a function which is awaiting a call.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
resuming a function which is awaiting a frame.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
resuming a non-suspended function which has been suspended and resumed.zig fix compilation failures found by CI 2024-03-19 16:18:18 -07:00
resuming a non-suspended function which never been suspended.zig fix compilation failures found by CI 2024-03-19 16:18:18 -07:00
shift left by huge amount.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
shift right by huge amount.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
signed integer division overflow - vectors.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
signed integer division overflow.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
signed integer not fitting in cast to unsigned integer - widening.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
signed integer not fitting in cast to unsigned integer.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
signed shift left overflow.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
signed shift right overflow.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
signed-unsigned vector cast.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
slice sentinel mismatch - floats.zig std.fmt: fix std-cases and perform round-trip check in ryu unit tests 2024-03-09 22:23:14 +13:00
slice sentinel mismatch - optional pointers.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
slice slice sentinel mismatch.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
slice start index greater than end index.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
slice with sentinel out of bounds - runtime len.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
slice with sentinel out of bounds.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
slicing null C pointer - runtime len.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
slicing null C pointer.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
switch else on corrupt enum value - one prong.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
switch else on corrupt enum value - union.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
switch else on corrupt enum value.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
switch on corrupted enum value.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
switch on corrupted union value.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
truncating vector cast.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
unreachable.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
unsigned integer not fitting in cast to signed integer - same bit count.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
unsigned shift left overflow.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
unsigned shift right overflow.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
unsigned-signed vector cast.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
unwrap error switch.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
unwrap error.zig std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
value does not fit in shortening cast - u0.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
value does not fit in shortening cast.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
vector integer addition overflow.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
vector integer multiplication overflow.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
vector integer negation overflow.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
vector integer subtraction overflow.zig test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
zero casted to error.zig all: zig fmt and rename "@XToY" to "@YFromX" 2023-06-19 12:34:42 -07:00