diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2024-12-29 16:24:07 +0000 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2024-12-31 09:55:03 +0000 |
| commit | 6026a5f217398b202b92a4ecc2e129691bbb3a69 (patch) | |
| tree | ee077302bdb0c28d620eb6233d23cd02360a5684 /src/codegen/spirv | |
| parent | 6d67658965bc298a697dc756a4e06bda144427de (diff) | |
| download | zig-6026a5f217398b202b92a4ecc2e129691bbb3a69.tar.gz zig-6026a5f217398b202b92a4ecc2e129691bbb3a69.zip | |
compiler: ensure result of `block_comptime` is comptime-known
To avoid this PR regressing error messages, most of the work here has
gone towards improving error notes for why code was comptime-evaluated.
ZIR `block_comptime` now stores a "comptime reason", the enum for which
is also used by Sema. There are two types in Sema:
* `ComptimeReason` represents the reason we started evaluating something
at comptime.
* `BlockComptimeReason` represents the reason a given block is evaluated
at comptime; it's either a `ComptimeReason` with an attached source
location, or it's because we're in a function which was called at
comptime (and that function's `Block` should be consulted for the
"parent" reason).
Every `Block` stores a `?BlockComptimeReason`. The old `is_comptime`
field is replaced with a trivial `isComptime()` method which returns
whether that reason is non-`null`.
Lastly, the handling for `block_comptime` has been simplified. It was
previously going through an unnecessary runtime-handling path; now, it
is a trivial sub block exited through a `break_inline` instruction.
Resolves: #22296
Diffstat (limited to 'src/codegen/spirv')
0 files changed, 0 insertions, 0 deletions
