stage2: all pointers have runtime bits

This commit is contained in:
Andrew Kelley 2022-07-16 15:18:36 -07:00
parent 7d674d5fb6
commit c5ba941b77

View File

@ -2374,6 +2374,18 @@ pub const Type = extern union {
.error_union,
.error_set,
.error_set_merged,
.anyframe_T,
.optional_single_mut_pointer,
.optional_single_const_pointer,
.single_const_pointer,
.single_mut_pointer,
.many_const_pointer,
.many_mut_pointer,
.c_const_pointer,
.c_mut_pointer,
.const_slice,
.mut_slice,
.pointer,
=> return true,
// These are false because they are comptime-only types.
@ -2399,30 +2411,6 @@ pub const Type = extern union {
.fn_ccc_void_no_args,
=> return false,
// These types have more than one possible value, so the result is the same as
// asking whether they are comptime-only types.
.anyframe_T,
.optional_single_mut_pointer,
.optional_single_const_pointer,
.single_const_pointer,
.single_mut_pointer,
.many_const_pointer,
.many_mut_pointer,
.c_const_pointer,
.c_mut_pointer,
.const_slice,
.mut_slice,
.pointer,
=> {
if (ignore_comptime_only) {
return true;
} else if (sema_kit) |sk| {
return !(try sk.sema.typeRequiresComptime(sk.block, sk.src, ty));
} else {
return !comptimeOnly(ty);
}
},
.optional => {
var buf: Payload.ElemType = undefined;
const child_ty = ty.optionalChild(&buf);