authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-18 22:02:10-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-18 22:02:10-07:00
log5e989fcb679215a6357dd35b5b8903293f963846
treecfab9e446693df750eebad12d49f0ce0de3b283e
parentcee82c7ce4fb8beb39042f9dba16a1a391803fa4

stage2: pointers to comptime-only types are comptime-only

This is a partial revert of c5ba941b77fbdb06841f28142420c6786f2a4d0c.

1 files changed, 15 insertions(+), 1 deletions(-)

src/type.zig+15-1
......@@ -2374,6 +2374,10 @@ pub const Type = extern union {
23742374 .error_union,
23752375 .error_set,
23762376 .error_set_merged,
2377 => return true,
2378
2379 // Pointers to zero-bit types still have a runtime address; however, pointers
2380 // to comptime-only types do not, with the exception of function pointers.
23772381 .anyframe_T,
23782382 .optional_single_mut_pointer,
23792383 .optional_single_const_pointer,
......@@ -2386,7 +2390,17 @@ pub const Type = extern union {
23862390 .const_slice,
23872391 .mut_slice,
23882392 .pointer,
2389 => return true,
2393 => {
2394 if (ignore_comptime_only) {
2395 return true;
2396 } else if (ty.childType().zigTypeTag() == .Fn) {
2397 return true;
2398 } else if (sema_kit) |sk| {
2399 return !(try sk.sema.typeRequiresComptime(sk.block, sk.src, ty));
2400 } else {
2401 return !comptimeOnly(ty);
2402 }
2403 },
23902404
23912405 // These are false because they are comptime-only types.
23922406 .single_const_pointer_to_comptime_int,