mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
stage2: pointers to comptime-only types are comptime-only
This is a partial revert of c5ba941b77fbdb06841f28142420c6786f2a4d0c.
This commit is contained in:
parent
cee82c7ce4
commit
5e989fcb67
16
src/type.zig
16
src/type.zig
@ -2374,6 +2374,10 @@ pub const Type = extern union {
|
||||
.error_union,
|
||||
.error_set,
|
||||
.error_set_merged,
|
||||
=> return true,
|
||||
|
||||
// Pointers to zero-bit types still have a runtime address; however, pointers
|
||||
// to comptime-only types do not, with the exception of function pointers.
|
||||
.anyframe_T,
|
||||
.optional_single_mut_pointer,
|
||||
.optional_single_const_pointer,
|
||||
@ -2386,7 +2390,17 @@ pub const Type = extern union {
|
||||
.const_slice,
|
||||
.mut_slice,
|
||||
.pointer,
|
||||
=> return true,
|
||||
=> {
|
||||
if (ignore_comptime_only) {
|
||||
return true;
|
||||
} else if (ty.childType().zigTypeTag() == .Fn) {
|
||||
return true;
|
||||
} else if (sema_kit) |sk| {
|
||||
return !(try sk.sema.typeRequiresComptime(sk.block, sk.src, ty));
|
||||
} else {
|
||||
return !comptimeOnly(ty);
|
||||
}
|
||||
},
|
||||
|
||||
// These are false because they are comptime-only types.
|
||||
.single_const_pointer_to_comptime_int,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user