ziglang/zig
260
5.9k
Fork
You've already forked zig
765

compiler: add @backingInt and @fromBackingInt #35966

Open
justusk wants to merge 13 commits from justusk/backing-int into master AGit
pull from: justusk/backing-int
merge into: ziglang:master
ziglang:master
ziglang:elfv2
ziglang:spork8
ziglang:restricted
ziglang:0.16.x
ziglang:panic-rewrite
ziglang:parking-futex-lockfree
ziglang:windows-Io-cleanup
ziglang:Io-watch
ziglang:ParseCommandLineOptions
ziglang:windows-async-files
ziglang:poll-ring
ziglang:debug-file-leaks-differently
ziglang:debug-file-leaks
ziglang:ProcessPrng
ziglang:elfv2-dyn
ziglang:jobserver
ziglang:threadtheft
ziglang:io-threaded-no-queue
ziglang:0.15.x
ziglang:Io.net
ziglang:comptime-allocator
ziglang:restricted-function-pointers
ziglang:cli
ziglang:wasm-linker-writer
ziglang:wrangle-writer-buffering
ziglang:sha1-stream
ziglang:async-await-demo
ziglang:fixes
ziglang:0.14.x
ziglang:ast-node-methods
ziglang:macos-debug-info
ziglang:make-vs-configure
ziglang:fuzz-macos
ziglang:sans-aro
ziglang:ArrayList-reserve
ziglang:incr-bug
ziglang:llvm-ir-nosanitize-metadata
ziglang:ci-tarballs
ziglang:ci-scripts
ziglang:threadpool
ziglang:0.12.x
ziglang:new-pkg-hash
ziglang:json-diagnostics
ziglang:more-doctests
ziglang:rework-comptime-mutation
ziglang:0.11.x
ziglang:ci-perf-comment
ziglang:stage2-async
ziglang:0.10.x
ziglang:autofix
ziglang:0.9.x
ziglang:aro
ziglang:hcs
ziglang:0.8.x
ziglang:0.7.x
Member
Copy link

Resolves #35602
Resolves https://github.com/ziglang/zig/issues/19855

This PR implements the @backingInt and @fromBackingInt builtins.
These builtins are meant to replace the now-deprecated @intFromEnum and @enumFromInt builtins.

@backingInt works with enums and bitpacks with explicit backing integer types only. It also works with tagged unions if the enum tag type has an explicitly specified backing integer, returning the backing integer of the active tag value. An undefined enum or bitpack yields an undefined backing integer. The builtin is lowered to bit_cast.

@fromBackingInt infers its result type, which may be an enum or a bitpack with an explicit backing integer type. It takes a parameter of exactly that backing integer type. For enums, passing a backing integer that is either undefined or would yield an invalid tag value results in safety-checked Illegal Behavior. For bitpacks, passing an undefined backing integer yields an undefined bitpack.
The builtin is lowered to bit_cast or bit_cast_safe (more details below).

@bitCast now also performs a safety check for invalid tag values if its destination type is an enum.

This commit also introduces a new AIR instruction, bit_cast_safe. Similarly to int_cast_safe, it includes a safety check for invalid enum tag values. When @enumFromInt is eventually removed, int_cast_safe won't need to perform this safety check anymore.

Also adds a std.meta.BackingInt() function to conveniently get the result type of @backingInt and for use in the langref.

Empty enums now also require noreturn as their backing int.
Empty enums are uninstantiable, so their backing integer should be too. This avoids a bunch of weird special cases during semantic analysis.

If you were previously using enum {}, your code should continue to work fine.
If you were previously using enum(uN) {} (where uN is any integer type), you'll probably want to use enum(uN) { _ } instead.


EDIT: For now, the new builtints continue to work with enums with inferred backing integers. This allows replacing the old builtins with the new ones without changing semantics.

Also adds a zig fmt canonicalization for @intFromEnum(x) -> @backingInt(x) and @enumFromInt(x) -> @fromBackingInt(@intCast(x)).

