authorgravatar for me@tadeo.caTadeo Kondrak <me@tadeo.ca> 2020-04-30 04:30:01-06:00
committergravatar for me@tadeo.caTadeo Kondrak <me@tadeo.ca> 2020-05-02 14:39:31-06:00
log647901b4a82dbb89656c620d4d4a89869fdf1fa0
tree19b297cc713d1ea63d64d4d42130f78d375d269f
parentca6db2d008cf3e0e3700e84400bd3d6e259e3c0f
signaturelock-open Commit is signed but in an unrecognized format.

Constify TypeInfo


2 files changed, 15 insertions(+), 15 deletions(-)

lib/std/builtin.zig+9-9
......@@ -235,8 +235,8 @@ pub const TypeInfo = union(enum) {
235235 /// therefore must be kept in sync with the compiler implementation.
236236 pub const Struct = struct {
237237 layout: ContainerLayout,
238 fields: []StructField,
239 decls: []Declaration,
238 fields: []const StructField,
239 decls: []const Declaration,
240240 };
241241
242242 /// This data structure is used by the Zig language code generation and
......@@ -261,7 +261,7 @@ pub const TypeInfo = union(enum) {
261261
262262 /// This data structure is used by the Zig language code generation and
263263 /// therefore must be kept in sync with the compiler implementation.
264 pub const ErrorSet = ?[]Error;
264 pub const ErrorSet = ?[]const Error;
265265
266266 /// This data structure is used by the Zig language code generation and
267267 /// therefore must be kept in sync with the compiler implementation.
......@@ -275,8 +275,8 @@ pub const TypeInfo = union(enum) {
275275 pub const Enum = struct {
276276 layout: ContainerLayout,
277277 tag_type: type,
278 fields: []EnumField,
279 decls: []Declaration,
278 fields: []const EnumField,
279 decls: []const Declaration,
280280 is_exhaustive: bool,
281281 };
282282
......@@ -293,8 +293,8 @@ pub const TypeInfo = union(enum) {
293293 pub const Union = struct {
294294 layout: ContainerLayout,
295295 tag_type: ?type,
296 fields: []UnionField,
297 decls: []Declaration,
296 fields: []const UnionField,
297 decls: []const Declaration,
298298 };
299299
300300 /// This data structure is used by the Zig language code generation and
......@@ -312,7 +312,7 @@ pub const TypeInfo = union(enum) {
312312 is_generic: bool,
313313 is_var_args: bool,
314314 return_type: ?type,
315 args: []FnArg,
315 args: []const FnArg,
316316 };
317317
318318 /// This data structure is used by the Zig language code generation and
......@@ -358,7 +358,7 @@ pub const TypeInfo = union(enum) {
358358 is_export: bool,
359359 lib_name: ?[]const u8,
360360 return_type: type,
361 arg_names: [][]const u8,
361 arg_names: []const []const u8,
362362
363363 /// This data structure is used by the Zig language code generation and
364364 /// therefore must be kept in sync with the compiler implementation.
lib/std/meta.zig+6-6
......@@ -219,7 +219,7 @@ test "std.meta.containerLayout" {
219219 testing.expect(containerLayout(U3) == .Extern);
220220}
221221
222pub fn declarations(comptime T: type) []TypeInfo.Declaration {
222pub fn declarations(comptime T: type) []const TypeInfo.Declaration {
223223 return switch (@typeInfo(T)) {
224224 .Struct => |info| info.decls,
225225 .Enum => |info| info.decls,
......@@ -243,7 +243,7 @@ test "std.meta.declarations" {
243243 fn a() void {}
244244 };
245245
246 const decls = comptime [_][]TypeInfo.Declaration{
246 const decls = comptime [_][]const TypeInfo.Declaration{
247247 declarations(E1),
248248 declarations(S1),
249249 declarations(U1),
......@@ -292,10 +292,10 @@ test "std.meta.declarationInfo" {
292292}
293293
294294pub fn fields(comptime T: type) switch (@typeInfo(T)) {
295 .Struct => []TypeInfo.StructField,
296 .Union => []TypeInfo.UnionField,
297 .ErrorSet => []TypeInfo.Error,
298 .Enum => []TypeInfo.EnumField,
295 .Struct => []const TypeInfo.StructField,
296 .Union => []const TypeInfo.UnionField,
297 .ErrorSet => []const TypeInfo.Error,
298 .Enum => []const TypeInfo.EnumField,
299299 else => @compileError("Expected struct, union, error set or enum type, found '" ++ @typeName(T) ++ "'"),
300300} {
301301 return switch (@typeInfo(T)) {