@@ -28513,7 +28513,8 @@ fn tupleFieldPtr(
28513
28513
const pt = sema.pt;
28514
28514
const zcu = pt.zcu;
28515
28515
const tuple_ptr_ty = sema.typeOf(tuple_ptr);
28516
- const tuple_ty = tuple_ptr_ty.childType(zcu);
28516
+ const tuple_ptr_info = tuple_ptr_ty.ptrInfo(zcu);
28517
+ const tuple_ty: Type = .fromInterned(tuple_ptr_info.child);
28517
28518
try tuple_ty.resolveFields(pt);
28518
28519
const field_count = tuple_ty.structFieldCount(zcu);
28519
28520
@@ -28531,9 +28532,16 @@ fn tupleFieldPtr(
28531
28532
const ptr_field_ty = try pt.ptrTypeSema(.{
28532
28533
.child = field_ty.toIntern(),
28533
28534
.flags = .{
28534
- .is_const = !tuple_ptr_ty.ptrIsMutable(zcu),
28535
- .is_volatile = tuple_ptr_ty.isVolatilePtr(zcu),
28536
- .address_space = tuple_ptr_ty.ptrAddressSpace(zcu),
28535
+ .is_const = tuple_ptr_info.flags.is_const,
28536
+ .is_volatile = tuple_ptr_info.flags.is_volatile,
28537
+ .address_space = tuple_ptr_info.flags.address_space,
28538
+ .alignment = a: {
28539
+ if (tuple_ptr_info.flags.alignment == .none) break :a .none;
28540
+ // The tuple pointer isn't naturally aligned, so the field pointer might be underaligned.
28541
+ const tuple_align = tuple_ptr_info.flags.alignment;
28542
+ const field_align = try field_ty.abiAlignmentSema(pt);
28543
+ break :a tuple_align.min(field_align);
28544
+ },
28537
28545
},
28538
28546
});
28539
28547
0 commit comments