master
1comptime {
2 var array = [_:0]u8{ 1, 2, 3, 4 };
3 var src_slice: [:0]u8 = &array;
4 const slice = src_slice[2..6];
5 _ = slice;
6}
7comptime {
8 var array = [_:0]u8{ 1, 2, 3, 4 };
9 const slice = array[2..6];
10 _ = slice;
11}
12comptime {
13 var array = [_]u8{ 1, 2, 3, 4 };
14 const slice = array[2..5];
15 _ = slice;
16}
17comptime {
18 var array = [_:0]u8{ 1, 2, 3, 4 };
19 const slice = array[3..2];
20 _ = slice;
21}
22
23// error
24//
25// :4:32: error: end index 6 out of bounds for slice of length 4 +1 (sentinel)
26// :9:28: error: end index 6 out of bounds for array of length 4 +1 (sentinel)
27// :14:28: error: end index 5 out of bounds for array of length 4
28// :19:25: error: start index 3 is larger than end index 2