zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 0a2f6632810ceb6a17bffbafd846c5f3aaa24e64 (tree)
parent 6ae30662dc04d46165bb6c2481d1ee1d0cc60717
Author: Matthew Lugg <mlugg@mlugg.co.uk>
Date:   Tue, 17 Mar 2026 19:37:50 +0000

llvm: solve a misc TODO

The compiler has had the desired semantics for comptime evaluation of
these checks for quite a while now.

Diffstat:
Msrc/codegen/llvm.zig | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig @@ -10833,9 +10833,8 @@ pub const FuncGen = struct { comptime assert(@intFromEnum(std.builtin.PrefetchOptions.Rw.read) == 0); comptime assert(@intFromEnum(std.builtin.PrefetchOptions.Rw.write) == 1); - // TODO these two asserts should be able to be comptime because the type is a u2 - assert(prefetch.locality >= 0); - assert(prefetch.locality <= 3); + comptime assert(prefetch.locality >= 0); + comptime assert(prefetch.locality <= 3); comptime assert(@intFromEnum(std.builtin.PrefetchOptions.Cache.instruction) == 0); comptime assert(@intFromEnum(std.builtin.PrefetchOptions.Cache.data) == 1);