authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-07-16 15:18:36-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-18 16:02:29-07:00
logc5ba941b77fbdb06841f28142420c6786f2a4d0c
tree304b6e144bbed37afdb4b74e6b70841efc3bc18c
parent7d674d5fb664b6e2d4d3d5b85751ed464dc4c4b9

stage2: all pointers have runtime bits


1 files changed, 12 insertions(+), 24 deletions(-)

src/type.zig+12-24
...@@ -2374,6 +2374,18 @@ pub const Type = extern union {...@@ -2374,6 +2374,18 @@ pub const Type = extern union {
2374 .error_union,2374 .error_union,
2375 .error_set,2375 .error_set,
2376 .error_set_merged,2376 .error_set_merged,
2377 .anyframe_T,
2378 .optional_single_mut_pointer,
2379 .optional_single_const_pointer,
2380 .single_const_pointer,
2381 .single_mut_pointer,
2382 .many_const_pointer,
2383 .many_mut_pointer,
2384 .c_const_pointer,
2385 .c_mut_pointer,
2386 .const_slice,
2387 .mut_slice,
2388 .pointer,
2377 => return true,2389 => return true,
23782390
2379 // These are false because they are comptime-only types.2391 // These are false because they are comptime-only types.
...@@ -2399,30 +2411,6 @@ pub const Type = extern union {...@@ -2399,30 +2411,6 @@ pub const Type = extern union {
2399 .fn_ccc_void_no_args,2411 .fn_ccc_void_no_args,
2400 => return false,2412 => return false,
24012413
2402 // These types have more than one possible value, so the result is the same as
2403 // asking whether they are comptime-only types.
2404 .anyframe_T,
2405 .optional_single_mut_pointer,
2406 .optional_single_const_pointer,
2407 .single_const_pointer,
2408 .single_mut_pointer,
2409 .many_const_pointer,
2410 .many_mut_pointer,
2411 .c_const_pointer,
2412 .c_mut_pointer,
2413 .const_slice,
2414 .mut_slice,
2415 .pointer,
2416 => {
2417 if (ignore_comptime_only) {
2418 return true;
2419 } else if (sema_kit) |sk| {
2420 return !(try sk.sema.typeRequiresComptime(sk.block, sk.src, ty));
2421 } else {
2422 return !comptimeOnly(ty);
2423 }
2424 },
2425
2426 .optional => {2414 .optional => {
2427 var buf: Payload.ElemType = undefined;2415 var buf: Payload.ElemType = undefined;
2428 const child_ty = ty.optionalChild(&buf);2416 const child_ty = ty.optionalChild(&buf);