-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.
Milestone
Description
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
oneslash
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.