Zig Version
0.14.0-dev.2596+e6879e99e
Steps to Reproduce and Observed Behavior
export fn slice(p: [*]const u8, end: usize) void {
_ = p[0..end];
}
pub const Panic = struct {
pub const call = unreachable;
pub const sentinelMismatch = unreachable;
pub const unwrapError = unreachable;
pub const inactiveUnionField = unreachable;
pub const messages = unreachable;
pub fn outOfBounds(_: usize, _: usize) noreturn {
@compileError("outOfBounds");
}
pub fn startGreaterThanEnd(_: usize, _: usize) noreturn {
@compileError("startGreaterThanEnd");
}
};
had to make the 2 that are triggered functions otherwise analysis stopped at startGreaterThanEnd
$ zig build-obj a.zig
a.zig:12:9: error: outOfBounds
@compileError("outOfBounds");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.zig:15:9: error: startGreaterThanEnd
@compileError("startGreaterThanEnd");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if you do a slice-by-length _ = p[0..][0..end]; then only outOfBounds is referenced
Expected Behavior
no safety checks should be referenced, both of these checks are impossible to trigger
Zig Version
0.14.0-dev.2596+e6879e99e
Steps to Reproduce and Observed Behavior
had to make the 2 that are triggered functions otherwise analysis stopped at
startGreaterThanEndif you do a slice-by-length
_ = p[0..][0..end];then onlyoutOfBoundsis referencedExpected Behavior
no safety checks should be referenced, both of these checks are impossible to trigger