src/main.zig:13:19: error: expected type '[]u32', found '*const [3]u32'
needsSliceBad(&arr);
^~~~
src/main.zig:13:19: note: cast discards const qualifier
src/main.zig:6:24: note: parameter type declared here
fn needsSliceBad(nums: []u32) void {
Expected Output
This message does not inform the programmer about the true nature of the problem: That arr is a const pointer and cannot be converted into a non-const slice.
A possible message could be:
Cannot cast const array of <type> to a non-const slice. Consider making the array mutable or changing <target-var-name> to `[]const <type>`
Where target-var-name is the LHS of an assignment or a function parameter name.
Zig Version
0.13.0
Steps to Reproduce and Observed Output
Minimal reproduction:
Produces this error message:
Expected Output
This message does not inform the programmer about the true nature of the problem: That
arr
is a const pointer and cannot be converted into a non-const slice.A possible message could be:
Where
target-var-name
is the LHS of an assignment or a function parameter name.