Resolves #35602 Resolves https://github.com/ziglang/zig/issues/19855 This PR implements the `@backingInt` and `@fromBackingInt` builtins. These builtins are meant to replace the now-deprecated `@intFromEnum` and `@enumFromInt` builtins. `@backingInt` works with enums and bitpacks with *explicit* backing integer types only. It also works with tagged unions if the enum tag type has an explicitly specified backing integer, returning the backing integer of the active tag value. An `undefined` enum or bitpack yields an `undefined` backing integer. The builtin is lowered to `bit_cast`. `@fromBackingInt` infers its result type, which may be an enum or a bitpack with an *explicit* backing integer type. It takes a parameter of exactly that backing integer type. For enums, passing a backing integer that is either `undefined` or would yield an invalid tag value results in safety-checked Illegal Behavior. For bitpacks, passing an `undefined` backing integer yields an `undefined` bitpack. The builtin is lowered to `bit_cast` or `bit_cast_safe` (more details below). `@bitCast` now also performs a safety check for invalid tag values if its destination type is an `enum`. This commit also introduces a new AIR instruction, `bit_cast_safe`. Similarly to `int_cast_safe`, it includes a safety check for invalid enum tag values. When `@enumFromInt` is eventually removed, `int_cast_safe` won't need to perform this safety check anymore. Also adds a `std.meta.BackingInt()` function to conveniently get the result type of `@backingInt` and for use in the langref. Empty enums now also require `noreturn` as their backing int. Empty enums are uninstantiable, so their backing integer should be too. This avoids a bunch of weird special cases during semantic analysis. If you were previously using `enum {}`, your code should continue to work fine. If you were previously using `enum(uN) {}` (where `uN` is any integer type), you'll probably want to use `enum(uN) { _ }` instead. --- EDIT: For now, the new builtints continue to work with enums with inferred backing integers. This allows replacing the old builtins with the new ones without changing semantics. Also adds a `zig fmt` canonicalization for `@intFromEnum(x)` -> `@backingInt(x)` and `@enumFromInt(x)` -> `@fromBackingInt(@intCast(x))`.
justusk force-pushed justusk/backing-int from a9be60016a
Some checks failed
ci / aarch64-netbsd-debug (pull_request) Has been skipped
ci / aarch64-netbsd-release (pull_request) Has been skipped
ci / aarch64-freebsd-debug (pull_request) Has been skipped
ci / aarch64-freebsd-release (pull_request) Has been skipped
ci / x86_64-linux-debug (pull_request) Failing after 1h12m29s
ci / aarch64-macos-release (pull_request) Successful in 1h18m8s
ci / x86_64-netbsd-debug (pull_request) Successful in 1h13m21s
ci / x86_64-netbsd-release (pull_request) Successful in 1h15m12s
ci / aarch64-linux-release (pull_request) Successful in 1h54m48s
ci / x86_64-freebsd-debug (pull_request) Successful in 1h21m51s
ci / x86_64-openbsd-release (pull_request) Successful in 1h13m52s
ci / aarch64-macos-debug (pull_request) Successful in 2h8m57s
ci / x86_64-freebsd-release (pull_request) Successful in 1h21m47s
ci / x86_64-openbsd-debug (pull_request) Successful in 1h28m53s
ci / s390x-linux-release (pull_request) Successful in 1h27m3s
ci / powerpc64le-linux-release (pull_request) Successful in 2h31m11s
ci / x86_64-windows-release (pull_request) Successful in 1h26m45s
ci / x86_64-windows-debug (pull_request) Successful in 1h43m15s
ci / aarch64-linux-debug (pull_request) Successful in 2h39m21s
ci / s390x-linux-debug (pull_request) Successful in 2h49m48s
ci / loongarch64-linux-debug (pull_request) Has been cancelled
ci / loongarch64-linux-release (pull_request) Has been cancelled
ci / riscv64-linux-debug (pull_request) Has been cancelled
ci / riscv64-linux-release (pull_request) Has been cancelled
ci / x86_64-linux-release (pull_request) Has been cancelled
ci / x86_64-linux-debug-llvm (pull_request) Has been cancelled
ci / powerpc64le-linux-debug (pull_request) Has been cancelled
to 2c8347ea62
Some checks failed
ci / aarch64-freebsd-debug (pull_request) Has been skipped
ci / aarch64-freebsd-release (pull_request) Has been skipped
ci / aarch64-netbsd-debug (pull_request) Has been cancelled
ci / aarch64-netbsd-release (pull_request) Has been cancelled
ci / loongarch64-linux-debug (pull_request) Has been cancelled
ci / loongarch64-linux-release (pull_request) Has been cancelled
ci / riscv64-linux-debug (pull_request) Has been cancelled
ci / riscv64-linux-release (pull_request) Has been cancelled
ci / s390x-linux-release (pull_request) Has been cancelled
ci / x86_64-linux-debug (pull_request) Has been cancelled
ci / x86_64-linux-debug-llvm (pull_request) Has been cancelled
ci / x86_64-linux-release (pull_request) Has been cancelled
ci / x86_64-windows-debug (pull_request) Has been cancelled
ci / x86_64-windows-release (pull_request) Has been cancelled
ci / x86_64-openbsd-debug (pull_request) Has been cancelled
ci / aarch64-linux-release (pull_request) Has been cancelled
ci / x86_64-openbsd-release (pull_request) Has been cancelled
ci / x86_64-netbsd-debug (pull_request) Has been cancelled
ci / x86_64-freebsd-debug (pull_request) Has been cancelled
ci / aarch64-linux-debug (pull_request) Has been cancelled
ci / s390x-linux-debug (pull_request) Has been cancelled
ci / x86_64-freebsd-release (pull_request) Has been cancelled
ci / x86_64-netbsd-release (pull_request) Has been cancelled
ci / aarch64-macos-release (pull_request) Has been cancelled
ci / aarch64-macos-debug (pull_request) Has been cancelled
ci / powerpc64le-linux-debug (pull_request) Has been cancelled
ci / powerpc64le-linux-release (pull_request) Has been cancelled
2026年06月28日 22:43:01 +02:00
Compare
justusk force-pushed justusk/backing-int from 2c8347ea62
Some checks failed
ci / aarch64-freebsd-debug (pull_request) Has been skipped
ci / aarch64-freebsd-release (pull_request) Has been skipped
ci / aarch64-netbsd-debug (pull_request) Has been cancelled
ci / aarch64-netbsd-release (pull_request) Has been cancelled
ci / loongarch64-linux-debug (pull_request) Has been cancelled
ci / loongarch64-linux-release (pull_request) Has been cancelled
ci / riscv64-linux-debug (pull_request) Has been cancelled
ci / riscv64-linux-release (pull_request) Has been cancelled
ci / s390x-linux-release (pull_request) Has been cancelled
ci / x86_64-linux-debug (pull_request) Has been cancelled
ci / x86_64-linux-debug-llvm (pull_request) Has been cancelled
ci / x86_64-linux-release (pull_request) Has been cancelled
ci / x86_64-windows-debug (pull_request) Has been cancelled
ci / x86_64-windows-release (pull_request) Has been cancelled
ci / x86_64-openbsd-debug (pull_request) Has been cancelled
ci / aarch64-linux-release (pull_request) Has been cancelled
ci / x86_64-openbsd-release (pull_request) Has been cancelled
ci / x86_64-netbsd-debug (pull_request) Has been cancelled
ci / x86_64-freebsd-debug (pull_request) Has been cancelled
ci / aarch64-linux-debug (pull_request) Has been cancelled
ci / s390x-linux-debug (pull_request) Has been cancelled
ci / x86_64-freebsd-release (pull_request) Has been cancelled
ci / x86_64-netbsd-release (pull_request) Has been cancelled
ci / aarch64-macos-release (pull_request) Has been cancelled
ci / aarch64-macos-debug (pull_request) Has been cancelled
ci / powerpc64le-linux-debug (pull_request) Has been cancelled
ci / powerpc64le-linux-release (pull_request) Has been cancelled
to c6aa77d6ea
Some checks failed
ci / aarch64-freebsd-debug (pull_request) Has been skipped
ci / aarch64-freebsd-release (pull_request) Has been skipped
ci / aarch64-netbsd-debug (pull_request) Has been skipped
ci / aarch64-netbsd-release (pull_request) Has been skipped
ci / aarch64-macos-release (pull_request) Successful in 48m59s
ci / x86_64-netbsd-release (pull_request) Successful in 52m53s
ci / x86_64-linux-release (pull_request) Failing after 17m54s
ci / x86_64-netbsd-debug (pull_request) Successful in 59m15s
ci / x86_64-freebsd-release (pull_request) Successful in 1h2m58s
ci / x86_64-openbsd-release (pull_request) Successful in 1h5m6s
ci / x86_64-freebsd-debug (pull_request) Successful in 1h28m35s
ci / x86_64-openbsd-debug (pull_request) Successful in 1h34m31s
ci / aarch64-linux-release (pull_request) Successful in 1h37m50s
ci / s390x-linux-release (pull_request) Successful in 1h29m19s
ci / x86_64-windows-release (pull_request) Successful in 1h18m35s
ci / x86_64-linux-debug (pull_request) Failing after 1h18m16s
ci / x86_64-windows-debug (pull_request) Successful in 1h29m38s
ci / powerpc64le-linux-release (pull_request) Successful in 2h29m30s
ci / aarch64-linux-debug (pull_request) Successful in 2h42m18s
ci / aarch64-macos-debug (pull_request) Successful in 2h45m10s
ci / s390x-linux-debug (pull_request) Successful in 2h57m15s
ci / powerpc64le-linux-debug (pull_request) Successful in 3h58m17s
ci / x86_64-linux-debug-llvm (pull_request) Failing after 5h15m45s
ci / loongarch64-linux-release (pull_request) Successful in 2h22m12s
ci / loongarch64-linux-debug (pull_request) Successful in 4h5m25s
ci / riscv64-linux-debug (pull_request) Has been cancelled
ci / riscv64-linux-release (pull_request) Has been cancelled
2026年06月28日 22:53:14 +02:00
Compare
justusk force-pushed justusk/backing-int from c6aa77d6ea
Some checks failed
ci / aarch64-freebsd-debug (pull_request) Has been skipped
ci / aarch64-freebsd-release (pull_request) Has been skipped
ci / aarch64-netbsd-debug (pull_request) Has been skipped
ci / aarch64-netbsd-release (pull_request) Has been skipped
ci / aarch64-macos-release (pull_request) Successful in 48m59s
ci / x86_64-netbsd-release (pull_request) Successful in 52m53s
ci / x86_64-linux-release (pull_request) Failing after 17m54s
ci / x86_64-netbsd-debug (pull_request) Successful in 59m15s
ci / x86_64-freebsd-release (pull_request) Successful in 1h2m58s
ci / x86_64-openbsd-release (pull_request) Successful in 1h5m6s
ci / x86_64-freebsd-debug (pull_request) Successful in 1h28m35s
ci / x86_64-openbsd-debug (pull_request) Successful in 1h34m31s
ci / aarch64-linux-release (pull_request) Successful in 1h37m50s
ci / s390x-linux-release (pull_request) Successful in 1h29m19s
ci / x86_64-windows-release (pull_request) Successful in 1h18m35s
ci / x86_64-linux-debug (pull_request) Failing after 1h18m16s
ci / x86_64-windows-debug (pull_request) Successful in 1h29m38s
ci / powerpc64le-linux-release (pull_request) Successful in 2h29m30s
ci / aarch64-linux-debug (pull_request) Successful in 2h42m18s
ci / aarch64-macos-debug (pull_request) Successful in 2h45m10s
ci / s390x-linux-debug (pull_request) Successful in 2h57m15s
ci / powerpc64le-linux-debug (pull_request) Successful in 3h58m17s
ci / x86_64-linux-debug-llvm (pull_request) Failing after 5h15m45s
ci / loongarch64-linux-release (pull_request) Successful in 2h22m12s
ci / loongarch64-linux-debug (pull_request) Successful in 4h5m25s
ci / riscv64-linux-debug (pull_request) Has been cancelled
ci / riscv64-linux-release (pull_request) Has been cancelled
to 01a7bb8d00
Some checks failed
ci / aarch64-netbsd-debug (pull_request) Has been skipped
ci / aarch64-freebsd-debug (pull_request) Has been skipped
ci / aarch64-netbsd-release (pull_request) Has been skipped
ci / aarch64-freebsd-release (pull_request) Has been skipped
ci / x86_64-netbsd-debug (pull_request) Successful in 58m10s
ci / x86_64-netbsd-release (pull_request) Successful in 50m9s
ci / aarch64-linux-release (pull_request) Successful in 1h43m59s
ci / x86_64-freebsd-debug (pull_request) Successful in 1h11m52s
ci / x86_64-freebsd-release (pull_request) Successful in 55m15s
ci / x86_64-linux-release (pull_request) Failing after 20m7s
ci / x86_64-openbsd-release (pull_request) Successful in 59m27s
ci / x86_64-openbsd-debug (pull_request) Successful in 1h11m52s
ci / powerpc64le-linux-release (pull_request) Successful in 2h2m14s
ci / x86_64-windows-release (pull_request) Successful in 1h7m29s
ci / x86_64-windows-debug (pull_request) Successful in 1h22m33s
ci / x86_64-linux-debug (pull_request) Failing after 1h23m16s
ci / aarch64-macos-release (pull_request) Successful in 2h22m48s
ci / aarch64-macos-debug (pull_request) Successful in 2h38m34s
ci / aarch64-linux-debug (pull_request) Successful in 2h58m30s
ci / loongarch64-linux-debug (pull_request) Has been cancelled
ci / loongarch64-linux-release (pull_request) Has been cancelled
ci / riscv64-linux-debug (pull_request) Has been cancelled
ci / riscv64-linux-release (pull_request) Has been cancelled
ci / s390x-linux-release (pull_request) Has been cancelled
ci / powerpc64le-linux-debug (pull_request) Has been cancelled
ci / x86_64-linux-debug-llvm (pull_request) Has been cancelled
ci / s390x-linux-debug (pull_request) Has been cancelled
2026年06月29日 16:40:57 +02:00
Compare
mlugg left a comment
Copy link

