aboutsummaryrefslogtreecommitdiff
path: root/src/InternPool.zig
diff options
context:
space:
mode:
authorDavid Rubin <daviru007@icloud.com>2025-02-24 04:02:06 -0800
committerDavid Rubin <david@vortan.dev>2025-08-01 14:57:16 -0700
commitd6c74a95fdaba4ed373f80baa725dcc53b27e402 (patch)
treee6827e6fa40ed25f5c6cee6eab0edace8a62c190 /src/InternPool.zig
parent17330867eb8f9e24ec8aadf23592e36f90f9dcb3 (diff)
downloadzig-d6c74a95fdaba4ed373f80baa725dcc53b27e402.tar.gz
zig-d6c74a95fdaba4ed373f80baa725dcc53b27e402.zip
remove usages of `.alignment = 0`
Diffstat (limited to 'src/InternPool.zig')
-rw-r--r--src/InternPool.zig38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/InternPool.zig b/src/InternPool.zig
index 15d895aed0..ed922db742 100644
--- a/src/InternPool.zig
+++ b/src/InternPool.zig
@@ -1137,13 +1137,16 @@ const Local = struct {
const elem_info = @typeInfo(Elem).@"struct";
const elem_fields = elem_info.fields;
var new_fields: [elem_fields.len]std.builtin.Type.StructField = undefined;
- for (&new_fields, elem_fields) |*new_field, elem_field| new_field.* = .{
- .name = elem_field.name,
- .type = *[len]elem_field.type,
- .default_value_ptr = null,
- .is_comptime = false,
- .alignment = 0,
- };
+ for (&new_fields, elem_fields) |*new_field, elem_field| {
+ const T = *[len]elem_field.type;
+ new_field.* = .{
+ .name = elem_field.name,
+ .type = T,
+ .default_value_ptr = null,
+ .is_comptime = false,
+ .alignment = @alignOf(T),
+ };
+ }
return @Type(.{ .@"struct" = .{
.layout = .auto,
.fields = &new_fields,
@@ -1158,22 +1161,25 @@ const Local = struct {
const elem_info = @typeInfo(Elem).@"struct";
const elem_fields = elem_info.fields;
var new_fields: [elem_fields.len]std.builtin.Type.StructField = undefined;
- for (&new_fields, elem_fields) |*new_field, elem_field| new_field.* = .{
- .name = elem_field.name,
- .type = @Type(.{ .pointer = .{
+ for (&new_fields, elem_fields) |*new_field, elem_field| {
+ const T = @Type(.{ .pointer = .{
.size = opts.size,
.is_const = opts.is_const,
.is_volatile = false,
- .alignment = 0,
+ .alignment = @alignOf(elem_field.type),
.address_space = .generic,
.child = elem_field.type,
.is_allowzero = false,
.sentinel_ptr = null,
- } }),
- .default_value_ptr = null,
- .is_comptime = false,
- .alignment = 0,
- };
+ } });
+ new_field.* = .{
+ .name = elem_field.name,
+ .type = T,
+ .default_value_ptr = null,
+ .is_comptime = false,
+ .alignment = @alignOf(T),
+ };
+ }
return @Type(.{ .@"struct" = .{
.layout = .auto,
.fields = &new_fields,