authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-15 01:53:41-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-15 01:53:41-07:00
log32e88251e48d9f4a412b08acbd04d5694ec91e19
tree055c75bc189091a601fa390424f0a70895f6d706
parent03ed3f56cf0df6864f8a61cfe2108a7f6692bfc6

update test case for new const/var compile error

commit 8afafa717f5c036595a3a781c63b6be7b478c025 was created when this error did not exist yet.

1 files changed, 6 insertions(+), 4 deletions(-)

test/cases/compile_errors/slice_of_single-item_pointer_bounds.zig+6-4
...@@ -19,11 +19,13 @@ comptime {...@@ -19,11 +19,13 @@ comptime {
1919
20export fn entry1() void {20export fn entry1() void {
21 var start: usize = 0;21 var start: usize = 0;
22 _ = &start;
22 _ = ptr[start..2];23 _ = ptr[start..2];
23}24}
2425
25export fn entry2() void {26export fn entry2() void {
26 var end: usize = 0;27 var end: usize = 0;
28 _ = &end;
27 _ = ptr[0..end];29 _ = ptr[0..end];
28}30}
2931
...@@ -35,7 +37,7 @@ export fn entry2() void {...@@ -35,7 +37,7 @@ export fn entry2() void {
35// :13:16: error: slice of single-item pointer must have comptime-known bounds [0..0], [0..1], or [1..1]37// :13:16: error: slice of single-item pointer must have comptime-known bounds [0..0], [0..1], or [1..1]
36// :13:16: note: expected '1', found '2'38// :13:16: note: expected '1', found '2'
37// :17:16: error: end index 2 out of bounds for slice of single-item pointer39// :17:16: error: end index 2 out of bounds for slice of single-item pointer
38// :22:13: error: unable to resolve comptime value40// :23:13: error: unable to resolve comptime value
39// :22:13: note: slice of single-item pointer must have comptime-known bounds [0..0], [0..1], or [1..1]41// :23:13: note: slice of single-item pointer must have comptime-known bounds [0..0], [0..1], or [1..1]
40// :27:16: error: unable to resolve comptime value42// :29:16: error: unable to resolve comptime value
41// :27:16: note: slice of single-item pointer must have comptime-known bounds [0..0], [0..1], or [1..1]43// :29:16: note: slice of single-item pointer must have comptime-known bounds [0..0], [0..1], or [1..1]