I haven't done a full review yet, but here are a few comments from the first half-ish:

I haven't done a full review yet, but here are a few comments from the first half-ish:
@ -9189,0 +9189,4 @@
.enum_from_int=>returntypeCast(gz,scope,ri,node,params[0],.enum_from_int,builtin_name),
.float_cast=>returntypeCast(gz,scope,ri,node,params[0],.float_cast,builtin_name),
.int_cast=>returntypeCast(gz,scope,ri,node,params[0],.int_cast,builtin_name),
.truncate=>returntypeCast(gz,scope,ri,node,params[0],.truncate,builtin_name),
Owner
Copy link

I think this indentation change was accidental? (Not a big deal though, fine to leave it if you want)

I think this indentation change was accidental? (Not a big deal though, fine to leave it if you want)
justusk marked this conversation as resolved
@ -283,0 +284,4 @@
/// on top, validates it for usage with `@fromBackingInt` and returns
/// its backing integer type.
///
/// `!?enum(u32) { _ }` -> `u32`
Owner
Copy link

super-nitpickey, but !Foo isn't a real type (and in fact is a syntactically valid expression which would fail to type check), so prefer writing E!Foo instead for clarity. i.e.

-/// `!?enum(u32) { _ }` -> `u32`
+/// `E!?enum(u32) { _ }` -> `u32`
super-nitpickey, but `!Foo` isn't a real type (and in fact is a syntactically valid expression which would fail to type check), so prefer writing `E!Foo` instead for clarity. i.e. ```diff -/// `!?enum(u32) { _ }` -> `u32` +/// `E!?enum(u32) { _ }` -> `u32` ```
justusk marked this conversation as resolved
@ -279,2 +279,3 @@
not,
/// Implements `@bitCast`.
/// Reinterpret the bits of a value as a different type. This is like `@bitCast` but
/// also supports pointers.
Owner
Copy link

