authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-02-27 10:27:29+00:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-03-10 10:26:13+00:00
log0075c5a1d5ad1198b16e6a1c390c985a8e4354de
tree5013a091265272a9b4cf1c91348de4708588fbd1
parent82be338964ed5bbc596a48075e52724fdf92cde4
signaturelock-open Commit is signed but in an unrecognized format.

Type: tiny refactors


1 files changed, 13 insertions(+), 6 deletions(-)

src/Type.zig+13-6
......@@ -690,9 +690,9 @@ pub fn hasRuntimeBits(ty: Type, zcu: *const Zcu) bool {
690690 };
691691}
692692
693/// true if and only if the type has a well-defined memory layout
694/// readFrom/writeToMemory are supported only for types with a well-
695/// defined memory layout
693/// Returns `true` iff the memory layout of `ty` is defined by the Zig language specification.
694///
695/// Does not require `ty` to be resolved.
696696pub fn hasWellDefinedLayout(ty: Type, zcu: *const Zcu) bool {
697697 const ip = &zcu.intern_pool;
698698 return switch (ip.indexToKey(ty.toIntern())) {
......@@ -3140,9 +3140,16 @@ pub fn validateExtern(ty: Type, position: ExternPosition, zcu: *const Zcu) bool
31403140 },
31413141 };
31423142 },
3143 .array => {
3144 if (position == .ret_ty or position == .param_ty) return false;
3145 return ty.childType(zcu).validateExtern(.element, zcu);
3143 .array => switch (position) {
3144 .ret_ty,
3145 .param_ty,
3146 => false,
3147
3148 .union_field,
3149 .struct_field,
3150 .element,
3151 .other,
3152 => ty.childType(zcu).validateExtern(.element, zcu),
31463153 },
31473154 .vector => ty.childType(zcu).validateExtern(.element, zcu),
31483155 .optional => ty.isPtrLikeOptional(zcu),