mirror of
https://github.com/ziglang/zig.git
synced 2025-12-16 03:03:09 +00:00
stage1: Fix crash in can_mutate_comptime_var_state
No lazy value can mutate global state, no need to resolve them. Closes #7426
This commit is contained in:
parent
d569e37cb5
commit
561565fa81
@ -5749,6 +5749,28 @@ static bool can_mutate_comptime_var_state(ZigValue *value) {
|
||||
assert(value != nullptr);
|
||||
if (value->special == ConstValSpecialUndef)
|
||||
return false;
|
||||
|
||||
if (value->special == ConstValSpecialLazy) {
|
||||
// No lazy value has side effects.
|
||||
// Use a switch here to get a compile error whenever a new kind of lazy
|
||||
// value is added.
|
||||
switch (value->data.x_lazy->id) {
|
||||
case LazyValueIdInvalid:
|
||||
zig_unreachable();
|
||||
|
||||
case LazyValueIdAlignOf:
|
||||
case LazyValueIdSizeOf:
|
||||
case LazyValueIdPtrType:
|
||||
case LazyValueIdOptType:
|
||||
case LazyValueIdSliceType:
|
||||
case LazyValueIdFnType:
|
||||
case LazyValueIdErrUnionType:
|
||||
case LazyValueIdArrayType:
|
||||
case LazyValueIdTypeInfoDecls:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
switch (value->type->id) {
|
||||
case ZigTypeIdInvalid:
|
||||
zig_unreachable();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user