No it doesn't! I very intentionally split pointer casting out of the bit_cast instruction into new ptr_cast, ptr_from_int, and int_from_ptr instruction tags. Please leave this doc comment as it was---the semantics of @bitCast are non-trivial, and this instruction tag implements exactly those semantics, so just saying it implements @bitCast is the most concise and accurate explanation of the instruction tag.

No it doesn't! I very intentionally split pointer casting out of the `bit_cast` instruction into new `ptr_cast`, `ptr_from_int`, and `int_from_ptr` instruction tags. Please leave this doc comment as it was---the semantics of `@bitCast` are non-trivial, and this instruction tag implements exactly those semantics, so just saying it implements `@bitCast` is the most concise and accurate explanation of the instruction tag.
Author
Member
Copy link

oops picked the wrong comment when rebasing sorry

oops picked the wrong comment when rebasing sorry
justusk marked this conversation as resolved
@ -284,0 +285,4 @@
/// Like `bit_cast`, but triggers a safety panic if the destination type is an exhaustive
/// enum and the operand is not a valid value of this type;
/// i.e. equivalent to a safety check based on `.is_named_enum_value`
bit_cast_safe,
Owner
Copy link

Since this only adds a safety check in one particular case, let's avoid having backends need to check for that one specific case by calling this enum_from_int_safe and guaranteeing in Sema that it's doing int->enum.

Since this only adds a safety check in one particular case, let's avoid having backends need to check for that one specific case by calling this `enum_from_int_safe` and guaranteeing in Sema that it's doing int->enum.
Author
Member
Copy link

It's not only used for going from int to enum though. It's also used by literal @bitCast to cast anything that's @bitCast-able to an enum. Are you suggesting to lower @bitCast from T to an enum to bit_cast T -> int + enum_from_int_safe int -> enum instead?

It's not only used for going from int to enum though. It's also used by literal `@bitCast` to cast anything that's `@bitCast`-able to an enum. Are you suggesting to lower `@bitCast` from T to an enum to `bit_cast` T -> int + `enum_from_int_safe` int -> enum instead?
Owner
Copy link

Oh, of course, you could @bitCast something which isn't an int to an enum. Sorry, didn't think of that!

In that case, I think having bit_cast_safe as you've done it is reasonable. However, to keep things simple, let's eliminate the extra Legalize scalarization features, and just check the existing ones; that is, have scalarize_bit_cast_array etc affect both .bit_cast and .bit_cast_safe. The rationale is that those scalarizations can only happen in the case where bit_cast is exactly equivalent to bit_cast_safe, so there's never a reason for a backend to want one but not the other.

