aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorr00ster91 <r00ster91@proton.me>2022-12-13 22:30:06 +0100
committerr00ster91 <r00ster91@proton.me>2022-12-17 14:11:33 +0100
commitaac2d6b56f32134ea32fb3d984e3fcdfddd8aaf6 (patch)
tree941528727d4d0a5b92f58c0b862f0d5f372b89e0 /lib/std
parent7350ea3e2da4d4e6ef5092cd9f0832beef0291d5 (diff)
downloadzig-aac2d6b56f32134ea32fb3d984e3fcdfddd8aaf6.tar.gz
zig-aac2d6b56f32134ea32fb3d984e3fcdfddd8aaf6.zip
std.builtin: rename Type.UnionField and Type.StructField's field_type to type
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/array_hash_map.zig8
-rw-r--r--lib/std/builtin.zig5
-rw-r--r--lib/std/crypto/phc_encoding.zig8
-rw-r--r--lib/std/enums.zig2
-rw-r--r--lib/std/hash/auto_hash.zig6
-rw-r--r--lib/std/io/multi_writer.zig2
-rw-r--r--lib/std/json.zig26
-rw-r--r--lib/std/mem.zig8
-rw-r--r--lib/std/meta.zig16
-rw-r--r--lib/std/meta/trailer_flags.zig20
-rw-r--r--lib/std/meta/trait.zig2
-rw-r--r--lib/std/multi_array_list.zig26
-rw-r--r--lib/std/os/uefi/protocols/device_path_protocol.zig4
-rw-r--r--lib/std/testing.zig2
-rw-r--r--lib/std/x/os/socket.zig8
-rw-r--r--lib/std/zig/Ast.zig2
-rw-r--r--lib/std/zig/c_translation.zig2
-rw-r--r--lib/std/zig/parse.zig2
18 files changed, 74 insertions, 75 deletions
diff --git a/lib/std/array_hash_map.zig b/lib/std/array_hash_map.zig
index 1d6d86f8f5..cf04a54116 100644
--- a/lib/std/array_hash_map.zig
+++ b/lib/std/array_hash_map.zig
@@ -2270,13 +2270,13 @@ test "reIndex" {
test "auto store_hash" {
const HasCheapEql = AutoArrayHashMap(i32, i32);
const HasExpensiveEql = AutoArrayHashMap([32]i32, i32);
- try testing.expect(meta.fieldInfo(HasCheapEql.Data, .hash).field_type == void);
- try testing.expect(meta.fieldInfo(HasExpensiveEql.Data, .hash).field_type != void);
+ try testing.expect(meta.fieldInfo(HasCheapEql.Data, .hash).type == void);
+ try testing.expect(meta.fieldInfo(HasExpensiveEql.Data, .hash).type != void);
const HasCheapEqlUn = AutoArrayHashMapUnmanaged(i32, i32);
const HasExpensiveEqlUn = AutoArrayHashMapUnmanaged([32]i32, i32);
- try testing.expect(meta.fieldInfo(HasCheapEqlUn.Data, .hash).field_type == void);
- try testing.expect(meta.fieldInfo(HasExpensiveEqlUn.Data, .hash).field_type != void);
+ try testing.expect(meta.fieldInfo(HasCheapEqlUn.Data, .hash).type == void);
+ try testing.expect(meta.fieldInfo(HasExpensiveEqlUn.Data, .hash).type != void);
}
test "sort" {
diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig
index a32f8253d4..349d976ddc 100644
--- a/lib/std/builtin.zig
+++ b/lib/std/builtin.zig
@@ -280,8 +280,7 @@ pub const Type = union(enum) {
/// therefore must be kept in sync with the compiler implementation.
pub const StructField = struct {
name: []const u8,
- /// TODO rename to `type`
- field_type: type,
+ type: type,
default_value: ?*const anyopaque,
is_comptime: bool,
alignment: comptime_int,
@@ -343,7 +342,7 @@ pub const Type = union(enum) {
/// therefore must be kept in sync with the compiler implementation.
pub const UnionField = struct {
name: []const u8,
- field_type: type,
+ type: type,
alignment: comptime_int,
};
diff --git a/lib/std/crypto/phc_encoding.zig b/lib/std/crypto/phc_encoding.zig
index bba03a3fff..4b6965d040 100644
--- a/lib/std/crypto/phc_encoding.zig
+++ b/lib/std/crypto/phc_encoding.zig
@@ -110,9 +110,9 @@ pub fn deserialize(comptime HashResult: type, str: []const u8) Error!HashResult
var found = false;
inline for (comptime meta.fields(HashResult)) |p| {
if (mem.eql(u8, p.name, param.key)) {
- switch (@typeInfo(p.field_type)) {
+ switch (@typeInfo(p.type)) {
.Int => @field(out, p.name) = fmt.parseUnsigned(
- p.field_type,
+ p.type,
param.value,
10,
) catch return Error.InvalidEncoding,
@@ -161,7 +161,7 @@ pub fn deserialize(comptime HashResult: type, str: []const u8) Error!HashResult
// with default values
var expected_fields: usize = 0;
inline for (comptime meta.fields(HashResult)) |p| {
- if (@typeInfo(p.field_type) != .Optional and p.default_value == null) {
+ if (@typeInfo(p.type) != .Optional and p.default_value == null) {
expected_fields += 1;
}
}
@@ -223,7 +223,7 @@ fn serializeTo(params: anytype, out: anytype) !void {
{
const value = @field(params, p.name);
try out.writeAll(if (has_params) params_delimiter else fields_delimiter);
- if (@typeInfo(p.field_type) == .Struct) {
+ if (@typeInfo(p.type) == .Struct) {
var buf: [@TypeOf(value).max_encoded_length]u8 = undefined;
try out.print("{s}{s}{s}", .{ p.name, kv_delimiter, try value.toB64(&buf) });
} else {
diff --git a/lib/std/enums.zig b/lib/std/enums.zig
index 0fdbf03162..2640e6aac9 100644
--- a/lib/std/enums.zig
+++ b/lib/std/enums.zig
@@ -15,7 +15,7 @@ pub fn EnumFieldStruct(comptime E: type, comptime Data: type, comptime field_def
for (std.meta.fields(E)) |field| {
fields = fields ++ &[_]StructField{.{
.name = field.name,
- .field_type = Data,
+ .type = Data,
.default_value = if (field_default) |d| @ptrCast(?*const anyopaque, &d) else null,
.is_comptime = false,
.alignment = if (@sizeOf(Data) > 0) @alignOf(Data) else 0,
diff --git a/lib/std/hash/auto_hash.zig b/lib/std/hash/auto_hash.zig
index aac4b0feaf..d4640262f2 100644
--- a/lib/std/hash/auto_hash.zig
+++ b/lib/std/hash/auto_hash.zig
@@ -134,7 +134,7 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void {
hash(hasher, tag, strat);
inline for (info.fields) |field| {
if (@field(tag_type, field.name) == tag) {
- if (field.field_type != void) {
+ if (field.type != void) {
hash(hasher, @field(key, field.name), strat);
}
// TODO use a labelled break when it does not crash the compiler. cf #2908
@@ -163,14 +163,14 @@ fn typeContainsSlice(comptime K: type) bool {
}
if (meta.trait.is(.Struct)(K)) {
inline for (@typeInfo(K).Struct.fields) |field| {
- if (typeContainsSlice(field.field_type)) {
+ if (typeContainsSlice(field.type)) {
return true;
}
}
}
if (meta.trait.is(.Union)(K)) {
inline for (@typeInfo(K).Union.fields) |field| {
- if (typeContainsSlice(field.field_type)) {
+ if (typeContainsSlice(field.type)) {
return true;
}
}
diff --git a/lib/std/io/multi_writer.zig b/lib/std/io/multi_writer.zig
index ae683848d0..b3f64f1553 100644
--- a/lib/std/io/multi_writer.zig
+++ b/lib/std/io/multi_writer.zig
@@ -6,7 +6,7 @@ const testing = std.testing;
pub fn MultiWriter(comptime Writers: type) type {
comptime var ErrSet = error{};
inline for (@typeInfo(Writers).Struct.fields) |field| {
- const StreamType = field.field_type;
+ const StreamType = field.type;
ErrSet = ErrSet || StreamType.Error;
}
diff --git a/lib/std/json.zig b/lib/std/json.zig
index 17fc13b0dc..f16d70da80 100644
--- a/lib/std/json.zig
+++ b/lib/std/json.zig
@@ -1362,7 +1362,7 @@ fn ParseInternalErrorImpl(comptime T: type, comptime inferred_types: []const typ
if (unionInfo.tag_type) |_| {
var errors = error{NoUnionMembersMatched};
for (unionInfo.fields) |u_field| {
- errors = errors || ParseInternalErrorImpl(u_field.field_type, inferred_types ++ [_]type{T});
+ errors = errors || ParseInternalErrorImpl(u_field.type, inferred_types ++ [_]type{T});
}
return errors;
} else {
@@ -1379,7 +1379,7 @@ fn ParseInternalErrorImpl(comptime T: type, comptime inferred_types: []const typ
MissingField,
} || SkipValueError || TokenStream.Error;
for (structInfo.fields) |field| {
- errors = errors || ParseInternalErrorImpl(field.field_type, inferred_types ++ [_]type{T});
+ errors = errors || ParseInternalErrorImpl(field.type, inferred_types ++ [_]type{T});
}
return errors;
},
@@ -1491,7 +1491,7 @@ fn parseInternal(
inline for (unionInfo.fields) |u_field| {
// take a copy of tokens so we can withhold mutations until success
var tokens_copy = tokens.*;
- if (parseInternal(u_field.field_type, token, &tokens_copy, options)) |value| {
+ if (parseInternal(u_field.type, token, &tokens_copy, options)) |value| {
tokens.* = tokens_copy;
return @unionInit(T, u_field.name, value);
} else |err| {
@@ -1519,7 +1519,7 @@ fn parseInternal(
errdefer {
inline for (structInfo.fields) |field, i| {
if (fields_seen[i] and !field.is_comptime) {
- parseFree(field.field_type, @field(r, field.name), options);
+ parseFree(field.type, @field(r, field.name), options);
}
}
}
@@ -1547,24 +1547,24 @@ fn parseInternal(
// }
if (options.duplicate_field_behavior == .UseFirst) {
// unconditonally ignore value. for comptime fields, this skips check against default_value
- parseFree(field.field_type, try parse(field.field_type, tokens, child_options), child_options);
+ parseFree(field.type, try parse(field.type, tokens, child_options), child_options);
found = true;
break;
} else if (options.duplicate_field_behavior == .Error) {
return error.DuplicateJSONField;
} else if (options.duplicate_field_behavior == .UseLast) {
if (!field.is_comptime) {
- parseFree(field.field_type, @field(r, field.name), child_options);
+ parseFree(field.type, @field(r, field.name), child_options);
}
fields_seen[i] = false;
}
}
if (field.is_comptime) {
- if (!try parsesTo(field.field_type, @ptrCast(*align(1) const field.field_type, field.default_value.?).*, tokens, child_options)) {
+ if (!try parsesTo(field.type, @ptrCast(*align(1) const field.type, field.default_value.?).*, tokens, child_options)) {
return error.UnexpectedValue;
}
} else {
- @field(r, field.name) = try parse(field.field_type, tokens, child_options);
+ @field(r, field.name) = try parse(field.type, tokens, child_options);
}
fields_seen[i] = true;
found = true;
@@ -1587,7 +1587,7 @@ fn parseInternal(
if (!fields_seen[i]) {
if (field.default_value) |default_ptr| {
if (!field.is_comptime) {
- const default = @ptrCast(*align(1) const field.field_type, default_ptr).*;
+ const default = @ptrCast(*align(1) const field.type, default_ptr).*;
@field(r, field.name) = default;
}
} else {
@@ -1732,7 +1732,7 @@ pub fn parseFree(comptime T: type, value: T, options: ParseOptions) void {
if (unionInfo.tag_type) |UnionTagType| {
inline for (unionInfo.fields) |u_field| {
if (value == @field(UnionTagType, u_field.name)) {
- parseFree(u_field.field_type, @field(value, u_field.name), options);
+ parseFree(u_field.type, @field(value, u_field.name), options);
break;
}
}
@@ -1743,7 +1743,7 @@ pub fn parseFree(comptime T: type, value: T, options: ParseOptions) void {
.Struct => |structInfo| {
inline for (structInfo.fields) |field| {
if (!field.is_comptime) {
- parseFree(field.field_type, @field(value, field.name), options);
+ parseFree(field.type, @field(value, field.name), options);
}
}
},
@@ -2270,12 +2270,12 @@ pub fn stringify(
}
inline for (S.fields) |Field| {
// don't include void fields
- if (Field.field_type == void) continue;
+ if (Field.type == void) continue;
var emit_field = true;
// don't include optional fields that are null when emit_null_optional_fields is set to false
- if (@typeInfo(Field.field_type) == .Optional) {
+ if (@typeInfo(Field.type) == .Optional) {
if (options.emit_null_optional_fields == false) {
if (@field(value, Field.name) == null) {
emit_field = false;
diff --git a/lib/std/mem.zig b/lib/std/mem.zig
index a6b7490dab..17281390a8 100644
--- a/lib/std/mem.zig
+++ b/lib/std/mem.zig
@@ -300,7 +300,7 @@ pub fn zeroes(comptime T: type) T {
if (comptime meta.containerLayout(T) == .Extern) {
// The C language specification states that (global) unions
// should be zero initialized to the first named member.
- return @unionInit(T, info.fields[0].name, zeroes(info.fields[0].field_type));
+ return @unionInit(T, info.fields[0].name, zeroes(info.fields[0].type));
}
@compileError("Can't set a " ++ @typeName(T) ++ " to zero.");
@@ -435,7 +435,7 @@ pub fn zeroInit(comptime T: type, init: anytype) T {
inline for (struct_info.fields) |field| {
if (field.default_value) |default_value_ptr| {
- const default_value = @ptrCast(*align(1) const field.field_type, default_value_ptr).*;
+ const default_value = @ptrCast(*align(1) const field.type, default_value_ptr).*;
@field(value, field.name) = default_value;
}
}
@@ -452,9 +452,9 @@ pub fn zeroInit(comptime T: type, init: anytype) T {
@compileError("Encountered an initializer for `" ++ field.name ++ "`, but it is not a field of " ++ @typeName(T));
}
- switch (@typeInfo(field.field_type)) {
+ switch (@typeInfo(field.type)) {
.Struct => {
- @field(value, field.name) = zeroInit(field.field_type, @field(init, field.name));
+ @field(value, field.name) = zeroInit(field.type, @field(init, field.name));
},
else => {
@field(value, field.name) = @field(init, field.name);
diff --git a/lib/std/meta.zig b/lib/std/meta.zig
index c2e4267998..b4a73ffb3a 100644
--- a/lib/std/meta.zig
+++ b/lib/std/meta.zig
@@ -522,8 +522,8 @@ test "std.meta.fields" {
try testing.expect(mem.eql(u8, e2f[0].name, "A"));
try testing.expect(mem.eql(u8, sf[0].name, "a"));
try testing.expect(mem.eql(u8, uf[0].name, "a"));
- try testing.expect(comptime sf[0].field_type == u8);
- try testing.expect(comptime uf[0].field_type == u8);
+ try testing.expect(comptime sf[0].type == u8);
+ try testing.expect(comptime uf[0].type == u8);
}
pub fn fieldInfo(comptime T: type, comptime field: FieldEnum(T)) switch (@typeInfo(T)) {
@@ -557,8 +557,8 @@ test "std.meta.fieldInfo" {
try testing.expect(mem.eql(u8, e2f.name, "A"));
try testing.expect(mem.eql(u8, sf.name, "a"));
try testing.expect(mem.eql(u8, uf.name, "a"));
- try testing.expect(comptime sf.field_type == u8);
- try testing.expect(comptime uf.field_type == u8);
+ try testing.expect(comptime sf.type == u8);
+ try testing.expect(comptime uf.type == u8);
}
pub fn fieldNames(comptime T: type) *const [fields(T).len][]const u8 {
@@ -831,7 +831,7 @@ pub fn TagPayload(comptime U: type, comptime tag: Tag(U)) type {
inline for (info.fields) |field_info| {
if (comptime mem.eql(u8, field_info.name, @tagName(tag)))
- return field_info.field_type;
+ return field_info.type;
}
unreachable;
@@ -1111,7 +1111,7 @@ fn CreateUniqueTuple(comptime N: comptime_int, comptime types: [N]type) type {
var num_buf: [128]u8 = undefined;
tuple_fields[i] = .{
.name = std.fmt.bufPrint(&num_buf, "{d}", .{i}) catch unreachable,
- .field_type = T,
+ .type = T,
.default_value = null,
.is_comptime = false,
.alignment = if (@sizeOf(T) > 0) @alignOf(T) else 0,
@@ -1146,8 +1146,8 @@ const TupleTester = struct {
@compileError("Argument count mismatch");
inline for (fields_list) |fld, i| {
- if (expected[i] != fld.field_type) {
- @compileError("Field " ++ fld.name ++ " expected to be type " ++ @typeName(expected[i]) ++ ", but was type " ++ @typeName(fld.field_type));
+ if (expected[i] != fld.type) {
+ @compileError("Field " ++ fld.name ++ " expected to be type " ++ @typeName(expected[i]) ++ ", but was type " ++ @typeName(fld.type));
}
}
}
diff --git a/lib/std/meta/trailer_flags.zig b/lib/std/meta/trailer_flags.zig
index 34fb17eb0a..e50950018d 100644
--- a/lib/std/meta/trailer_flags.zig
+++ b/lib/std/meta/trailer_flags.zig
@@ -24,10 +24,10 @@ pub fn TrailerFlags(comptime Fields: type) type {
inline for (@typeInfo(Fields).Struct.fields) |struct_field, i| {
fields[i] = Type.StructField{
.name = struct_field.name,
- .field_type = ?struct_field.field_type,
- .default_value = &@as(?struct_field.field_type, null),
+ .type = ?struct_field.type,
+ .default_value = &@as(?struct_field.type, null),
.is_comptime = false,
- .alignment = @alignOf(?struct_field.field_type),
+ .alignment = @alignOf(?struct_field.type),
};
}
break :blk @Type(.{
@@ -105,26 +105,26 @@ pub fn TrailerFlags(comptime Fields: type) type {
const active = (self.bits & (1 << i)) != 0;
if (i == @enumToInt(field)) {
assert(active);
- return mem.alignForwardGeneric(usize, off, @alignOf(field_info.field_type));
+ return mem.alignForwardGeneric(usize, off, @alignOf(field_info.type));
} else if (active) {
- off = mem.alignForwardGeneric(usize, off, @alignOf(field_info.field_type));
- off += @sizeOf(field_info.field_type);
+ off = mem.alignForwardGeneric(usize, off, @alignOf(field_info.type));
+ off += @sizeOf(field_info.type);
}
}
}
pub fn Field(comptime field: FieldEnum) type {
- return @typeInfo(Fields).Struct.fields[@enumToInt(field)].field_type;
+ return @typeInfo(Fields).Struct.fields[@enumToInt(field)].type;
}
pub fn sizeInBytes(self: Self) usize {
var off: usize = 0;
inline for (@typeInfo(Fields).Struct.fields) |field, i| {
- if (@sizeOf(field.field_type) == 0)
+ if (@sizeOf(field.type) == 0)
continue;
if ((self.bits & (1 << i)) != 0) {
- off = mem.alignForwardGeneric(usize, off, @alignOf(field.field_type));
- off += @sizeOf(field.field_type);
+ off = mem.alignForwardGeneric(usize, off, @alignOf(field.type));
+ off += @sizeOf(field.type);
}
}
return off;
diff --git a/lib/std/meta/trait.zig b/lib/std/meta/trait.zig
index 2e9c2165f7..73d1292406 100644
--- a/lib/std/meta/trait.zig
+++ b/lib/std/meta/trait.zig
@@ -566,7 +566,7 @@ pub fn hasUniqueRepresentation(comptime T: type) bool {
var sum_size = @as(usize, 0);
inline for (info.fields) |field| {
- const FieldType = field.field_type;
+ const FieldType = field.type;
if (comptime !hasUniqueRepresentation(FieldType)) return false;
sum_size += @sizeOf(FieldType);
}
diff --git a/lib/std/multi_array_list.zig b/lib/std/multi_array_list.zig
index e05b87c0be..38c8276b9a 100644
--- a/lib/std/multi_array_list.zig
+++ b/lib/std/multi_array_list.zig
@@ -84,9 +84,9 @@ pub fn MultiArrayList(comptime S: type) type {
var data: [fields.len]Data = undefined;
for (fields) |field_info, i| {
data[i] = .{
- .size = @sizeOf(field_info.field_type),
+ .size = @sizeOf(field_info.type),
.size_index = i,
- .alignment = if (@sizeOf(field_info.field_type) == 0) 1 else field_info.alignment,
+ .alignment = if (@sizeOf(field_info.type) == 0) 1 else field_info.alignment,
};
}
const Sort = struct {
@@ -294,10 +294,10 @@ pub fn MultiArrayList(comptime S: type) type {
) catch {
const self_slice = self.slice();
inline for (fields) |field_info, i| {
- if (@sizeOf(field_info.field_type) != 0) {
+ if (@sizeOf(field_info.type) != 0) {
const field = @intToEnum(Field, i);
const dest_slice = self_slice.items(field)[new_len..];
- const byte_count = dest_slice.len * @sizeOf(field_info.field_type);
+ const byte_count = dest_slice.len * @sizeOf(field_info.type);
// We use memset here for more efficient codegen in safety-checked,
// valgrind-enabled builds. Otherwise the valgrind client request
// will be repeated for every element.
@@ -316,9 +316,9 @@ pub fn MultiArrayList(comptime S: type) type {
const self_slice = self.slice();
const other_slice = other.slice();
inline for (fields) |field_info, i| {
- if (@sizeOf(field_info.field_type) != 0) {
+ if (@sizeOf(field_info.type) != 0) {
const field = @intToEnum(Field, i);
- mem.copy(field_info.field_type, other_slice.items(field), self_slice.items(field));
+ mem.copy(field_info.type, other_slice.items(field), self_slice.items(field));
}
}
gpa.free(self.allocatedBytes());
@@ -377,9 +377,9 @@ pub fn MultiArrayList(comptime S: type) type {
const self_slice = self.slice();
const other_slice = other.slice();
inline for (fields) |field_info, i| {
- if (@sizeOf(field_info.field_type) != 0) {
+ if (@sizeOf(field_info.type) != 0) {
const field = @intToEnum(Field, i);
- mem.copy(field_info.field_type, other_slice.items(field), self_slice.items(field));
+ mem.copy(field_info.type, other_slice.items(field), self_slice.items(field));
}
}
gpa.free(self.allocatedBytes());
@@ -396,9 +396,9 @@ pub fn MultiArrayList(comptime S: type) type {
const self_slice = self.slice();
const result_slice = result.slice();
inline for (fields) |field_info, i| {
- if (@sizeOf(field_info.field_type) != 0) {
+ if (@sizeOf(field_info.type) != 0) {
const field = @intToEnum(Field, i);
- mem.copy(field_info.field_type, result_slice.items(field), self_slice.items(field));
+ mem.copy(field_info.type, result_slice.items(field), self_slice.items(field));
}
}
return result;
@@ -413,10 +413,10 @@ pub fn MultiArrayList(comptime S: type) type {
pub fn swap(sc: @This(), a_index: usize, b_index: usize) void {
inline for (fields) |field_info, i| {
- if (@sizeOf(field_info.field_type) != 0) {
+ if (@sizeOf(field_info.type) != 0) {
const field = @intToEnum(Field, i);
const ptr = sc.slice.items(field);
- mem.swap(field_info.field_type, &ptr[a_index], &ptr[b_index]);
+ mem.swap(field_info.type, &ptr[a_index], &ptr[b_index]);
}
}
}
@@ -449,7 +449,7 @@ pub fn MultiArrayList(comptime S: type) type {
}
fn FieldType(comptime field: Field) type {
- return meta.fieldInfo(S, field).field_type;
+ return meta.fieldInfo(S, field).type;
}
/// This function is used in tools/zig-gdb.py to fetch the child type to facilitate
diff --git a/lib/std/os/uefi/protocols/device_path_protocol.zig b/lib/std/os/uefi/protocols/device_path_protocol.zig
index 338c9ea50d..6df6442fe6 100644
--- a/lib/std/os/uefi/protocols/device_path_protocol.zig
+++ b/lib/std/os/uefi/protocols/device_path_protocol.zig
@@ -81,7 +81,7 @@ pub const DevicePathProtocol = extern struct {
// Got the associated union type for self.type, now
// we need to initialize it and its subtype
if (self.type == enum_value) {
- var subtype = self.initSubtype(ufield.field_type);
+ var subtype = self.initSubtype(ufield.type);
if (subtype) |sb| {
// e.g. return .{ .Hardware = .{ .Pci = @ptrCast(...) } }
@@ -103,7 +103,7 @@ pub const DevicePathProtocol = extern struct {
if (self.subtype == tag_val) {
// e.g. expr = .{ .Pci = @ptrCast(...) }
- return @unionInit(TUnion, subtype.name, @ptrCast(subtype.field_type, self));
+ return @unionInit(TUnion, subtype.name, @ptrCast(subtype.type, self));
}
}
diff --git a/lib/std/testing.zig b/lib/std/testing.zig
index 72f3ba2d9e..53877967c9 100644
--- a/lib/std/testing.zig
+++ b/lib/std/testing.zig
@@ -802,7 +802,7 @@ pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime
const ArgsTuple = std.meta.ArgsTuple(@TypeOf(test_fn));
const fn_args_fields = @typeInfo(ArgsTuple).Struct.fields;
- if (fn_args_fields.len == 0 or fn_args_fields[0].field_type != std.mem.Allocator) {
+ if (fn_args_fields.len == 0 or fn_args_fields[0].type != std.mem.Allocator) {
@compileError("The provided function must have an " ++ @typeName(std.mem.Allocator) ++ " as its first argument");
}
const expected_args_tuple_len = fn_args_fields.len - 1;
diff --git a/lib/std/x/os/socket.zig b/lib/std/x/os/socket.zig
index 3de9359cc5..99782710cb 100644
--- a/lib/std/x/os/socket.zig
+++ b/lib/std/x/os/socket.zig
@@ -230,12 +230,12 @@ pub const Socket = struct {
pub fn setName(self: *Self, name: []const u8) void {
self.name = @ptrToInt(name.ptr);
- self.name_len = @intCast(meta.fieldInfo(Self, .name_len).field_type, name.len);
+ self.name_len = @intCast(meta.fieldInfo(Self, .name_len).type, name.len);
}
pub fn setBuffers(self: *Self, buffers: []const Buffer) void {
self.buffers = @ptrToInt(buffers.ptr);
- self.buffers_len = @intCast(meta.fieldInfo(Self, .buffers_len).field_type, buffers.len);
+ self.buffers_len = @intCast(meta.fieldInfo(Self, .buffers_len).type, buffers.len);
}
pub fn setControl(self: *Self, control: []const u8) void {
@@ -243,12 +243,12 @@ pub const Socket = struct {
self.control = Buffer.from(control);
} else {
self.control = @ptrToInt(control.ptr);
- self.control_len = @intCast(meta.fieldInfo(Self, .control_len).field_type, control.len);
+ self.control_len = @intCast(meta.fieldInfo(Self, .control_len).type, control.len);
}
}
pub fn setFlags(self: *Self, flags: u32) void {
- self.flags = @intCast(meta.fieldInfo(Self, .flags).field_type, flags);
+ self.flags = @intCast(meta.fieldInfo(Self, .flags).type, flags);
}
pub fn getName(self: Self) []const u8 {
diff --git a/lib/std/zig/Ast.zig b/lib/std/zig/Ast.zig
index 159b4dbb3a..eda0ee09da 100644
--- a/lib/std/zig/Ast.zig
+++ b/lib/std/zig/Ast.zig
@@ -125,7 +125,7 @@ pub fn extraData(tree: Ast, index: usize, comptime T: type) T {
const fields = std.meta.fields(T);
var result: T = undefined;
inline for (fields) |field, i| {
- comptime assert(field.field_type == Node.Index);
+ comptime assert(field.type == Node.Index);
@field(result, field.name) = tree.extra_data[index + i];
}
return result;
diff --git a/lib/std/zig/c_translation.zig b/lib/std/zig/c_translation.zig
index aa9d59dae9..a050e592a2 100644
--- a/lib/std/zig/c_translation.zig
+++ b/lib/std/zig/c_translation.zig
@@ -50,7 +50,7 @@ pub fn cast(comptime DestType: type, target: anytype) DestType {
},
.Union => |info| {
inline for (info.fields) |field| {
- if (field.field_type == SourceType) return @unionInit(DestType, field.name, target);
+ if (field.type == SourceType) return @unionInit(DestType, field.name, target);
}
@compileError("cast to union type '" ++ @typeName(DestType) ++ "' from type '" ++ @typeName(SourceType) ++ "' which is not present in union");
},
diff --git a/lib/std/zig/parse.zig b/lib/std/zig/parse.zig
index 0155cf0d75..205b094e93 100644
--- a/lib/std/zig/parse.zig
+++ b/lib/std/zig/parse.zig
@@ -153,7 +153,7 @@ const Parser = struct {
try p.extra_data.ensureUnusedCapacity(p.gpa, fields.len);
const result = @intCast(u32, p.extra_data.items.len);
inline for (fields) |field| {
- comptime assert(field.field_type == Node.Index);
+ comptime assert(field.type == Node.Index);
p.extra_data.appendAssumeCapacity(@field(extra, field.name));
}
return result;