Oh, of course, you could `@bitCast` something which isn't an int to an enum. Sorry, didn't think of that! In that case, I think having `bit_cast_safe` as you've done it is reasonable. However, to keep things simple, let's eliminate the extra Legalize scalarization features, and just check the existing ones; that is, have `scalarize_bit_cast_array` etc affect both `.bit_cast` and `.bit_cast_safe`. The rationale is that those scalarizations can only happen in the case where `bit_cast` is exactly equivalent to `bit_cast_safe`, so there's never a reason for a backend to want one but not the other.
justusk marked this conversation as resolved
@ -123,6 +123,7 @@ pub const Feature = enum {
/// Scalarize `bit_cast` where the operand or result type is an array.
scalarize_bit_cast_array,
scalarize_bit_cast_array_safe,
Owner
Copy link

The above suggestion about renaming .bit_cast_safe to .enum_from_int_safe also makes these added Legalize features unnecessary---.enum_from_int_safe can't act on vectors because you can't have vectors of enums, so scalarizations aren't necessary! (The only new Legalize feature necessary then is .expand_enum_from_int_safe to expand the safety check.)

The above suggestion about renaming `.bit_cast_safe` to `.enum_from_int_safe` also makes these added Legalize features unnecessary---`.enum_from_int_safe` can't act on vectors because you can't have vectors of enums, so scalarizations aren't necessary! (The only new Legalize feature necessary then is `.expand_enum_from_int_safe` to expand the safety check.)
justusk marked this conversation as resolved
@ -9393,0 +9573,4 @@
trysema.preparePanicId(src,.invalid_enum_value);
returnblock.addTyOp(.bit_cast_safe,dest_ty,operand);
}
returnblock.addTyOp(.bit_cast,dest_ty,operand);
Author
Member
Copy link

operand should be backing_int_ref here oops

`operand` should be `backing_int_ref` here oops
justusk marked this conversation as resolved
justusk force-pushed justusk/backing-int from 36bfbe6a6b
All checks were successful
ci / x86_64-netbsd-release (pull_request) Successful in 51m55s
ci / x86_64-netbsd-debug (pull_request) Successful in 54m23s
ci / x86_64-freebsd-debug (pull_request) Successful in 59m31s
ci / x86_64-freebsd-release (pull_request) Successful in 1h1m43s
ci / aarch64-macos-release (pull_request) Successful in 1h5m49s
ci / x86_64-openbsd-release (pull_request) Successful in 1h7m19s
ci / x86_64-openbsd-debug (pull_request) Successful in 1h10m33s
ci / x86_64-windows-release (pull_request) Successful in 1h15m2s
ci / aarch64-macos-debug (pull_request) Successful in 1h17m13s
ci / x86_64-windows-debug (pull_request) Successful in 1h31m35s
ci / aarch64-linux-release (pull_request) Successful in 1h34m32s
ci / x86_64-linux-debug (pull_request) Successful in 1h35m18s
ci / s390x-linux-release (pull_request) Successful in 1h35m36s
ci / powerpc64le-linux-release (pull_request) Successful in 2h15m0s
ci / aarch64-linux-debug (pull_request) Successful in 2h44m45s
ci / s390x-linux-debug (pull_request) Successful in 2h51m14s
ci / aarch64-freebsd-debug (pull_request) Has been skipped
ci / aarch64-freebsd-release (pull_request) Has been skipped
ci / aarch64-netbsd-debug (pull_request) Has been skipped
ci / aarch64-netbsd-release (pull_request) Has been skipped
ci / x86_64-linux-release (pull_request) Successful in 4h9m41s
ci / x86_64-linux-debug-llvm (pull_request) Successful in 4h37m36s
ci / powerpc64le-linux-debug (pull_request) Successful in 5h22m2s
ci / riscv64-linux-debug (pull_request) Has been skipped
ci / riscv64-linux-release (pull_request) Has been skipped
ci / loongarch64-linux-release (pull_request) Successful in 2h25m49s
ci / loongarch64-linux-debug (pull_request) Successful in 4h18m54s
to bb0f345586
Some checks failed
ci / x86_64-freebsd-release (pull_request) Failing after 26m44s
ci / x86_64-netbsd-release (pull_request) Failing after 32m46s
ci / aarch64-macos-release (pull_request) Failing after 36m42s
ci / x86_64-openbsd-release (pull_request) Failing after 38m8s
ci / x86_64-freebsd-debug (pull_request) Failing after 40m52s
ci / aarch64-freebsd-debug (pull_request) Has been cancelled
ci / aarch64-freebsd-release (pull_request) Has been cancelled
ci / aarch64-netbsd-debug (pull_request) Has been cancelled
ci / aarch64-netbsd-release (pull_request) Has been cancelled
ci / loongarch64-linux-debug (pull_request) Has been cancelled
ci / loongarch64-linux-release (pull_request) Has been cancelled
ci / riscv64-linux-debug (pull_request) Has been cancelled
ci / riscv64-linux-release (pull_request) Has been cancelled
ci / x86_64-linux-release (pull_request) Has been cancelled
ci / x86_64-netbsd-debug (pull_request) Has been cancelled
ci / aarch64-macos-debug (pull_request) Has been cancelled
ci / x86_64-windows-debug (pull_request) Has been cancelled
ci / x86_64-windows-release (pull_request) Has been cancelled
ci / aarch64-linux-debug (pull_request) Has been cancelled
ci / x86_64-linux-debug (pull_request) Has been cancelled
ci / x86_64-openbsd-debug (pull_request) Has been cancelled
ci / aarch64-linux-release (pull_request) Has been cancelled
ci / x86_64-linux-debug-llvm (pull_request) Has been cancelled
ci / s390x-linux-release (pull_request) Has been cancelled
ci / s390x-linux-debug (pull_request) Has been cancelled
ci / powerpc64le-linux-debug (pull_request) Has been cancelled
ci / powerpc64le-linux-release (pull_request) Has been cancelled
2026年07月04日 02:20:26 +02:00
Compare
justusk force-pushed justusk/backing-int from bb0f345586
Some checks failed
ci / x86_64-freebsd-release (pull_request) Failing after 26m44s
ci / x86_64-netbsd-release (pull_request) Failing after 32m46s
ci / aarch64-macos-release (pull_request) Failing after 36m42s
ci / x86_64-openbsd-release (pull_request) Failing after 38m8s
ci / x86_64-freebsd-debug (pull_request) Failing after 40m52s
ci / aarch64-freebsd-debug (pull_request) Has been cancelled
ci / aarch64-freebsd-release (pull_request) Has been cancelled
ci / aarch64-netbsd-debug (pull_request) Has been cancelled
ci / aarch64-netbsd-release (pull_request) Has been cancelled
ci / loongarch64-linux-debug (pull_request) Has been cancelled
ci / loongarch64-linux-release (pull_request) Has been cancelled
ci / riscv64-linux-debug (pull_request) Has been cancelled
ci / riscv64-linux-release (pull_request) Has been cancelled
ci / x86_64-linux-release (pull_request) Has been cancelled
ci / x86_64-netbsd-debug (pull_request) Has been cancelled
ci / aarch64-macos-debug (pull_request) Has been cancelled
ci / x86_64-windows-debug (pull_request) Has been cancelled
ci / x86_64-windows-release (pull_request) Has been cancelled
ci / aarch64-linux-debug (pull_request) Has been cancelled
ci / x86_64-linux-debug (pull_request) Has been cancelled
ci / x86_64-openbsd-debug (pull_request) Has been cancelled
ci / aarch64-linux-release (pull_request) Has been cancelled
ci / x86_64-linux-debug-llvm (pull_request) Has been cancelled
ci / s390x-linux-release (pull_request) Has been cancelled
ci / s390x-linux-debug (pull_request) Has been cancelled
ci / powerpc64le-linux-debug (pull_request) Has been cancelled
ci / powerpc64le-linux-release (pull_request) Has been cancelled
to b61def91df
Some checks failed
ci / x86_64-netbsd-debug (pull_request) Failing after 8m47s
ci / x86_64-netbsd-release (pull_request) Failing after 31m19s
ci / x86_64-freebsd-release (pull_request) Failing after 34m45s
ci / x86_64-freebsd-debug (pull_request) Failing after 45m20s
ci / x86_64-openbsd-release (pull_request) Failing after 48m2s
ci / aarch64-macos-release (pull_request) Failing after 55m58s
ci / x86_64-windows-release (pull_request) Successful in 1h11m32s
ci / x86_64-openbsd-debug (pull_request) Failing after 1h15m9s
ci / s390x-linux-release (pull_request) Failing after 1h18m46s
ci / aarch64-macos-debug (pull_request) Failing after 1h26m43s
ci / aarch64-linux-release (pull_request) Failing after 1h27m11s
ci / x86_64-linux-debug (pull_request) Failing after 1h38m11s
ci / x86_64-windows-debug (pull_request) Successful in 1h40m35s
ci / powerpc64le-linux-release (pull_request) Failing after 1h44m36s
ci / aarch64-linux-debug (pull_request) Failing after 2h18m21s
ci / s390x-linux-debug (pull_request) Failing after 2h49m41s
ci / powerpc64le-linux-debug (pull_request) Failing after 3h10m32s
ci / x86_64-linux-debug-llvm (pull_request) Failing after 3h21m6s
ci / x86_64-linux-release (pull_request) Failing after 3h29m58s
ci / aarch64-freebsd-debug (pull_request) Has been cancelled
ci / aarch64-freebsd-release (pull_request) Has been cancelled
ci / aarch64-netbsd-debug (pull_request) Has been cancelled
ci / aarch64-netbsd-release (pull_request) Has been cancelled
ci / loongarch64-linux-debug (pull_request) Has been cancelled
ci / loongarch64-linux-release (pull_request) Has been cancelled
ci / riscv64-linux-debug (pull_request) Has been cancelled
ci / riscv64-linux-release (pull_request) Has been cancelled
2026年07月04日 03:05:28 +02:00
Compare
test/incremental: adjust expected errors to new builtins
Some checks failed
ci / x86_64-freebsd-release (pull_request) Successful in 53m52s
ci / x86_64-netbsd-release (pull_request) Successful in 59m0s
ci / x86_64-freebsd-debug (pull_request) Successful in 59m40s
ci / x86_64-netbsd-debug (pull_request) Successful in 1h5m36s
ci / x86_64-linux-debug (pull_request) Failing after 1h5m32s
ci / aarch64-freebsd-debug (pull_request) Has been cancelled
ci / aarch64-freebsd-release (pull_request) Has been cancelled
ci / aarch64-netbsd-debug (pull_request) Has been cancelled
ci / aarch64-netbsd-release (pull_request) Has been cancelled
ci / loongarch64-linux-debug (pull_request) Has been cancelled
ci / loongarch64-linux-release (pull_request) Has been cancelled
ci / riscv64-linux-debug (pull_request) Has been cancelled
ci / riscv64-linux-release (pull_request) Has been cancelled
ci / x86_64-openbsd-release (pull_request) Has been cancelled
ci / x86_64-openbsd-debug (pull_request) Has been cancelled
ci / x86_64-windows-release (pull_request) Has been cancelled
ci / aarch64-macos-debug (pull_request) Has been cancelled
ci / x86_64-windows-debug (pull_request) Has been cancelled
ci / aarch64-macos-release (pull_request) Has been cancelled
ci / s390x-linux-release (pull_request) Has been cancelled
ci / x86_64-linux-debug-llvm (pull_request) Has been cancelled
ci / aarch64-linux-release (pull_request) Has been cancelled
ci / powerpc64le-linux-debug (pull_request) Has been cancelled
ci / x86_64-linux-release (pull_request) Has been cancelled
ci / s390x-linux-debug (pull_request) Has been cancelled
ci / aarch64-linux-debug (pull_request) Has been cancelled
ci / powerpc64le-linux-release (pull_request) Has been cancelled
74db38c810
test/debugger: expect old @intFromEnum/@enumFromInt builtins instead of the new ones
All checks were successful
ci / x86_64-freebsd-release (pull_request) Successful in 1h0m49s
ci / x86_64-freebsd-debug (pull_request) Successful in 1h4m56s
ci / x86_64-netbsd-release (pull_request) Successful in 1h7m22s
ci / x86_64-openbsd-release (pull_request) Successful in 1h15m23s
ci / x86_64-windows-release (pull_request) Successful in 1h19m55s
ci / x86_64-netbsd-debug (pull_request) Successful in 1h23m22s
ci / x86_64-openbsd-debug (pull_request) Successful in 1h30m27s
ci / s390x-linux-release (pull_request) Successful in 1h41m17s
ci / aarch64-linux-release (pull_request) Successful in 1h49m49s
ci / x86_64-linux-debug (pull_request) Successful in 1h47m45s
ci / x86_64-windows-debug (pull_request) Successful in 1h57m56s
ci / aarch64-macos-release (pull_request) Successful in 2h9m5s
ci / aarch64-macos-debug (pull_request) Successful in 2h35m54s
ci / powerpc64le-linux-release (pull_request) Successful in 2h36m6s
ci / s390x-linux-debug (pull_request) Successful in 2h41m42s
ci / aarch64-linux-debug (pull_request) Successful in 3h32m57s
ci / x86_64-linux-debug-llvm (pull_request) Successful in 4h7m11s
ci / powerpc64le-linux-debug (pull_request) Successful in 4h16m44s
ci / x86_64-linux-release (pull_request) Successful in 4h26m2s
ci / aarch64-freebsd-debug (pull_request) Has been skipped
ci / aarch64-freebsd-release (pull_request) Has been skipped
ci / aarch64-netbsd-debug (pull_request) Has been skipped
ci / aarch64-netbsd-release (pull_request) Has been skipped
ci / riscv64-linux-debug (pull_request) Has been skipped
ci / riscv64-linux-release (pull_request) Has been skipped
ci / loongarch64-linux-release (pull_request) Successful in 2h24m41s
ci / loongarch64-linux-debug (pull_request) Successful in 3h30m19s
61f8875eb3
This will require a patch upstream at a later point in time.
All checks were successful
ci / x86_64-freebsd-release (pull_request) Successful in 1h0m49s
Required
Details
ci / x86_64-freebsd-debug (pull_request) Successful in 1h4m56s
Required
Details
ci / x86_64-netbsd-release (pull_request) Successful in 1h7m22s
Required
Details
ci / x86_64-openbsd-release (pull_request) Successful in 1h15m23s
Required
Details
ci / x86_64-windows-release (pull_request) Successful in 1h19m55s
Required
Details
ci / x86_64-netbsd-debug (pull_request) Successful in 1h23m22s
Required
Details
ci / x86_64-openbsd-debug (pull_request) Successful in 1h30m27s
Required
Details
ci / s390x-linux-release (pull_request) Successful in 1h41m17s
Required
Details
ci / aarch64-linux-release (pull_request) Successful in 1h49m49s
Required
Details
ci / x86_64-linux-debug (pull_request) Successful in 1h47m45s
Required
Details
ci / x86_64-windows-debug (pull_request) Successful in 1h57m56s
Required
Details
ci / aarch64-macos-release (pull_request) Successful in 2h9m5s
Required
Details
ci / aarch64-macos-debug (pull_request) Successful in 2h35m54s
Required
Details
ci / powerpc64le-linux-release (pull_request) Successful in 2h36m6s
Required
Details
ci / s390x-linux-debug (pull_request) Successful in 2h41m42s
Required
Details
ci / aarch64-linux-debug (pull_request) Successful in 3h32m57s
Required
Details
ci / x86_64-linux-debug-llvm (pull_request) Successful in 4h7m11s
Required
Details
ci / powerpc64le-linux-debug (pull_request) Successful in 4h16m44s
Required
Details
ci / x86_64-linux-release (pull_request) Successful in 4h26m2s
Required
Details
ci / aarch64-freebsd-debug (pull_request) Has been skipped
ci / aarch64-freebsd-release (pull_request) Has been skipped
ci / aarch64-netbsd-debug (pull_request) Has been skipped
ci / aarch64-netbsd-release (pull_request) Has been skipped
ci / riscv64-linux-debug (pull_request) Has been skipped
ci / riscv64-linux-release (pull_request) Has been skipped
ci / loongarch64-linux-release (pull_request) Successful in 2h24m41s
ci / loongarch64-linux-debug (pull_request) Successful in 3h30m19s
This pull request has changes conflicting with the target branch.
  • lib/std/zig/AstSmith.zig
  • src/Sema.zig
  • src/link/Elf2.zig
  • stage1/zig1.wasm
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin +refs/pull/35966/head:justusk/backing-int
git switch justusk/backing-int
Sign in to join this conversation.
No reviewers
Labels
Clear labels
abi/f32
abi/ilp32
abi/sf
accepted
This proposal is planned.
arch/21k
arch/6502
arch/aarch64
arch/alpha
arch/amdgcn
arch/arc
arch/arc32
arch/arc64
arch/arm
arch/avr
arch/bfin
arch/bpf
arch/colossus
arch/cris
arch/csky
arch/dlx
arch/epiphany
arch/fr30
arch/frv
arch/hexagon
arch/hppa
arch/hppa64
arch/ia64
arch/kalimba
arch/kvx
arch/lanai
arch/lm32
arch/loongarch32
arch/loongarch64
arch/m32r
arch/m68k
arch/m88k
arch/mcore
arch/microblaze
arch/mips
arch/mips64
arch/mmix
arch/moxie
arch/mrisc32
arch/msp430
arch/nds32
arch/ns32k
arch/nvptx
arch/or1k
arch/powerpc
arch/powerpc64
arch/propeller
arch/riscv32
arch/riscv64
arch/rl78
arch/rx
arch/s390x
arch/sh
arch/sparc
arch/sparc64
arch/spirv
arch/spu
arch/tricore
arch/v850
arch/vax
arch/vc4
arch/ve
arch/wasm
arch/x86
arch/x86_64
arch/xcore
arch/xtensa
autodoc
The web application for interactive documentation and generation of its assets.
backend/c
The C backend outputs C source code.
backend/llvm
The LLVM backend outputs an LLVM bitcode module.
backend/self-hosted
The self-hosted backends produce machine code directly.
binutils
Zig's included binary utilities: zig ar, zig dlltool, zig lib, zig ranlib, zig objcopy, and zig rc.
breaking
Implementing this issue could cause existing code to no longer compile or have different behavior.
build system
The Zig build system - zig build, std.Build, the build runner, and package management.
debug info
An issue related to debug information (e.g. DWARF) produced by the Zig compiler.
docs
An issue with documentation, e.g. the language reference or standard library doc comments.
error message
This issue points out an error message that is unhelpful and should be improved.
frontend
Tokenization, parsing, AstGen, ZonGen, Sema, Legalize, and Liveness.
fuzzing
An issue related to Zig's integrated fuzz testing.
incremental
Reuse of internal compiler state for faster compilation.
lib/c
This issue relates to Zig's libc implementation and/or vendored libcs.
lib/compiler-rt
This issue relates to Zig's compiler-rt library.
lib/cxx
This issue relates to Zig's vendored libc++ and/or libc++abi.
lib/std
This issue relates to Zig's standard library.
lib/tsan
This issue relates to Zig's vendored libtsan.
lib/ubsan-rt
This issue relates to Zig's ubsan-rt library.
lib/unwind
This issue relates to Zig's vendored libunwind.
linking
Zig's integrated object file and incremental linker.
miscompilation
The compiler reports success but produces semantically incorrect code.
os/android
os/contiki
os/dragonfly
os/driverkit
os/emscripten
os/freebsd
os/fuchsia
os/haiku
os/hermit
os/hurd
os/illumos
os/ios
os/linux
os/maccatalyst
os/macos
os/managarm
os/netbsd
os/ohos
os/openbsd
os/plan9
os/redox
os/rtems
os/serenity
os/tvos
os/uefi
os/visionos
os/wasi
os/watchos
os/windows
proposal
This issue suggests language modifications. If it also has the "accepted" label then it is planned.
release notes
This issue or pull request should be mentioned in the release notes.
testing
This issue is related to testing the compiler, standard library, or other parts of Zig.
zig cc
Zig as a drop-in C-family compiler.
zig fmt
The Zig source code formatter.
zig reduce
The Zig source code reduction tool.
bounty
https://ziglang.org/news/announcing-donor-bounties
bug
Observed behavior contradicts documented or intended behavior.
contributor-friendly
This issue is limited in scope and/or knowledge of project internals.
downstream
An issue with a third-party project that uses this project.
enhancement
Solving this issue will likely involve adding new logic or components to the codebase.
infra
An issue related to project infrastructure, e.g. continuous integration.
optimization
A task to improve performance and/or resource usage.
question
No questions on the issue tracker; use a community space instead.
regression
Something that used to work in a previous version stopped working
upstream
An issue with a third-party project that this project uses.
use case
Describes a real use case that is difficult or impossible, but does not propose a solution.
No labels
abi/f32
abi/ilp32
abi/sf
accepted
arch/21k
arch/6502
arch/aarch64
arch/alpha
arch/amdgcn
arch/arc
arch/arc32
arch/arc64
arch/arm
arch/avr
arch/bfin
arch/bpf
arch/colossus
arch/cris
arch/csky
arch/dlx
arch/epiphany
arch/fr30
arch/frv
arch/hexagon
arch/hppa
arch/hppa64
arch/ia64
arch/kalimba
arch/kvx
arch/lanai
arch/lm32
arch/loongarch32
arch/loongarch64
arch/m32r
arch/m68k
arch/m88k
arch/mcore
arch/microblaze
arch/mips
arch/mips64
arch/mmix
arch/moxie
arch/mrisc32
arch/msp430
arch/nds32
arch/ns32k
arch/nvptx
arch/or1k
arch/powerpc
arch/powerpc64
arch/propeller
arch/riscv32
arch/riscv64
arch/rl78
arch/rx
arch/s390x
arch/sh
arch/sparc
arch/sparc64
arch/spirv
arch/spu
arch/tricore
arch/v850
arch/vax
arch/vc4
arch/ve
arch/wasm
arch/x86
arch/x86_64
arch/xcore
arch/xtensa
autodoc
backend/c
backend/llvm
backend/self-hosted
binutils
breaking
build system
debug info
docs
error message
frontend
fuzzing
incremental
lib/c
lib/compiler-rt
lib/cxx
lib/std
lib/tsan
lib/ubsan-rt
lib/unwind
linking
miscompilation
os/android
os/contiki
os/dragonfly
os/driverkit
os/emscripten
os/freebsd
os/fuchsia
os/haiku
os/hermit
os/hurd
os/illumos
os/ios
os/linux
os/maccatalyst
os/macos
os/managarm
os/netbsd
os/ohos
os/openbsd
os/plan9
os/redox
os/rtems
os/serenity
os/tvos
os/uefi
os/visionos
os/wasi
os/watchos
os/windows
proposal
release notes
testing
zig cc
zig fmt
zig reduce
bounty
bug
contributor-friendly
downstream
enhancement
infra
optimization
question
regression
upstream
use case
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ziglang/zig!35966
Reference in a new issue
ziglang/zig
No description provided.
Delete branch "justusk/backing-int"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?