authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-01-15 17:53:05+00:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-01-16 12:46:29+00:00
logd00e05f18609921c1a051a637c24e47cfa304243
treeddeaafcc089671286dff4a7722667fb1e13dba53
parentaf6bad46cd132113e7b8497829a660a79e101742
signaturelock-open Commit is signed but in an unrecognized format.

all: update to `std.builtin.Type.Pointer.Size` field renames

This was done by regex substitution with `sed`. I then manually went over the entire diff and fixed any incorrect changes. This diff also changes a lot of `callconv(.C)` to `callconv(.c)`, since my regex happened to also trigger here. I opted to leave these changes in, since they *are* a correct migration, even if they're not the one I was trying to do!

74 files changed, 576 insertions(+), 581 deletions(-)

lib/std/Build/Step/ConfigHeader.zig+2-2
......@@ -144,13 +144,13 @@ fn putValue(config_header: *ConfigHeader, field_name: []const u8, comptime T: ty
144144 .pointer => |ptr| {
145145 switch (@typeInfo(ptr.child)) {
146146 .array => |array| {
147 if (ptr.size == .One and array.child == u8) {
147 if (ptr.size == .one and array.child == u8) {
148148 try config_header.values.put(field_name, .{ .string = v });
149149 return;
150150 }
151151 },
152152 .int => {
153 if (ptr.size == .Slice and ptr.child == u8) {
153 if (ptr.size == .slice and ptr.child == u8) {
154154 try config_header.values.put(field_name, .{ .string = v });
155155 return;
156156 }
lib/std/Build/Step/Options.zig+1-1
......@@ -172,7 +172,7 @@ fn printType(options: *Options, out: anytype, comptime T: type, value: T, indent
172172 return;
173173 },
174174 .pointer => |p| {
175 if (p.size != .Slice) {
175 if (p.size != .slice) {
176176 @compileError("Non-slice pointers are not yet supported in build options");
177177 }
178178
lib/std/Progress.zig+1-1
......@@ -1366,7 +1366,7 @@ fn maybeUpdateSize(resize_flag: bool) void {
13661366 }
13671367}
13681368
1369fn handleSigWinch(sig: i32, info: *const posix.siginfo_t, ctx_ptr: ?*anyopaque) callconv(.C) void {
1369fn handleSigWinch(sig: i32, info: *const posix.siginfo_t, ctx_ptr: ?*anyopaque) callconv(.c) void {
13701370 _ = info;
13711371 _ = ctx_ptr;
13721372 assert(sig == posix.SIG.WINCH);
lib/std/Random.zig+1-1
......@@ -35,7 +35,7 @@ fillFn: *const fn (ptr: *anyopaque, buf: []u8) void,
3535pub fn init(pointer: anytype, comptime fillFn: fn (ptr: @TypeOf(pointer), buf: []u8) void) Random {
3636 const Ptr = @TypeOf(pointer);
3737 assert(@typeInfo(Ptr) == .pointer); // Must be a pointer
38 assert(@typeInfo(Ptr).pointer.size == .One); // Must be a single-item pointer
38 assert(@typeInfo(Ptr).pointer.size == .one); // Must be a single-item pointer
3939 assert(@typeInfo(@typeInfo(Ptr).pointer.child) == .@"struct"); // Must point to a struct
4040 const gen = struct {
4141 fn fill(ptr: *anyopaque, buf: []u8) void {
lib/std/c.zig+31-31
......@@ -2733,8 +2733,8 @@ pub const Sigaction = switch (native_os) {
27332733 => if (builtin.target.isMusl())
27342734 linux.Sigaction
27352735 else if (builtin.target.ptrBitWidth() == 64) extern struct {
2736 pub const handler_fn = *align(1) const fn (i32) callconv(.C) void;
2737 pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.C) void;
2736 pub const handler_fn = *align(1) const fn (i32) callconv(.c) void;
2737 pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.c) void;
27382738
27392739 flags: c_uint,
27402740 handler: extern union {
......@@ -2742,10 +2742,10 @@ pub const Sigaction = switch (native_os) {
27422742 sigaction: ?sigaction_fn,
27432743 },
27442744 mask: sigset_t,
2745 restorer: ?*const fn () callconv(.C) void = null,
2745 restorer: ?*const fn () callconv(.c) void = null,
27462746 } else extern struct {
2747 pub const handler_fn = *align(1) const fn (i32) callconv(.C) void;
2748 pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.C) void;
2747 pub const handler_fn = *align(1) const fn (i32) callconv(.c) void;
2748 pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.c) void;
27492749
27502750 flags: c_uint,
27512751 handler: extern union {
......@@ -2753,12 +2753,12 @@ pub const Sigaction = switch (native_os) {
27532753 sigaction: ?sigaction_fn,
27542754 },
27552755 mask: sigset_t,
2756 restorer: ?*const fn () callconv(.C) void = null,
2756 restorer: ?*const fn () callconv(.c) void = null,
27572757 __resv: [1]c_int = .{0},
27582758 },
27592759 .s390x => if (builtin.abi == .gnu) extern struct {
2760 pub const handler_fn = *align(1) const fn (i32) callconv(.C) void;
2761 pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.C) void;
2760 pub const handler_fn = *align(1) const fn (i32) callconv(.c) void;
2761 pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.c) void;
27622762
27632763 handler: extern union {
27642764 handler: ?handler_fn,
......@@ -2766,15 +2766,15 @@ pub const Sigaction = switch (native_os) {
27662766 },
27672767 __glibc_reserved0: c_int = 0,
27682768 flags: c_uint,
2769 restorer: ?*const fn () callconv(.C) void = null,
2769 restorer: ?*const fn () callconv(.c) void = null,
27702770 mask: sigset_t,
27712771 } else linux.Sigaction,
27722772 else => linux.Sigaction,
27732773 },
27742774 .emscripten => emscripten.Sigaction,
27752775 .netbsd, .macos, .ios, .tvos, .watchos, .visionos => extern struct {
2776 pub const handler_fn = *align(1) const fn (i32) callconv(.C) void;
2777 pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.C) void;
2776 pub const handler_fn = *align(1) const fn (i32) callconv(.c) void;
2777 pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.c) void;
27782778
27792779 handler: extern union {
27802780 handler: ?handler_fn,
......@@ -2784,8 +2784,8 @@ pub const Sigaction = switch (native_os) {
27842784 flags: c_uint,
27852785 },
27862786 .dragonfly, .freebsd => extern struct {
2787 pub const handler_fn = *align(1) const fn (i32) callconv(.C) void;
2788 pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.C) void;
2787 pub const handler_fn = *align(1) const fn (i32) callconv(.c) void;
2788 pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.c) void;
27892789
27902790 /// signal handler
27912791 handler: extern union {
......@@ -2798,8 +2798,8 @@ pub const Sigaction = switch (native_os) {
27982798 mask: sigset_t,
27992799 },
28002800 .solaris, .illumos => extern struct {
2801 pub const handler_fn = *align(1) const fn (i32) callconv(.C) void;
2802 pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.C) void;
2801 pub const handler_fn = *align(1) const fn (i32) callconv(.c) void;
2802 pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.c) void;
28032803
28042804 /// signal options
28052805 flags: c_uint,
......@@ -2812,8 +2812,8 @@ pub const Sigaction = switch (native_os) {
28122812 mask: sigset_t,
28132813 },
28142814 .haiku => extern struct {
2815 pub const handler_fn = *align(1) const fn (i32) callconv(.C) void;
2816 pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.C) void;
2815 pub const handler_fn = *align(1) const fn (i32) callconv(.c) void;
2816 pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.c) void;
28172817
28182818 /// signal handler
28192819 handler: extern union {
......@@ -2831,8 +2831,8 @@ pub const Sigaction = switch (native_os) {
28312831 userdata: *allowzero anyopaque = undefined,
28322832 },
28332833 .openbsd => extern struct {
2834 pub const handler_fn = *align(1) const fn (i32) callconv(.C) void;
2835 pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.C) void;
2834 pub const handler_fn = *align(1) const fn (i32) callconv(.c) void;
2835 pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.c) void;
28362836
28372837 /// signal handler
28382838 handler: extern union {
......@@ -6410,7 +6410,7 @@ pub const EAI = switch (native_os) {
64106410 else => void,
64116411};
64126412
6413pub const dl_iterate_phdr_callback = *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int;
6413pub const dl_iterate_phdr_callback = *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.c) c_int;
64146414
64156415pub const Stat = switch (native_os) {
64166416 .linux => switch (native_arch) {
......@@ -9396,7 +9396,7 @@ pub extern "c" fn futimens(fd: fd_t, times: *const [2]timespec) c_int;
93969396pub extern "c" fn pthread_create(
93979397 noalias newthread: *pthread_t,
93989398 noalias attr: ?*const pthread_attr_t,
9399 start_routine: *const fn (?*anyopaque) callconv(.C) ?*anyopaque,
9399 start_routine: *const fn (?*anyopaque) callconv(.c) ?*anyopaque,
94009400 noalias arg: ?*anyopaque,
94019401) E;
94029402pub extern "c" fn pthread_attr_init(attr: *pthread_attr_t) E;
......@@ -9408,13 +9408,13 @@ pub extern "c" fn pthread_self() pthread_t;
94089408pub extern "c" fn pthread_join(thread: pthread_t, arg_return: ?*?*anyopaque) E;
94099409pub extern "c" fn pthread_detach(thread: pthread_t) E;
94109410pub extern "c" fn pthread_atfork(
9411 prepare: ?*const fn () callconv(.C) void,
9412 parent: ?*const fn () callconv(.C) void,
9413 child: ?*const fn () callconv(.C) void,
9411 prepare: ?*const fn () callconv(.c) void,
9412 parent: ?*const fn () callconv(.c) void,
9413 child: ?*const fn () callconv(.c) void,
94149414) c_int;
94159415pub extern "c" fn pthread_key_create(
94169416 key: *pthread_key_t,
9417 destructor: ?*const fn (value: *anyopaque) callconv(.C) void,
9417 destructor: ?*const fn (value: *anyopaque) callconv(.c) void,
94189418) E;
94199419pub extern "c" fn pthread_key_delete(key: pthread_key_t) E;
94209420pub extern "c" fn pthread_getspecific(key: pthread_key_t) ?*anyopaque;
......@@ -9530,12 +9530,12 @@ pub extern "c" fn pthread_cond_signal(cond: *pthread_cond_t) E;
95309530pub extern "c" fn pthread_cond_broadcast(cond: *pthread_cond_t) E;
95319531pub extern "c" fn pthread_cond_destroy(cond: *pthread_cond_t) E;
95329532
9533pub extern "c" fn pthread_rwlock_destroy(rwl: *pthread_rwlock_t) callconv(.C) E;
9534pub extern "c" fn pthread_rwlock_rdlock(rwl: *pthread_rwlock_t) callconv(.C) E;
9535pub extern "c" fn pthread_rwlock_wrlock(rwl: *pthread_rwlock_t) callconv(.C) E;
9536pub extern "c" fn pthread_rwlock_tryrdlock(rwl: *pthread_rwlock_t) callconv(.C) E;
9537pub extern "c" fn pthread_rwlock_trywrlock(rwl: *pthread_rwlock_t) callconv(.C) E;
9538pub extern "c" fn pthread_rwlock_unlock(rwl: *pthread_rwlock_t) callconv(.C) E;
9533pub extern "c" fn pthread_rwlock_destroy(rwl: *pthread_rwlock_t) callconv(.c) E;
9534pub extern "c" fn pthread_rwlock_rdlock(rwl: *pthread_rwlock_t) callconv(.c) E;
9535pub extern "c" fn pthread_rwlock_wrlock(rwl: *pthread_rwlock_t) callconv(.c) E;
9536pub extern "c" fn pthread_rwlock_tryrdlock(rwl: *pthread_rwlock_t) callconv(.c) E;
9537pub extern "c" fn pthread_rwlock_trywrlock(rwl: *pthread_rwlock_t) callconv(.c) E;
9538pub extern "c" fn pthread_rwlock_unlock(rwl: *pthread_rwlock_t) callconv(.c) E;
95399539
95409540pub const pthread_t = *opaque {};
95419541pub const FILE = opaque {};
lib/std/c/darwin.zig+2-2
......@@ -379,7 +379,7 @@ pub const MACH_MSG_TYPE = enum(mach_msg_type_name_t) {
379379};
380380
381381extern "c" var mach_task_self_: mach_port_t;
382pub fn mach_task_self() callconv(.C) mach_port_t {
382pub fn mach_task_self() callconv(.c) mach_port_t {
383383 return mach_task_self_;
384384}
385385
......@@ -873,7 +873,7 @@ pub const DISPATCH_TIME_FOREVER = ~@as(dispatch_time_t, 0);
873873pub extern "c" fn dispatch_time(when: dispatch_time_t, delta: i64) dispatch_time_t;
874874
875875const dispatch_once_t = usize;
876const dispatch_function_t = fn (?*anyopaque) callconv(.C) void;
876const dispatch_function_t = fn (?*anyopaque) callconv(.c) void;
877877pub extern fn dispatch_once_f(
878878 predicate: *dispatch_once_t,
879879 context: ?*anyopaque,
lib/std/c/dragonfly.zig+1-1
......@@ -156,7 +156,7 @@ pub const E = enum(u16) {
156156
157157pub const BADSIG = SIG.ERR;
158158
159pub const sig_t = *const fn (i32) callconv(.C) void;
159pub const sig_t = *const fn (i32) callconv(.c) void;
160160
161161pub const cmsghdr = extern struct {
162162 len: socklen_t,
lib/std/crypto/tlcsprng.zig+1-1
......@@ -133,7 +133,7 @@ fn setupPthreadAtforkAndFill(buffer: []u8) void {
133133 return initAndFill(buffer);
134134}
135135
136fn childAtForkHandler() callconv(.C) void {
136fn childAtForkHandler() callconv(.c) void {
137137 // The atfork handler is global, this function may be called after
138138 // fork()-ing threads that never initialized the CSPRNG context.
139139 if (wipe_mem.len == 0) return;
lib/std/debug.zig+1-1
......@@ -1269,7 +1269,7 @@ fn resetSegfaultHandler() void {
12691269 updateSegfaultHandler(&act);
12701270}
12711271
1272fn handleSegfaultPosix(sig: i32, info: *const posix.siginfo_t, ctx_ptr: ?*anyopaque) callconv(.C) noreturn {
1272fn handleSegfaultPosix(sig: i32, info: *const posix.siginfo_t, ctx_ptr: ?*anyopaque) callconv(.c) noreturn {
12731273 // Reset to the default handler so that if a segfault happens in this handler it will crash
12741274 // the process. Also when this handler returns, the original instruction will be repeated
12751275 // and the resulting segfault will crash the process rather than continually dump stack traces.
lib/std/fmt.zig+7-7
......@@ -434,7 +434,7 @@ pub fn formatAddress(value: anytype, options: FormatOptions, writer: anytype) @T
434434 switch (@typeInfo(T)) {
435435 .pointer => |info| {
436436 try writer.writeAll(@typeName(info.child) ++ "@");
437 if (info.size == .Slice)
437 if (info.size == .slice)
438438 try formatInt(@intFromPtr(value.ptr), 16, .lower, FormatOptions{}, writer)
439439 else
440440 try formatInt(@intFromPtr(value), 16, .lower, FormatOptions{}, writer);
......@@ -460,12 +460,12 @@ pub fn defaultSpec(comptime T: type) [:0]const u8 {
460460 switch (@typeInfo(T)) {
461461 .array, .vector => return ANY,
462462 .pointer => |ptr_info| switch (ptr_info.size) {
463 .One => switch (@typeInfo(ptr_info.child)) {
463 .one => switch (@typeInfo(ptr_info.child)) {
464464 .array => return ANY,
465465 else => {},
466466 },
467 .Many, .C => return "*",
468 .Slice => return ANY,
467 .many, .c => return "*",
468 .slice => return ANY,
469469 },
470470 .optional => |info| return "?" ++ defaultSpec(info.child),
471471 .error_union => |info| return "!" ++ defaultSpec(info.payload),
......@@ -624,13 +624,13 @@ pub fn formatType(
624624 try writer.writeAll(" }");
625625 },
626626 .pointer => |ptr_info| switch (ptr_info.size) {
627 .One => switch (@typeInfo(ptr_info.child)) {
627 .one => switch (@typeInfo(ptr_info.child)) {
628628 .array, .@"enum", .@"union", .@"struct" => {
629629 return formatType(value.*, actual_fmt, options, writer, max_depth);
630630 },
631631 else => return format(writer, "{s}@{x}", .{ @typeName(ptr_info.child), @intFromPtr(value) }),
632632 },
633 .Many, .C => {
633 .many, .c => {
634634 if (actual_fmt.len == 0)
635635 @compileError("cannot format pointer without a specifier (i.e. {s} or {*})");
636636 if (ptr_info.sentinel) |_| {
......@@ -641,7 +641,7 @@ pub fn formatType(
641641 }
642642 invalidFmtError(fmt, value);
643643 },
644 .Slice => {
644 .slice => {
645645 if (actual_fmt.len == 0)
646646 @compileError("cannot format slice without a specifier (i.e. {s} or {any})");
647647 if (max_depth == 0) {
lib/std/hash/auto_hash.zig+5-5
......@@ -23,13 +23,13 @@ pub fn hashPointer(hasher: anytype, key: anytype, comptime strat: HashStrategy)
2323 const info = @typeInfo(@TypeOf(key));
2424
2525 switch (info.pointer.size) {
26 .One => switch (strat) {
26 .one => switch (strat) {
2727 .Shallow => hash(hasher, @intFromPtr(key), .Shallow),
2828 .Deep => hash(hasher, key.*, .Shallow),
2929 .DeepRecursive => hash(hasher, key.*, .DeepRecursive),
3030 },
3131
32 .Slice => {
32 .slice => {
3333 switch (strat) {
3434 .Shallow => {
3535 hashPointer(hasher, key.ptr, .Shallow);
......@@ -40,8 +40,8 @@ pub fn hashPointer(hasher: anytype, key: anytype, comptime strat: HashStrategy)
4040 hash(hasher, key.len, .Shallow);
4141 },
4242
43 .Many,
44 .C,
43 .many,
44 .c,
4545 => switch (strat) {
4646 .Shallow => hash(hasher, @intFromPtr(key), .Shallow),
4747 else => @compileError(
......@@ -167,7 +167,7 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void {
167167
168168inline fn typeContainsSlice(comptime K: type) bool {
169169 return switch (@typeInfo(K)) {
170 .pointer => |info| info.size == .Slice,
170 .pointer => |info| info.size == .slice,
171171
172172 inline .@"struct", .@"union" => |info| {
173173 inline for (info.fields) |field| {
lib/std/io/fixed_buffer_stream.zig+3-3
......@@ -118,14 +118,14 @@ fn Slice(comptime T: type) type {
118118 .pointer => |ptr_info| {
119119 var new_ptr_info = ptr_info;
120120 switch (ptr_info.size) {
121 .Slice => {},
122 .One => switch (@typeInfo(ptr_info.child)) {
121 .slice => {},
122 .one => switch (@typeInfo(ptr_info.child)) {
123123 .array => |info| new_ptr_info.child = info.child,
124124 else => @compileError("invalid type given to fixedBufferStream"),
125125 },
126126 else => @compileError("invalid type given to fixedBufferStream"),
127127 }
128 new_ptr_info.size = .Slice;
128 new_ptr_info.size = .slice;
129129 return @Type(.{ .pointer = new_ptr_info });
130130 },
131131 else => @compileError("invalid type given to fixedBufferStream"),
lib/std/json/static.zig+4-4
......@@ -451,12 +451,12 @@ pub fn innerParse(
451451
452452 .pointer => |ptrInfo| {
453453 switch (ptrInfo.size) {
454 .One => {
454 .one => {
455455 const r: *ptrInfo.child = try allocator.create(ptrInfo.child);
456456 r.* = try innerParse(ptrInfo.child, allocator, source, options);
457457 return r;
458458 },
459 .Slice => {
459 .slice => {
460460 switch (try source.peekNextTokenType()) {
461461 .array_begin => {
462462 _ = try source.next();
......@@ -706,12 +706,12 @@ pub fn innerParseFromValue(
706706
707707 .pointer => |ptrInfo| {
708708 switch (ptrInfo.size) {
709 .One => {
709 .one => {
710710 const r: *ptrInfo.child = try allocator.create(ptrInfo.child);
711711 r.* = try innerParseFromValue(ptrInfo.child, allocator, source, options);
712712 return r;
713713 },
714 .Slice => {
714 .slice => {
715715 switch (source) {
716716 .array => |array| {
717717 const r = if (ptrInfo.sentinel) |sentinel_ptr|
lib/std/json/stringify.zig+4-4
......@@ -631,7 +631,7 @@ pub fn WriteStream(
631631 },
632632 .error_set => return self.stringValue(@errorName(value)),
633633 .pointer => |ptr_info| switch (ptr_info.size) {
634 .One => switch (@typeInfo(ptr_info.child)) {
634 .one => switch (@typeInfo(ptr_info.child)) {
635635 .array => {
636636 // Coerce `*[N]T` to `[]const T`.
637637 const Slice = []const std.meta.Elem(ptr_info.child);
......@@ -641,10 +641,10 @@ pub fn WriteStream(
641641 return self.write(value.*);
642642 },
643643 },
644 .Many, .Slice => {
645 if (ptr_info.size == .Many and ptr_info.sentinel == null)
644 .many, .slice => {
645 if (ptr_info.size == .many and ptr_info.sentinel == null)
646646 @compileError("unable to stringify type '" ++ @typeName(T) ++ "' without sentinel");
647 const slice = if (ptr_info.size == .Many) std.mem.span(value) else value;
647 const slice = if (ptr_info.size == .many) std.mem.span(value) else value;
648648
649649 if (ptr_info.child == u8) {
650650 // This is a []const u8, or some similar Zig string.
lib/std/mem.zig+31-31
......@@ -262,7 +262,7 @@ pub fn zeroes(comptime T: type) T {
262262 },
263263 .pointer => |ptr_info| {
264264 switch (ptr_info.size) {
265 .Slice => {
265 .slice => {
266266 if (ptr_info.sentinel) |sentinel| {
267267 if (ptr_info.child == u8 and @as(*const u8, @ptrCast(sentinel)).* == 0) {
268268 return ""; // A special case for the most common use-case: null-terminated strings.
......@@ -272,10 +272,10 @@ pub fn zeroes(comptime T: type) T {
272272 return &[_]ptr_info.child{};
273273 }
274274 },
275 .C => {
275 .c => {
276276 return null;
277277 },
278 .One, .Many => {
278 .one, .many => {
279279 if (ptr_info.is_allowzero) return @ptrFromInt(0);
280280 @compileError("Only nullable and allowzero pointers can be set to zero.");
281281 },
......@@ -781,14 +781,14 @@ fn Span(comptime T: type) type {
781781 .pointer => |ptr_info| {
782782 var new_ptr_info = ptr_info;
783783 switch (ptr_info.size) {
784 .C => {
784 .c => {
785785 new_ptr_info.sentinel = &@as(ptr_info.child, 0);
786786 new_ptr_info.is_allowzero = false;
787787 },
788 .Many => if (ptr_info.sentinel == null) @compileError("invalid type given to std.mem.span: " ++ @typeName(T)),
789 .One, .Slice => @compileError("invalid type given to std.mem.span: " ++ @typeName(T)),
788 .many => if (ptr_info.sentinel == null) @compileError("invalid type given to std.mem.span: " ++ @typeName(T)),
789 .one, .slice => @compileError("invalid type given to std.mem.span: " ++ @typeName(T)),
790790 }
791 new_ptr_info.size = .Slice;
791 new_ptr_info.size = .slice;
792792 return @Type(.{ .pointer = new_ptr_info });
793793 },
794794 else => {},
......@@ -845,9 +845,9 @@ fn SliceTo(comptime T: type, comptime end: std.meta.Elem(T)) type {
845845 },
846846 .pointer => |ptr_info| {
847847 var new_ptr_info = ptr_info;
848 new_ptr_info.size = .Slice;
848 new_ptr_info.size = .slice;
849849 switch (ptr_info.size) {
850 .One => switch (@typeInfo(ptr_info.child)) {
850 .one => switch (@typeInfo(ptr_info.child)) {
851851 .array => |array_info| {
852852 new_ptr_info.child = array_info.child;
853853 // The return type must only be sentinel terminated if we are guaranteed
......@@ -864,7 +864,7 @@ fn SliceTo(comptime T: type, comptime end: std.meta.Elem(T)) type {
864864 },
865865 else => {},
866866 },
867 .Many, .Slice => {
867 .many, .slice => {
868868 // The return type must only be sentinel terminated if we are guaranteed
869869 // to find the value searched for, which is only the case if it matches
870870 // the sentinel of the type passed.
......@@ -877,7 +877,7 @@ fn SliceTo(comptime T: type, comptime end: std.meta.Elem(T)) type {
877877 }
878878 }
879879 },
880 .C => {
880 .c => {
881881 new_ptr_info.sentinel = &end;
882882 // C pointers are always allowzero, but we don't want the return type to be.
883883 assert(new_ptr_info.is_allowzero);
......@@ -957,7 +957,7 @@ test sliceTo {
957957fn lenSliceTo(ptr: anytype, comptime end: std.meta.Elem(@TypeOf(ptr))) usize {
958958 switch (@typeInfo(@TypeOf(ptr))) {
959959 .pointer => |ptr_info| switch (ptr_info.size) {
960 .One => switch (@typeInfo(ptr_info.child)) {
960 .one => switch (@typeInfo(ptr_info.child)) {
961961 .array => |array_info| {
962962 if (array_info.sentinel) |sentinel_ptr| {
963963 const sentinel = @as(*align(1) const array_info.child, @ptrCast(sentinel_ptr)).*;
......@@ -969,7 +969,7 @@ fn lenSliceTo(ptr: anytype, comptime end: std.meta.Elem(@TypeOf(ptr))) usize {
969969 },
970970 else => {},
971971 },
972 .Many => if (ptr_info.sentinel) |sentinel_ptr| {
972 .many => if (ptr_info.sentinel) |sentinel_ptr| {
973973 const sentinel = @as(*align(1) const ptr_info.child, @ptrCast(sentinel_ptr)).*;
974974 if (sentinel == end) {
975975 return indexOfSentinel(ptr_info.child, end, ptr);
......@@ -981,11 +981,11 @@ fn lenSliceTo(ptr: anytype, comptime end: std.meta.Elem(@TypeOf(ptr))) usize {
981981 while (ptr[i] != end and ptr[i] != sentinel) i += 1;
982982 return i;
983983 },
984 .C => {
984 .c => {
985985 assert(ptr != null);
986986 return indexOfSentinel(ptr_info.child, end, ptr);
987987 },
988 .Slice => {
988 .slice => {
989989 if (ptr_info.sentinel) |sentinel_ptr| {
990990 const sentinel = @as(*align(1) const ptr_info.child, @ptrCast(sentinel_ptr)).*;
991991 if (sentinel == end) {
......@@ -1039,13 +1039,13 @@ test lenSliceTo {
10391039pub fn len(value: anytype) usize {
10401040 switch (@typeInfo(@TypeOf(value))) {
10411041 .pointer => |info| switch (info.size) {
1042 .Many => {
1042 .many => {
10431043 const sentinel_ptr = info.sentinel orelse
10441044 @compileError("invalid type given to std.mem.len: " ++ @typeName(@TypeOf(value)));
10451045 const sentinel = @as(*align(1) const info.child, @ptrCast(sentinel_ptr)).*;
10461046 return indexOfSentinel(info.child, sentinel, value);
10471047 },
1048 .C => {
1048 .c => {
10491049 assert(value != null);
10501050 return indexOfSentinel(info.child, 0, value);
10511051 },
......@@ -3582,19 +3582,19 @@ fn ReverseIterator(comptime T: type) type {
35823582 const Pointer = blk: {
35833583 switch (@typeInfo(T)) {
35843584 .pointer => |ptr_info| switch (ptr_info.size) {
3585 .One => switch (@typeInfo(ptr_info.child)) {
3585 .one => switch (@typeInfo(ptr_info.child)) {
35863586 .array => |array_info| {
35873587 var new_ptr_info = ptr_info;
3588 new_ptr_info.size = .Many;
3588 new_ptr_info.size = .many;
35893589 new_ptr_info.child = array_info.child;
35903590 new_ptr_info.sentinel = array_info.sentinel;
35913591 break :blk @Type(.{ .pointer = new_ptr_info });
35923592 },
35933593 else => {},
35943594 },
3595 .Slice => {
3595 .slice => {
35963596 var new_ptr_info = ptr_info;
3597 new_ptr_info.size = .Many;
3597 new_ptr_info.size = .many;
35983598 break :blk @Type(.{ .pointer = new_ptr_info });
35993599 },
36003600 else => {},
......@@ -3606,7 +3606,7 @@ fn ReverseIterator(comptime T: type) type {
36063606 const Element = std.meta.Elem(Pointer);
36073607 const ElementPointer = @Type(.{ .pointer = ptr: {
36083608 var ptr = @typeInfo(Pointer).pointer;
3609 ptr.size = .One;
3609 ptr.size = .one;
36103610 ptr.child = Element;
36113611 ptr.sentinel = null;
36123612 break :ptr ptr;
......@@ -3912,7 +3912,7 @@ pub fn alignPointerOffset(ptr: anytype, align_to: usize) ?usize {
39123912
39133913 const T = @TypeOf(ptr);
39143914 const info = @typeInfo(T);
3915 if (info != .pointer or info.pointer.size != .Many)
3915 if (info != .pointer or info.pointer.size != .many)
39163916 @compileError("expected many item pointer, got " ++ @typeName(T));
39173917
39183918 // Do nothing if the pointer is already well-aligned.
......@@ -3986,9 +3986,9 @@ fn CopyPtrAttrs(
39863986
39873987fn AsBytesReturnType(comptime P: type) type {
39883988 const pointer = @typeInfo(P).pointer;
3989 assert(pointer.size == .One);
3989 assert(pointer.size == .one);
39903990 const size = @sizeOf(pointer.child);
3991 return CopyPtrAttrs(P, .One, [size]u8);
3991 return CopyPtrAttrs(P, .one, [size]u8);
39923992}
39933993
39943994/// Given a pointer to a single item, returns a slice of the underlying bytes, preserving pointer attributes.
......@@ -4071,7 +4071,7 @@ test toBytes {
40714071}
40724072
40734073fn BytesAsValueReturnType(comptime T: type, comptime B: type) type {
4074 return CopyPtrAttrs(B, .One, T);
4074 return CopyPtrAttrs(B, .one, T);
40754075}
40764076
40774077/// Given a pointer to an array of bytes, returns a pointer to a value of the specified type
......@@ -4150,7 +4150,7 @@ test bytesToValue {
41504150}
41514151
41524152fn BytesAsSliceReturnType(comptime T: type, comptime bytesType: type) type {
4153 return CopyPtrAttrs(bytesType, .Slice, T);
4153 return CopyPtrAttrs(bytesType, .slice, T);
41544154}
41554155
41564156/// Given a slice of bytes, returns a slice of the specified type
......@@ -4162,7 +4162,7 @@ pub fn bytesAsSlice(comptime T: type, bytes: anytype) BytesAsSliceReturnType(T,
41624162 return &[0]T{};
41634163 }
41644164
4165 const cast_target = CopyPtrAttrs(@TypeOf(bytes), .Many, T);
4165 const cast_target = CopyPtrAttrs(@TypeOf(bytes), .many, T);
41664166
41674167 return @as(cast_target, @ptrCast(bytes))[0..@divExact(bytes.len, @sizeOf(T))];
41684168}
......@@ -4237,7 +4237,7 @@ test "bytesAsSlice preserves pointer attributes" {
42374237}
42384238
42394239fn SliceAsBytesReturnType(comptime Slice: type) type {
4240 return CopyPtrAttrs(Slice, .Slice, u8);
4240 return CopyPtrAttrs(Slice, .slice, u8);
42414241}
42424242
42434243/// Given a slice, returns a slice of the underlying bytes, preserving pointer attributes.
......@@ -4251,7 +4251,7 @@ pub fn sliceAsBytes(slice: anytype) SliceAsBytesReturnType(@TypeOf(slice)) {
42514251 // it may be equal to zero and fail a null check
42524252 if (slice.len == 0 and std.meta.sentinel(Slice) == null) return &[0]u8{};
42534253
4254 const cast_target = CopyPtrAttrs(Slice, .Many, u8);
4254 const cast_target = CopyPtrAttrs(Slice, .many, u8);
42554255
42564256 return @as(cast_target, @ptrCast(slice))[0 .. slice.len * @sizeOf(std.meta.Elem(Slice))];
42574257}
......@@ -4540,7 +4540,7 @@ fn AlignedSlice(comptime AttributeSource: type, comptime new_alignment: usize) t
45404540 const info = @typeInfo(AttributeSource).pointer;
45414541 return @Type(.{
45424542 .pointer = .{
4543 .size = .Slice,
4543 .size = .slice,
45444544 .is_const = info.is_const,
45454545 .is_volatile = info.is_volatile,
45464546 .is_allowzero = info.is_allowzero,
lib/std/mem/Allocator.zig+1-1
......@@ -110,7 +110,7 @@ pub fn create(self: Allocator, comptime T: type) Error!*T {
110110/// have the same address and alignment property.
111111pub fn destroy(self: Allocator, ptr: anytype) void {
112112 const info = @typeInfo(@TypeOf(ptr)).pointer;
113 if (info.size != .One) @compileError("ptr must be a single item pointer");
113 if (info.size != .one) @compileError("ptr must be a single item pointer");
114114 const T = info.child;
115115 if (@sizeOf(T) == 0) return;
116116 const non_const_ptr = @as([*]u8, @ptrCast(@constCast(ptr)));
lib/std/meta.zig+15-15
......@@ -103,12 +103,12 @@ pub fn Elem(comptime T: type) type {
103103 .array => |info| return info.child,
104104 .vector => |info| return info.child,
105105 .pointer => |info| switch (info.size) {
106 .One => switch (@typeInfo(info.child)) {
106 .one => switch (@typeInfo(info.child)) {
107107 .array => |array_info| return array_info.child,
108108 .vector => |vector_info| return vector_info.child,
109109 else => {},
110110 },
111 .Many, .C, .Slice => return info.child,
111 .many, .c, .slice => return info.child,
112112 },
113113 .optional => |info| return Elem(info.child),
114114 else => {},
......@@ -138,11 +138,11 @@ pub inline fn sentinel(comptime T: type) ?Elem(T) {
138138 },
139139 .pointer => |info| {
140140 switch (info.size) {
141 .Many, .Slice => {
141 .many, .slice => {
142142 const sentinel_ptr = info.sentinel orelse return null;
143143 return @as(*align(1) const info.child, @ptrCast(sentinel_ptr)).*;
144144 },
145 .One => switch (@typeInfo(info.child)) {
145 .one => switch (@typeInfo(info.child)) {
146146 .array => |array_info| {
147147 const sentinel_ptr = array_info.sentinel orelse return null;
148148 return @as(*align(1) const array_info.child, @ptrCast(sentinel_ptr)).*;
......@@ -178,7 +178,7 @@ fn testSentinel() !void {
178178pub fn Sentinel(comptime T: type, comptime sentinel_val: Elem(T)) type {
179179 switch (@typeInfo(T)) {
180180 .pointer => |info| switch (info.size) {
181 .One => switch (@typeInfo(info.child)) {
181 .one => switch (@typeInfo(info.child)) {
182182 .array => |array_info| return @Type(.{
183183 .pointer = .{
184184 .size = info.size,
......@@ -199,7 +199,7 @@ pub fn Sentinel(comptime T: type, comptime sentinel_val: Elem(T)) type {
199199 }),
200200 else => {},
201201 },
202 .Many, .Slice => return @Type(.{
202 .many, .slice => return @Type(.{
203203 .pointer = .{
204204 .size = info.size,
205205 .is_const = info.is_const,
......@@ -215,7 +215,7 @@ pub fn Sentinel(comptime T: type, comptime sentinel_val: Elem(T)) type {
215215 },
216216 .optional => |info| switch (@typeInfo(info.child)) {
217217 .pointer => |ptr_info| switch (ptr_info.size) {
218 .Many => return @Type(.{
218 .many => return @Type(.{
219219 .optional = .{
220220 .child = @Type(.{
221221 .pointer = .{
......@@ -786,8 +786,8 @@ pub fn eql(a: anytype, b: @TypeOf(a)) bool {
786786 },
787787 .pointer => |info| {
788788 return switch (info.size) {
789 .One, .Many, .C => a == b,
790 .Slice => a.ptr == b.ptr and a.len == b.len,
789 .one, .many, .c => a == b,
790 .slice => a.ptr == b.ptr and a.len == b.len,
791791 };
792792 },
793793 .optional => {
......@@ -1090,7 +1090,7 @@ test "Tuple deduplication" {
10901090test "ArgsTuple forwarding" {
10911091 const T1 = std.meta.Tuple(&.{ u32, f32, i8 });
10921092 const T2 = std.meta.ArgsTuple(fn (u32, f32, i8) void);
1093 const T3 = std.meta.ArgsTuple(fn (u32, f32, i8) callconv(.C) noreturn);
1093 const T3 = std.meta.ArgsTuple(fn (u32, f32, i8) callconv(.c) noreturn);
10941094
10951095 if (T1 != T2) {
10961096 @compileError("std.meta.ArgsTuple produces different types than std.meta.Tuple");
......@@ -1144,8 +1144,8 @@ test hasFn {
11441144pub inline fn hasMethod(comptime T: type, comptime name: []const u8) bool {
11451145 return switch (@typeInfo(T)) {
11461146 .pointer => |P| switch (P.size) {
1147 .One => hasFn(P.child, name),
1148 .Many, .Slice, .C => false,
1147 .one => hasFn(P.child, name),
1148 .many, .slice, .c => false,
11491149 },
11501150 else => hasFn(T, name),
11511151 };
......@@ -1200,12 +1200,12 @@ pub inline fn hasUniqueRepresentation(comptime T: type) bool {
12001200
12011201 .int => |info| @sizeOf(T) * 8 == info.bits,
12021202
1203 .pointer => |info| info.size != .Slice,
1203 .pointer => |info| info.size != .slice,
12041204
12051205 .optional => |info| switch (@typeInfo(info.child)) {
12061206 .pointer => |ptr| !ptr.is_allowzero and switch (ptr.size) {
1207 .Slice, .C => false,
1208 .One, .Many => true,
1207 .slice, .c => false,
1208 .one, .many => true,
12091209 },
12101210 else => false,
12111211 },
lib/std/os/emscripten.zig+22-22
......@@ -12,7 +12,7 @@ const c = std.c;
1212pub const FILE = c.FILE;
1313
1414var __stack_chk_guard: usize = 0;
15fn __stack_chk_fail() callconv(.C) void {
15fn __stack_chk_fail() callconv(.c) void {
1616 std.debug.print("stack smashing detected: terminated\n", .{});
1717 emscripten_force_exit(127);
1818}
......@@ -547,8 +547,8 @@ pub const SIG = struct {
547547};
548548
549549pub const Sigaction = extern struct {
550 pub const handler_fn = *align(1) const fn (i32) callconv(.C) void;
551 pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.C) void;
550 pub const handler_fn = *align(1) const fn (i32) callconv(.c) void;
551 pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.c) void;
552552
553553 handler: extern union {
554554 handler: ?handler_fn,
......@@ -556,7 +556,7 @@ pub const Sigaction = extern struct {
556556 },
557557 mask: sigset_t,
558558 flags: c_uint,
559 restorer: ?*const fn () callconv(.C) void = null,
559 restorer: ?*const fn () callconv(.c) void = null,
560560};
561561
562562pub const sigset_t = [1024 / 32]u32;
......@@ -909,23 +909,23 @@ pub const LOG = struct {
909909 pub const INFO = 512;
910910};
911911
912pub const em_callback_func = ?*const fn () callconv(.C) void;
913pub const em_arg_callback_func = ?*const fn (?*anyopaque) callconv(.C) void;
914pub const em_str_callback_func = ?*const fn ([*:0]const u8) callconv(.C) void;
912pub const em_callback_func = ?*const fn () callconv(.c) void;
913pub const em_arg_callback_func = ?*const fn (?*anyopaque) callconv(.c) void;
914pub const em_str_callback_func = ?*const fn ([*:0]const u8) callconv(.c) void;
915915
916916pub extern "c" fn emscripten_async_wget(url: [*:0]const u8, file: [*:0]const u8, onload: em_str_callback_func, onerror: em_str_callback_func) void;
917917
918pub const em_async_wget_onload_func = ?*const fn (?*anyopaque, ?*anyopaque, c_int) callconv(.C) void;
918pub const em_async_wget_onload_func = ?*const fn (?*anyopaque, ?*anyopaque, c_int) callconv(.c) void;
919919pub extern "c" fn emscripten_async_wget_data(url: [*:0]const u8, arg: ?*anyopaque, onload: em_async_wget_onload_func, onerror: em_arg_callback_func) void;
920920
921pub const em_async_wget2_onload_func = ?*const fn (c_uint, ?*anyopaque, [*:0]const u8) callconv(.C) void;
922pub const em_async_wget2_onstatus_func = ?*const fn (c_uint, ?*anyopaque, c_int) callconv(.C) void;
921pub const em_async_wget2_onload_func = ?*const fn (c_uint, ?*anyopaque, [*:0]const u8) callconv(.c) void;
922pub const em_async_wget2_onstatus_func = ?*const fn (c_uint, ?*anyopaque, c_int) callconv(.c) void;
923923
924924pub extern "c" fn emscripten_async_wget2(url: [*:0]const u8, file: [*:0]const u8, requesttype: [*:0]const u8, param: [*:0]const u8, arg: ?*anyopaque, onload: em_async_wget2_onload_func, onerror: em_async_wget2_onstatus_func, onprogress: em_async_wget2_onstatus_func) c_int;
925925
926pub const em_async_wget2_data_onload_func = ?*const fn (c_uint, ?*anyopaque, ?*anyopaque, c_uint) callconv(.C) void;
927pub const em_async_wget2_data_onerror_func = ?*const fn (c_uint, ?*anyopaque, c_int, [*:0]const u8) callconv(.C) void;
928pub const em_async_wget2_data_onprogress_func = ?*const fn (c_uint, ?*anyopaque, c_int, c_int) callconv(.C) void;
926pub const em_async_wget2_data_onload_func = ?*const fn (c_uint, ?*anyopaque, ?*anyopaque, c_uint) callconv(.c) void;
927pub const em_async_wget2_data_onerror_func = ?*const fn (c_uint, ?*anyopaque, c_int, [*:0]const u8) callconv(.c) void;
928pub const em_async_wget2_data_onprogress_func = ?*const fn (c_uint, ?*anyopaque, c_int, c_int) callconv(.c) void;
929929
930930pub extern "c" fn emscripten_async_wget2_data(url: [*:0]const u8, requesttype: [*:0]const u8, param: [*:0]const u8, arg: ?*anyopaque, free: c_int, onload: em_async_wget2_data_onload_func, onerror: em_async_wget2_data_onerror_func, onprogress: em_async_wget2_data_onprogress_func) c_int;
931931pub extern "c" fn emscripten_async_wget2_abort(handle: c_int) void;
......@@ -944,8 +944,8 @@ pub extern "c" fn emscripten_pause_main_loop() void;
944944pub extern "c" fn emscripten_resume_main_loop() void;
945945pub extern "c" fn emscripten_cancel_main_loop() void;
946946
947pub const em_socket_callback = ?*const fn (c_int, ?*anyopaque) callconv(.C) void;
948pub const em_socket_error_callback = ?*const fn (c_int, c_int, [*:0]const u8, ?*anyopaque) callconv(.C) void;
947pub const em_socket_callback = ?*const fn (c_int, ?*anyopaque) callconv(.c) void;
948pub const em_socket_error_callback = ?*const fn (c_int, c_int, [*:0]const u8, ?*anyopaque) callconv(.c) void;
949949
950950pub extern "c" fn emscripten_set_socket_error_callback(userData: ?*anyopaque, callback: em_socket_error_callback) void;
951951pub extern "c" fn emscripten_set_socket_open_callback(userData: ?*anyopaque, callback: em_socket_callback) void;
......@@ -968,11 +968,11 @@ pub extern "c" fn emscripten_set_canvas_size(width: c_int, height: c_int) void;
968968pub extern "c" fn emscripten_get_canvas_size(width: *c_int, height: *c_int, isFullscreen: *c_int) void;
969969pub extern "c" fn emscripten_get_now() f64;
970970pub extern "c" fn emscripten_random() f32;
971pub const em_idb_onload_func = ?*const fn (?*anyopaque, ?*anyopaque, c_int) callconv(.C) void;
971pub const em_idb_onload_func = ?*const fn (?*anyopaque, ?*anyopaque, c_int) callconv(.c) void;
972972pub extern "c" fn emscripten_idb_async_load(db_name: [*:0]const u8, file_id: [*:0]const u8, arg: ?*anyopaque, onload: em_idb_onload_func, onerror: em_arg_callback_func) void;
973973pub extern "c" fn emscripten_idb_async_store(db_name: [*:0]const u8, file_id: [*:0]const u8, ptr: ?*anyopaque, num: c_int, arg: ?*anyopaque, onstore: em_arg_callback_func, onerror: em_arg_callback_func) void;
974974pub extern "c" fn emscripten_idb_async_delete(db_name: [*:0]const u8, file_id: [*:0]const u8, arg: ?*anyopaque, ondelete: em_arg_callback_func, onerror: em_arg_callback_func) void;
975pub const em_idb_exists_func = ?*const fn (?*anyopaque, c_int) callconv(.C) void;
975pub const em_idb_exists_func = ?*const fn (?*anyopaque, c_int) callconv(.c) void;
976976pub extern "c" fn emscripten_idb_async_exists(db_name: [*:0]const u8, file_id: [*:0]const u8, arg: ?*anyopaque, oncheck: em_idb_exists_func, onerror: em_arg_callback_func) void;
977977pub extern "c" fn emscripten_idb_load(db_name: [*:0]const u8, file_id: [*:0]const u8, pbuffer: *?*anyopaque, pnum: *c_int, perror: *c_int) void;
978978pub extern "c" fn emscripten_idb_store(db_name: [*:0]const u8, file_id: [*:0]const u8, buffer: *anyopaque, num: c_int, perror: *c_int) void;
......@@ -983,13 +983,13 @@ pub extern "c" fn emscripten_idb_store_blob(db_name: [*:0]const u8, file_id: [*:
983983pub extern "c" fn emscripten_idb_read_from_blob(blob: c_int, start: c_int, num: c_int, buffer: ?*anyopaque) void;
984984pub extern "c" fn emscripten_idb_free_blob(blob: c_int) void;
985985pub extern "c" fn emscripten_run_preload_plugins(file: [*:0]const u8, onload: em_str_callback_func, onerror: em_str_callback_func) c_int;
986pub const em_run_preload_plugins_data_onload_func = ?*const fn (?*anyopaque, [*:0]const u8) callconv(.C) void;
986pub const em_run_preload_plugins_data_onload_func = ?*const fn (?*anyopaque, [*:0]const u8) callconv(.c) void;
987987pub extern "c" fn emscripten_run_preload_plugins_data(data: [*]u8, size: c_int, suffix: [*:0]const u8, arg: ?*anyopaque, onload: em_run_preload_plugins_data_onload_func, onerror: em_arg_callback_func) void;
988988pub extern "c" fn emscripten_lazy_load_code() void;
989989pub const worker_handle = c_int;
990990pub extern "c" fn emscripten_create_worker(url: [*:0]const u8) worker_handle;
991991pub extern "c" fn emscripten_destroy_worker(worker: worker_handle) void;
992pub const em_worker_callback_func = ?*const fn ([*]u8, c_int, ?*anyopaque) callconv(.C) void;
992pub const em_worker_callback_func = ?*const fn ([*]u8, c_int, ?*anyopaque) callconv(.c) void;
993993pub extern "c" fn emscripten_call_worker(worker: worker_handle, funcname: [*:0]const u8, data: [*]u8, size: c_int, callback: em_worker_callback_func, arg: ?*anyopaque) void;
994994pub extern "c" fn emscripten_worker_respond(data: [*]u8, size: c_int) void;
995995pub extern "c" fn emscripten_worker_respond_provisionally(data: [*]u8, size: c_int) void;
......@@ -1003,10 +1003,10 @@ pub extern "c" fn emscripten_get_preloaded_image_data_from_FILE(file: *FILE, w:
10031003pub extern "c" fn emscripten_log(flags: c_int, format: [*:0]const u8, ...) void;
10041004pub extern "c" fn emscripten_get_callstack(flags: c_int, out: ?[*]u8, maxbytes: c_int) c_int;
10051005pub extern "c" fn emscripten_print_double(x: f64, to: ?[*]u8, max: c_int) c_int;
1006pub const em_scan_func = ?*const fn (?*anyopaque, ?*anyopaque) callconv(.C) void;
1006pub const em_scan_func = ?*const fn (?*anyopaque, ?*anyopaque) callconv(.c) void;
10071007pub extern "c" fn emscripten_scan_registers(func: em_scan_func) void;
10081008pub extern "c" fn emscripten_scan_stack(func: em_scan_func) void;
1009pub const em_dlopen_callback = ?*const fn (?*anyopaque, ?*anyopaque) callconv(.C) void;
1009pub const em_dlopen_callback = ?*const fn (?*anyopaque, ?*anyopaque) callconv(.c) void;
10101010pub extern "c" fn emscripten_dlopen(filename: [*:0]const u8, flags: c_int, user_data: ?*anyopaque, onsuccess: em_dlopen_callback, onerror: em_arg_callback_func) void;
10111011pub extern "c" fn emscripten_dlopen_promise(filename: [*:0]const u8, flags: c_int) em_promise_t;
10121012pub extern "c" fn emscripten_throw_number(number: f64) void;
......@@ -1024,7 +1024,7 @@ pub const struct__em_promise = opaque {};
10241024pub const em_promise_t = ?*struct__em_promise;
10251025pub const enum_em_promise_result_t = c_uint;
10261026pub const em_promise_result_t = enum_em_promise_result_t;
1027pub const em_promise_callback_t = ?*const fn (?*?*anyopaque, ?*anyopaque, ?*anyopaque) callconv(.C) em_promise_result_t;
1027pub const em_promise_callback_t = ?*const fn (?*?*anyopaque, ?*anyopaque, ?*anyopaque) callconv(.c) em_promise_result_t;
10281028
10291029pub extern "c" fn emscripten_promise_create() em_promise_t;
10301030pub extern "c" fn emscripten_promise_destroy(promise: em_promise_t) void;
lib/std/os/linux.zig+11-11
......@@ -67,7 +67,7 @@ pub const syscall_pipe = syscall_bits.syscall_pipe;
6767pub const syscall_fork = syscall_bits.syscall_fork;
6868
6969pub fn clone(
70 func: *const fn (arg: usize) callconv(.C) u8,
70 func: *const fn (arg: usize) callconv(.c) u8,
7171 stack: usize,
7272 flags: u32,
7373 arg: usize,
......@@ -77,14 +77,14 @@ pub fn clone(
7777) usize {
7878 // Can't directly call a naked function; cast to C calling convention first.
7979 return @as(*const fn (
80 *const fn (arg: usize) callconv(.C) u8,
80 *const fn (arg: usize) callconv(.c) u8,
8181 usize,
8282 u32,
8383 usize,
8484 ?*i32,
8585 usize,
8686 ?*i32,
87 ) callconv(.C) usize, @ptrCast(&syscall_bits.clone))(func, stack, flags, arg, ptid, tp, ctid);
87 ) callconv(.c) usize, @ptrCast(&syscall_bits.clone))(func, stack, flags, arg, ptid, tp, ctid);
8888}
8989
9090pub const ARCH = arch_bits.ARCH;
......@@ -494,7 +494,7 @@ pub const getauxval = if (extern_getauxval) struct {
494494 extern fn getauxval(index: usize) usize;
495495}.getauxval else getauxvalImpl;
496496
497fn getauxvalImpl(index: usize) callconv(.C) usize {
497fn getauxvalImpl(index: usize) callconv(.c) usize {
498498 const auxv = elf_aux_maybe orelse return 0;
499499 var i: usize = 0;
500500 while (auxv[i].a_type != std.elf.AT_NULL) : (i += 1) {
......@@ -1485,7 +1485,7 @@ pub fn flock(fd: fd_t, operation: i32) usize {
14851485}
14861486
14871487// We must follow the C calling convention when we call into the VDSO
1488const VdsoClockGettime = *align(1) const fn (clockid_t, *timespec) callconv(.C) usize;
1488const VdsoClockGettime = *align(1) const fn (clockid_t, *timespec) callconv(.c) usize;
14891489var vdso_clock_gettime: ?VdsoClockGettime = &init_vdso_clock_gettime;
14901490
14911491pub fn clock_gettime(clk_id: clockid_t, tp: *timespec) usize {
......@@ -1502,7 +1502,7 @@ pub fn clock_gettime(clk_id: clockid_t, tp: *timespec) usize {
15021502 return syscall2(.clock_gettime, @intFromEnum(clk_id), @intFromPtr(tp));
15031503}
15041504
1505fn init_vdso_clock_gettime(clk: clockid_t, ts: *timespec) callconv(.C) usize {
1505fn init_vdso_clock_gettime(clk: clockid_t, ts: *timespec) callconv(.c) usize {
15061506 const ptr: ?VdsoClockGettime = @ptrFromInt(vdso.lookup(VDSO.CGT_VER, VDSO.CGT_SYM));
15071507 // Note that we may not have a VDSO at all, update the stub address anyway
15081508 // so that clock_gettime will fall back on the good old (and slow) syscall
......@@ -5070,8 +5070,8 @@ pub const all_mask: sigset_t = [_]u32{0xffffffff} ** @typeInfo(sigset_t).array.l
50705070pub const app_mask: sigset_t = [2]u32{ 0xfffffffc, 0x7fffffff } ++ [_]u32{0xffffffff} ** 30;
50715071
50725072const k_sigaction_funcs = struct {
5073 const handler = ?*align(1) const fn (i32) callconv(.C) void;
5074 const restorer = *const fn () callconv(.C) void;
5073 const handler = ?*align(1) const fn (i32) callconv(.c) void;
5074 const restorer = *const fn () callconv(.c) void;
50755075};
50765076
50775077pub const k_sigaction = switch (native_arch) {
......@@ -5097,8 +5097,8 @@ pub const k_sigaction = switch (native_arch) {
50975097
50985098/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
50995099pub const Sigaction = extern struct {
5100 pub const handler_fn = *align(1) const fn (i32) callconv(.C) void;
5101 pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.C) void;
5100 pub const handler_fn = *align(1) const fn (i32) callconv(.c) void;
5101 pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.c) void;
51025102
51035103 handler: extern union {
51045104 handler: ?handler_fn,
......@@ -5106,7 +5106,7 @@ pub const Sigaction = extern struct {
51065106 },
51075107 mask: sigset_t,
51085108 flags: c_uint,
5109 restorer: ?*const fn () callconv(.C) void = null,
5109 restorer: ?*const fn () callconv(.c) void = null,
51105110};
51115111
51125112const sigset_len = @typeInfo(sigset_t).array.len;
lib/std/os/linux/sparc64.zig+1-1
......@@ -233,7 +233,7 @@ pub const restore = restore_rt;
233233
234234// Need to use C ABI here instead of naked
235235// to prevent an infinite loop when calling rt_sigreturn.
236pub fn restore_rt() callconv(.C) void {
236pub fn restore_rt() callconv(.c) void {
237237 return asm volatile ("t 0x6d"
238238 :
239239 : [number] "{g1}" (@intFromEnum(SYS.rt_sigreturn)),
lib/std/os/plan9.zig+2-2
......@@ -186,8 +186,8 @@ pub const empty_sigset = 0;
186186pub const siginfo_t = c_long;
187187// TODO plan9 doesn't have sigaction_fn. Sigaction is not a union, but we include it here to be compatible.
188188pub const Sigaction = extern struct {
189 pub const handler_fn = *const fn (i32) callconv(.C) void;
190 pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.C) void;
189 pub const handler_fn = *const fn (i32) callconv(.c) void;
190 pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.c) void;
191191
192192 handler: extern union {
193193 handler: ?handler_fn,
lib/std/os/uefi/tables/boot_services.zig+2-2
......@@ -149,11 +149,11 @@ pub const BootServices = extern struct {
149149
150150 /// Installs one or more protocol interfaces into the boot services environment
151151 // TODO: use callconv(cc) instead once that works
152 installMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.C) Status,
152 installMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.c) Status,
153153
154154 /// Removes one or more protocol interfaces into the boot services environment
155155 // TODO: use callconv(cc) instead once that works
156 uninstallMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.C) Status,
156 uninstallMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.c) Status,
157157
158158 /// Computes and returns a 32-bit CRC for a data buffer.
159159 calculateCrc32: *const fn (data: [*]const u8, data_size: usize, *u32) callconv(cc) Status,
lib/std/posix.zig+1-1
......@@ -5552,7 +5552,7 @@ pub fn dl_iterate_phdr(
55525552
55535553 if (builtin.link_libc) {
55545554 switch (system.dl_iterate_phdr(struct {
5555 fn callbackC(info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int {
5555 fn callbackC(info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.c) c_int {
55565556 const context_ptr: *const Context = @ptrCast(@alignCast(data));
55575557 callback(info, size, context_ptr.*) catch |err| return @intFromError(err);
55585558 return 0;
lib/std/posix/test.zig+1-1
......@@ -849,7 +849,7 @@ test "sigaction" {
849849 const S = struct {
850850 var handler_called_count: u32 = 0;
851851
852 fn handler(sig: i32, info: *const posix.siginfo_t, ctx_ptr: ?*anyopaque) callconv(.C) void {
852 fn handler(sig: i32, info: *const posix.siginfo_t, ctx_ptr: ?*anyopaque) callconv(.c) void {
853853 _ = ctx_ptr;
854854 // Check that we received the correct signal.
855855 switch (native_os) {
lib/std/testing.zig+5-5
......@@ -100,13 +100,13 @@ fn expectEqualInner(comptime T: type, expected: T, actual: T) !void {
100100
101101 .pointer => |pointer| {
102102 switch (pointer.size) {
103 .One, .Many, .C => {
103 .one, .many, .c => {
104104 if (actual != expected) {
105105 print("expected {*}, found {*}\n", .{ expected, actual });
106106 return error.TestExpectedEqual;
107107 }
108108 },
109 .Slice => {
109 .slice => {
110110 if (actual.ptr != expected.ptr) {
111111 print("expected slice ptr {*}, found {*}\n", .{ expected.ptr, actual.ptr });
112112 return error.TestExpectedEqual;
......@@ -726,13 +726,13 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe
726726 .pointer => |pointer| {
727727 switch (pointer.size) {
728728 // We have no idea what is behind those pointers, so the best we can do is `==` check.
729 .C, .Many => {
729 .c, .many => {
730730 if (actual != expected) {
731731 print("expected {*}, found {*}\n", .{ expected, actual });
732732 return error.TestExpectedEqual;
733733 }
734734 },
735 .One => {
735 .one => {
736736 // Length of those pointers are runtime value, so the best we can do is `==` check.
737737 switch (@typeInfo(pointer.child)) {
738738 .@"fn", .@"opaque" => {
......@@ -744,7 +744,7 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe
744744 else => try expectEqualDeep(expected.*, actual.*),
745745 }
746746 },
747 .Slice => {
747 .slice => {
748748 if (expected.len != actual.len) {
749749 print("Slice len not the same, expected {d}, found {d}\n", .{ expected.len, actual.len });
750750 return error.TestExpectedEqual;
lib/std/zig/Ast.zig+5-6
......@@ -2157,14 +2157,13 @@ fn fullFnProtoComponents(tree: Ast, info: full.FnProto.Components) full.FnProto
21572157
21582158fn fullPtrTypeComponents(tree: Ast, info: full.PtrType.Components) full.PtrType {
21592159 const token_tags = tree.tokens.items(.tag);
2160 const Size = std.builtin.Type.Pointer.Size;
2161 const size: Size = switch (token_tags[info.main_token]) {
2160 const size: std.builtin.Type.Pointer.Size = switch (token_tags[info.main_token]) {
21622161 .asterisk,
21632162 .asterisk_asterisk,
2164 => .One,
2163 => .one,
21652164 .l_bracket => switch (token_tags[info.main_token + 1]) {
2166 .asterisk => if (token_tags[info.main_token + 2] == .identifier) Size.C else Size.Many,
2167 else => Size.Slice,
2165 .asterisk => if (token_tags[info.main_token + 2] == .identifier) .c else .many,
2166 else => .slice,
21682167 },
21692168 else => unreachable,
21702169 };
......@@ -2180,7 +2179,7 @@ fn fullPtrTypeComponents(tree: Ast, info: full.PtrType.Components) full.PtrType
21802179 // positives. Therefore, start after a sentinel if there is one and
21812180 // skip over any align node and bit range nodes.
21822181 var i = if (info.sentinel != 0) tree.lastToken(info.sentinel) + 1 else switch (size) {
2183 .Many, .C => info.main_token + 1,
2182 .many, .c => info.main_token + 1,
21842183 else => info.main_token,
21852184 };
21862185 const end = tree.firstToken(info.child_type);
lib/std/zig/AstGen.zig+2-2
......@@ -3917,7 +3917,7 @@ fn ptrType(
39173917 node: Ast.Node.Index,
39183918 ptr_info: Ast.full.PtrType,
39193919) InnerError!Zir.Inst.Ref {
3920 if (ptr_info.size == .C and ptr_info.allowzero_token != null) {
3920 if (ptr_info.size == .c and ptr_info.allowzero_token != null) {
39213921 return gz.astgen.failTok(ptr_info.allowzero_token.?, "C pointers always allow address zero", .{});
39223922 }
39233923
......@@ -3946,7 +3946,7 @@ fn ptrType(
39463946 .{ .rl = .{ .ty = elem_type } },
39473947 ptr_info.ast.sentinel,
39483948 switch (ptr_info.size) {
3949 .Slice => .slice_sentinel,
3949 .slice => .slice_sentinel,
39503950 else => .pointer_sentinel,
39513951 },
39523952 );
lib/std/zig/c_translation.zig+3-3
......@@ -170,7 +170,7 @@ pub fn sizeof(target: anytype) usize {
170170 }
171171 },
172172 .pointer => |ptr| {
173 if (ptr.size == .Slice) {
173 if (ptr.size == .slice) {
174174 @compileError("Cannot use C sizeof on slice type " ++ @typeName(T));
175175 }
176176 // for strings, sizeof("a") returns 2.
......@@ -178,7 +178,7 @@ pub fn sizeof(target: anytype) usize {
178178 // in the .array case above, but strings remain literals
179179 // and are therefore always pointers, so they need to be
180180 // specially handled here.
181 if (ptr.size == .One and ptr.is_const and @typeInfo(ptr.child) == .array) {
181 if (ptr.size == .one and ptr.is_const and @typeInfo(ptr.child) == .array) {
182182 const array_info = @typeInfo(ptr.child).array;
183183 if ((array_info.child == u8 or array_info.child == u16) and
184184 array_info.sentinel != null and
......@@ -341,7 +341,7 @@ pub fn FlexibleArrayType(comptime SelfType: type, comptime ElementType: type) ty
341341 switch (@typeInfo(SelfType)) {
342342 .pointer => |ptr| {
343343 return @Type(.{ .pointer = .{
344 .size = .C,
344 .size = .c,
345345 .is_const = ptr.is_const,
346346 .is_volatile = ptr.is_volatile,
347347 .alignment = @alignOf(ElementType),
lib/std/zig/parser_test.zig+4-4
......@@ -552,7 +552,7 @@ test "zig fmt: trailing comma in fn parameter list" {
552552 \\pub fn f(
553553 \\ a: i32,
554554 \\ b: i32,
555 \\) callconv(.C) i32 {}
555 \\) callconv(.c) i32 {}
556556 \\pub fn f(
557557 \\ a: i32,
558558 \\ b: i32,
......@@ -560,15 +560,15 @@ test "zig fmt: trailing comma in fn parameter list" {
560560 \\pub fn f(
561561 \\ a: i32,
562562 \\ b: i32,
563 \\) align(8) callconv(.C) i32 {}
563 \\) align(8) callconv(.c) i32 {}
564564 \\pub fn f(
565565 \\ a: i32,
566566 \\ b: i32,
567 \\) align(8) linksection(".text") callconv(.C) i32 {}
567 \\) align(8) linksection(".text") callconv(.c) i32 {}
568568 \\pub fn f(
569569 \\ a: i32,
570570 \\ b: i32,
571 \\) linksection(".text") callconv(.C) i32 {}
571 \\) linksection(".text") callconv(.c) i32 {}
572572 \\
573573 );
574574}
lib/std/zig/render.zig+4-4
......@@ -938,7 +938,7 @@ fn renderArrayType(
938938fn renderPtrType(r: *Render, ptr_type: Ast.full.PtrType, space: Space) Error!void {
939939 const tree = r.tree;
940940 switch (ptr_type.size) {
941 .One => {
941 .one => {
942942 // Since ** tokens exist and the same token is shared by two
943943 // nested pointer types, we check to see if we are the parent
944944 // in such a relationship. If so, skip rendering anything for
......@@ -951,7 +951,7 @@ fn renderPtrType(r: *Render, ptr_type: Ast.full.PtrType, space: Space) Error!voi
951951 }
952952 try renderToken(r, ptr_type.ast.main_token, .none); // asterisk
953953 },
954 .Many => {
954 .many => {
955955 if (ptr_type.ast.sentinel == 0) {
956956 try renderToken(r, ptr_type.ast.main_token, .none); // lbracket
957957 try renderToken(r, ptr_type.ast.main_token + 1, .none); // asterisk
......@@ -964,13 +964,13 @@ fn renderPtrType(r: *Render, ptr_type: Ast.full.PtrType, space: Space) Error!voi
964964 try renderToken(r, tree.lastToken(ptr_type.ast.sentinel) + 1, .none); // rbracket
965965 }
966966 },
967 .C => {
967 .c => {
968968 try renderToken(r, ptr_type.ast.main_token, .none); // lbracket
969969 try renderToken(r, ptr_type.ast.main_token + 1, .none); // asterisk
970970 try renderToken(r, ptr_type.ast.main_token + 2, .none); // c
971971 try renderToken(r, ptr_type.ast.main_token + 3, .none); // rbracket
972972 },
973 .Slice => {
973 .slice => {
974974 if (ptr_type.ast.sentinel == 0) {
975975 try renderToken(r, ptr_type.ast.main_token, .none); // lbracket
976976 try renderToken(r, ptr_type.ast.main_token + 1, .none); // rbracket
lib/std/zig/system/x86.zig+2-2
......@@ -475,7 +475,7 @@ const CpuidLeaf = packed struct {
475475
476476/// This is a workaround for the C backend until zig has the ability to put
477477/// C code in inline assembly.
478extern fn zig_x86_cpuid(leaf_id: u32, subid: u32, eax: *u32, ebx: *u32, ecx: *u32, edx: *u32) callconv(.C) void;
478extern fn zig_x86_cpuid(leaf_id: u32, subid: u32, eax: *u32, ebx: *u32, ecx: *u32, edx: *u32) callconv(.c) void;
479479
480480fn cpuid(leaf_id: u32, subid: u32) CpuidLeaf {
481481 // valid for both x86 and x86_64
......@@ -502,7 +502,7 @@ fn cpuid(leaf_id: u32, subid: u32) CpuidLeaf {
502502
503503/// This is a workaround for the C backend until zig has the ability to put
504504/// C code in inline assembly.
505extern fn zig_x86_get_xcr0() callconv(.C) u32;
505extern fn zig_x86_get_xcr0() callconv(.c) u32;
506506
507507// Read control register 0 (XCR0). Used to detect features such as AVX.
508508fn getXCR0() u32 {
src/InternPool.zig+31-31
......@@ -1176,17 +1176,17 @@ const Local = struct {
11761176 } });
11771177 }
11781178
1179 pub fn addOne(mutable: Mutable) Allocator.Error!PtrElem(.{ .size = .One }) {
1179 pub fn addOne(mutable: Mutable) Allocator.Error!PtrElem(.{ .size = .one }) {
11801180 try mutable.ensureUnusedCapacity(1);
11811181 return mutable.addOneAssumeCapacity();
11821182 }
11831183
1184 pub fn addOneAssumeCapacity(mutable: Mutable) PtrElem(.{ .size = .One }) {
1184 pub fn addOneAssumeCapacity(mutable: Mutable) PtrElem(.{ .size = .one }) {
11851185 const index = mutable.mutate.len;
11861186 assert(index < mutable.list.header().capacity);
11871187 mutable.mutate.len = index + 1;
11881188 const mutable_view = mutable.view().slice();
1189 var ptr: PtrElem(.{ .size = .One }) = undefined;
1189 var ptr: PtrElem(.{ .size = .one }) = undefined;
11901190 inline for (fields) |field| {
11911191 @field(ptr, @tagName(field)) = &mutable_view.items(field)[index];
11921192 }
......@@ -1206,7 +1206,7 @@ const Local = struct {
12061206
12071207 pub fn appendSliceAssumeCapacity(
12081208 mutable: Mutable,
1209 slice: PtrElem(.{ .size = .Slice, .is_const = true }),
1209 slice: PtrElem(.{ .size = .slice, .is_const = true }),
12101210 ) void {
12111211 if (fields.len == 0) return;
12121212 const start = mutable.mutate.len;
......@@ -1253,17 +1253,17 @@ const Local = struct {
12531253 return ptr_array;
12541254 }
12551255
1256 pub fn addManyAsSlice(mutable: Mutable, len: usize) Allocator.Error!PtrElem(.{ .size = .Slice }) {
1256 pub fn addManyAsSlice(mutable: Mutable, len: usize) Allocator.Error!PtrElem(.{ .size = .slice }) {
12571257 try mutable.ensureUnusedCapacity(len);
12581258 return mutable.addManyAsSliceAssumeCapacity(len);
12591259 }
12601260
1261 pub fn addManyAsSliceAssumeCapacity(mutable: Mutable, len: usize) PtrElem(.{ .size = .Slice }) {
1261 pub fn addManyAsSliceAssumeCapacity(mutable: Mutable, len: usize) PtrElem(.{ .size = .slice }) {
12621262 const start = mutable.mutate.len;
12631263 assert(len <= mutable.list.header().capacity - start);
12641264 mutable.mutate.len = @intCast(start + len);
12651265 const mutable_view = mutable.view().slice();
1266 var slice: PtrElem(.{ .size = .Slice }) = undefined;
1266 var slice: PtrElem(.{ .size = .slice }) = undefined;
12671267 inline for (fields) |field| {
12681268 @field(slice, @tagName(field)) = mutable_view.items(field)[start..][0..len];
12691269 }
......@@ -2060,7 +2060,7 @@ pub const Key = union(enum) {
20602060 };
20612061
20622062 pub const Flags = packed struct(u32) {
2063 size: Size = .One,
2063 size: Size = .one,
20642064 /// `none` indicates the ABI alignment of the pointee_type. In this
20652065 /// case, this field *must* be set to `none`, otherwise the
20662066 /// `InternPool` equality and hashing functions will return incorrect
......@@ -4891,7 +4891,7 @@ pub const Index = enum(u32) {
48914891 checkField(name ++ ".?", info.child);
48924892 },
48934893 .pointer => |info| {
4894 assert(info.size == .Slice);
4894 assert(info.size == .slice);
48954895 checkConfig(name ++ ".len");
48964896 checkField(name ++ "[0]", info.child);
48974897 },
......@@ -5016,7 +5016,7 @@ pub const static_keys = [_]Key{
50165016 .{ .ptr_type = .{
50175017 .child = .u8_type,
50185018 .flags = .{
5019 .size = .Many,
5019 .size = .many,
50205020 },
50215021 } },
50225022
......@@ -5024,7 +5024,7 @@ pub const static_keys = [_]Key{
50245024 .{ .ptr_type = .{
50255025 .child = .u8_type,
50265026 .flags = .{
5027 .size = .Many,
5027 .size = .many,
50285028 .is_const = true,
50295029 },
50305030 } },
......@@ -5034,7 +5034,7 @@ pub const static_keys = [_]Key{
50345034 .child = .u8_type,
50355035 .sentinel = .zero_u8,
50365036 .flags = .{
5037 .size = .Many,
5037 .size = .many,
50385038 .is_const = true,
50395039 },
50405040 } },
......@@ -5043,7 +5043,7 @@ pub const static_keys = [_]Key{
50435043 .{ .ptr_type = .{
50445044 .child = .comptime_int_type,
50455045 .flags = .{
5046 .size = .One,
5046 .size = .one,
50475047 .is_const = true,
50485048 },
50495049 } },
......@@ -5052,7 +5052,7 @@ pub const static_keys = [_]Key{
50525052 .{ .ptr_type = .{
50535053 .child = .u8_type,
50545054 .flags = .{
5055 .size = .Slice,
5055 .size = .slice,
50565056 .is_const = true,
50575057 },
50585058 } },
......@@ -5062,7 +5062,7 @@ pub const static_keys = [_]Key{
50625062 .child = .u8_type,
50635063 .sentinel = .zero_u8,
50645064 .flags = .{
5065 .size = .Slice,
5065 .size = .slice,
50665066 .is_const = true,
50675067 },
50685068 } },
......@@ -6749,7 +6749,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key {
67496749 const many_ptr_item = many_ptr_unwrapped.getItem(ip);
67506750 assert(many_ptr_item.tag == .type_pointer);
67516751 var ptr_info = extraData(many_ptr_unwrapped.getExtra(ip), Tag.TypePointer, many_ptr_item.data);
6752 ptr_info.flags.size = .Slice;
6752 ptr_info.flags.size = .slice;
67536753 return .{ .ptr_type = ptr_info };
67546754 },
67556755
......@@ -7572,10 +7572,10 @@ pub fn get(ip: *InternPool, gpa: Allocator, tid: Zcu.PerThread.Id, key: Key) All
75727572 assert(ptr_type.child != .none);
75737573 assert(ptr_type.sentinel == .none or ip.typeOf(ptr_type.sentinel) == ptr_type.child);
75747574
7575 if (ptr_type.flags.size == .Slice) {
7575 if (ptr_type.flags.size == .slice) {
75767576 gop.cancel();
75777577 var new_key = key;
7578 new_key.ptr_type.flags.size = .Many;
7578 new_key.ptr_type.flags.size = .many;
75797579 const ptr_type_index = try ip.get(gpa, tid, new_key);
75807580 gop = try ip.getOrPutKey(gpa, tid, key);
75817581
......@@ -7588,7 +7588,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, tid: Zcu.PerThread.Id, key: Key) All
75887588 }
75897589
75907590 var ptr_type_adjusted = ptr_type;
7591 if (ptr_type.flags.size == .C) ptr_type_adjusted.flags.is_allowzero = true;
7591 if (ptr_type.flags.size == .c) ptr_type_adjusted.flags.is_allowzero = true;
75927592
75937593 items.appendAssumeCapacity(.{
75947594 .tag = .type_pointer,
......@@ -7731,8 +7731,8 @@ pub fn get(ip: *InternPool, gpa: Allocator, tid: Zcu.PerThread.Id, key: Key) All
77317731 },
77327732
77337733 .slice => |slice| {
7734 assert(ip.indexToKey(slice.ty).ptr_type.flags.size == .Slice);
7735 assert(ip.indexToKey(ip.typeOf(slice.ptr)).ptr_type.flags.size == .Many);
7734 assert(ip.indexToKey(slice.ty).ptr_type.flags.size == .slice);
7735 assert(ip.indexToKey(ip.typeOf(slice.ptr)).ptr_type.flags.size == .many);
77367736 items.appendAssumeCapacity(.{
77377737 .tag = .ptr_slice,
77387738 .data = try addExtra(extra, PtrSlice{
......@@ -7745,7 +7745,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, tid: Zcu.PerThread.Id, key: Key) All
77457745
77467746 .ptr => |ptr| {
77477747 const ptr_type = ip.indexToKey(ptr.ty).ptr_type;
7748 assert(ptr_type.flags.size != .Slice);
7748 assert(ptr_type.flags.size != .slice);
77497749 items.appendAssumeCapacity(switch (ptr.base_addr) {
77507750 .nav => |nav| .{
77517751 .tag = .ptr_nav,
......@@ -7804,9 +7804,9 @@ pub fn get(ip: *InternPool, gpa: Allocator, tid: Zcu.PerThread.Id, key: Key) All
78047804 .arr_elem, .field => |base_index| {
78057805 const base_ptr_type = ip.indexToKey(ip.typeOf(base_index.base)).ptr_type;
78067806 switch (ptr.base_addr) {
7807 .arr_elem => assert(base_ptr_type.flags.size == .Many),
7807 .arr_elem => assert(base_ptr_type.flags.size == .many),
78087808 .field => {
7809 assert(base_ptr_type.flags.size == .One);
7809 assert(base_ptr_type.flags.size == .one);
78107810 switch (ip.indexToKey(base_ptr_type.child)) {
78117811 .tuple_type => |tuple_type| {
78127812 assert(ptr.base_addr == .field);
......@@ -7823,7 +7823,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, tid: Zcu.PerThread.Id, key: Key) All
78237823 },
78247824 .ptr_type => |slice_type| {
78257825 assert(ptr.base_addr == .field);
7826 assert(slice_type.flags.size == .Slice);
7826 assert(slice_type.flags.size == .slice);
78277827 assert(base_index.index < 2);
78287828 },
78297829 else => unreachable,
......@@ -10314,12 +10314,12 @@ pub fn getCoerced(
1031410314 } });
1031510315
1031610316 if (ip.isPointerType(new_ty)) switch (ip.indexToKey(new_ty).ptr_type.flags.size) {
10317 .One, .Many, .C => return ip.get(gpa, tid, .{ .ptr = .{
10317 .one, .many, .c => return ip.get(gpa, tid, .{ .ptr = .{
1031810318 .ty = new_ty,
1031910319 .base_addr = .int,
1032010320 .byte_offset = 0,
1032110321 } }),
10322 .Slice => return ip.get(gpa, tid, .{ .slice = .{
10322 .slice => return ip.get(gpa, tid, .{ .slice = .{
1032310323 .ty = new_ty,
1032410324 .ptr = try ip.get(gpa, tid, .{ .ptr = .{
1032510325 .ty = ip.slicePtrType(new_ty),
......@@ -10408,7 +10408,7 @@ pub fn getCoerced(
1040810408 },
1040910409 else => {},
1041010410 },
10411 .slice => |slice| if (ip.isPointerType(new_ty) and ip.indexToKey(new_ty).ptr_type.flags.size == .Slice)
10411 .slice => |slice| if (ip.isPointerType(new_ty) and ip.indexToKey(new_ty).ptr_type.flags.size == .slice)
1041210412 return ip.get(gpa, tid, .{ .slice = .{
1041310413 .ty = new_ty,
1041410414 .ptr = try ip.getCoerced(gpa, tid, slice.ptr, ip.slicePtrType(new_ty)),
......@@ -10416,7 +10416,7 @@ pub fn getCoerced(
1041610416 } })
1041710417 else if (ip.isIntegerType(new_ty))
1041810418 return ip.getCoerced(gpa, tid, slice.ptr, new_ty),
10419 .ptr => |ptr| if (ip.isPointerType(new_ty) and ip.indexToKey(new_ty).ptr_type.flags.size != .Slice)
10419 .ptr => |ptr| if (ip.isPointerType(new_ty) and ip.indexToKey(new_ty).ptr_type.flags.size != .slice)
1042010420 return ip.get(gpa, tid, .{ .ptr = .{
1042110421 .ty = new_ty,
1042210422 .base_addr = ptr.base_addr,
......@@ -10433,12 +10433,12 @@ pub fn getCoerced(
1043310433 .opt => |opt| switch (ip.indexToKey(new_ty)) {
1043410434 .ptr_type => |ptr_type| return switch (opt.val) {
1043510435 .none => switch (ptr_type.flags.size) {
10436 .One, .Many, .C => try ip.get(gpa, tid, .{ .ptr = .{
10436 .one, .many, .c => try ip.get(gpa, tid, .{ .ptr = .{
1043710437 .ty = new_ty,
1043810438 .base_addr = .int,
1043910439 .byte_offset = 0,
1044010440 } }),
10441 .Slice => try ip.get(gpa, tid, .{ .slice = .{
10441 .slice => try ip.get(gpa, tid, .{ .slice = .{
1044210442 .ty = new_ty,
1044310443 .ptr = try ip.get(gpa, tid, .{ .ptr = .{
1044410444 .ty = ip.slicePtrType(new_ty),
src/Sema.zig+165-165
......@@ -2479,7 +2479,7 @@ fn typeSupportsFieldAccess(zcu: *const Zcu, ty: Type, field_name: InternPool.Nul
24792479 .array => return field_name.eqlSlice("len", ip),
24802480 .pointer => {
24812481 const ptr_info = ty.ptrInfo(zcu);
2482 if (ptr_info.flags.size == .Slice) {
2482 if (ptr_info.flags.size == .slice) {
24832483 return field_name.eqlSlice("ptr", ip) or field_name.eqlSlice("len", ip);
24842484 } else if (Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .array) {
24852485 return field_name.eqlSlice("len", ip);
......@@ -3653,7 +3653,7 @@ fn indexablePtrLenOrNone(
36533653 const zcu = pt.zcu;
36543654 const operand_ty = sema.typeOf(operand);
36553655 try checkMemOperand(sema, block, src, operand_ty);
3656 if (operand_ty.ptrSize(zcu) == .Many) return .none;
3656 if (operand_ty.ptrSize(zcu) == .many) return .none;
36573657 const field_name = try zcu.intern_pool.getOrPutString(sema.gpa, pt.tid, "len", .no_embedded_nulls);
36583658 return sema.fieldVal(block, src, operand, field_name, src);
36593659}
......@@ -4544,7 +4544,7 @@ fn zirCoercePtrElemTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileE
45444544 assert(ptr_ty.zigTypeTag(zcu) == .pointer); // validated by a previous instruction
45454545 const elem_ty = ptr_ty.childType(zcu);
45464546 switch (ptr_ty.ptrSize(zcu)) {
4547 .One => {
4547 .one => {
45484548 const uncoerced_ty = sema.typeOf(uncoerced_val);
45494549 if (elem_ty.zigTypeTag(zcu) == .array and elem_ty.childType(zcu).toIntern() == uncoerced_ty.toIntern()) {
45504550 // We're trying to initialize a *[1]T with a reference to a T - don't perform any coercion.
......@@ -4557,7 +4557,7 @@ fn zirCoercePtrElemTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileE
45574557 return sema.coerce(block, elem_ty, uncoerced_val, src);
45584558 }
45594559 },
4560 .Slice, .Many => {
4560 .slice, .many => {
45614561 // Our goal is to coerce `uncoerced_val` to an array of `elem_ty`.
45624562 const val_ty = sema.typeOf(uncoerced_val);
45634563 switch (val_ty.zigTypeTag(zcu)) {
......@@ -4573,7 +4573,7 @@ fn zirCoercePtrElemTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileE
45734573 });
45744574 return sema.coerce(block, want_ty, uncoerced_val, src);
45754575 },
4576 .C => {
4576 .c => {
45774577 // There's nothing meaningful to do here, because we don't know if this is meant to be a
45784578 // single-pointer or a many-pointer.
45794579 return uncoerced_val;
......@@ -4685,7 +4685,7 @@ fn zirValidateArrayInitRefTy(
46854685 assert(ptr_ty.zigTypeTag(zcu) == .pointer); // validated by a previous instruction
46864686 switch (zcu.intern_pool.indexToKey(ptr_ty.toIntern())) {
46874687 .ptr_type => |ptr_type| switch (ptr_type.flags.size) {
4688 .Slice, .Many => {
4688 .slice, .many => {
46894689 // Use array of correct length
46904690 const arr_ty = try pt.arrayType(.{
46914691 .len = extra.elem_count,
......@@ -5502,9 +5502,9 @@ fn zirValidateDeref(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr
55025502 if (operand_ty.zigTypeTag(zcu) != .pointer) {
55035503 return sema.fail(block, src, "cannot dereference non-pointer type '{}'", .{operand_ty.fmt(pt)});
55045504 } else switch (operand_ty.ptrSize(zcu)) {
5505 .One, .C => {},
5506 .Many => return sema.fail(block, src, "index syntax required for unknown-length pointer type '{}'", .{operand_ty.fmt(pt)}),
5507 .Slice => return sema.fail(block, src, "index syntax required for slice type '{}'", .{operand_ty.fmt(pt)}),
5505 .one, .c => {},
5506 .many => return sema.fail(block, src, "index syntax required for unknown-length pointer type '{}'", .{operand_ty.fmt(pt)}),
5507 .slice => return sema.fail(block, src, "index syntax required for slice type '{}'", .{operand_ty.fmt(pt)}),
55085508 }
55095509
55105510 if ((try sema.typeHasOnePossibleValue(operand_ty.childType(zcu))) != null) {
......@@ -6521,7 +6521,7 @@ fn zirExport(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void
65216521 return sema.fail(block, ptr_src, "expected pointer type, found '{}'", .{ptr_ty.fmt(pt)});
65226522 }
65236523 const ptr_ty_info = ptr_ty.ptrInfo(zcu);
6524 if (ptr_ty_info.flags.size == .Slice) {
6524 if (ptr_ty_info.flags.size == .slice) {
65256525 return sema.fail(block, ptr_src, "export target cannot be slice", .{});
65266526 }
65276527 if (ptr_ty_info.packed_offset.host_size != 0) {
......@@ -7271,7 +7271,7 @@ fn checkCallArgumentCount(
72717271 .@"fn" => break :func_ty callee_ty,
72727272 .pointer => {
72737273 const ptr_info = callee_ty.ptrInfo(zcu);
7274 if (ptr_info.flags.size == .One and Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .@"fn") {
7274 if (ptr_info.flags.size == .one and Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .@"fn") {
72757275 break :func_ty Type.fromInterned(ptr_info.child);
72767276 }
72777277 },
......@@ -7350,7 +7350,7 @@ fn callBuiltin(
73507350 .@"fn" => break :func_ty callee_ty,
73517351 .pointer => {
73527352 const ptr_info = callee_ty.ptrInfo(zcu);
7353 if (ptr_info.flags.size == .One and Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .@"fn") {
7353 if (ptr_info.flags.size == .one and Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .@"fn") {
73547354 break :func_ty Type.fromInterned(ptr_info.child);
73557355 }
73567356 },
......@@ -8344,8 +8344,8 @@ fn zirIndexablePtrElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com
83448344 };
83458345 try sema.checkMemOperand(block, src, ptr_ty);
83468346 const elem_ty = switch (ptr_ty.ptrSize(zcu)) {
8347 .Slice, .Many, .C => ptr_ty.childType(zcu),
8348 .One => ptr_ty.childType(zcu).childType(zcu),
8347 .slice, .many, .c => ptr_ty.childType(zcu),
8348 .one => ptr_ty.childType(zcu).childType(zcu),
83498349 };
83508350 return Air.internedToRef(elem_ty.toIntern());
83518351}
......@@ -8943,7 +8943,7 @@ fn zirOptionalPayload(
89438943 const result_ty = switch (operand_ty.zigTypeTag(zcu)) {
89448944 .optional => operand_ty.optionalChild(zcu),
89458945 .pointer => t: {
8946 if (operand_ty.ptrSize(zcu) != .C) {
8946 if (operand_ty.ptrSize(zcu) != .c) {
89478947 return sema.failWithExpectedOptionalType(block, src, operand_ty);
89488948 }
89498949 // TODO https://github.com/ziglang/zig/issues/6597
......@@ -13972,7 +13972,7 @@ fn zirHasField(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1397213972 const has_field = hf: {
1397313973 switch (ip.indexToKey(ty.toIntern())) {
1397413974 .ptr_type => |ptr_type| switch (ptr_type.flags.size) {
13975 .Slice => {
13975 .slice => {
1397613976 if (field_name.eqlSlice("ptr", ip)) break :hf true;
1397713977 if (field_name.eqlSlice("len", ip)) break :hf true;
1397813978 break :hf false;
......@@ -14797,7 +14797,7 @@ fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1479714797 const slice_ty = try pt.ptrTypeSema(.{
1479814798 .child = resolved_elem_ty.toIntern(),
1479914799 .flags = .{
14800 .size = .Slice,
14800 .size = .slice,
1480114801 .address_space = ptr_as,
1480214802 },
1480314803 });
......@@ -14925,7 +14925,7 @@ fn getArrayCatInfo(sema: *Sema, block: *Block, src: LazySrcLoc, operand: Air.Ins
1492514925 .pointer => {
1492614926 const ptr_info = operand_ty.ptrInfo(zcu);
1492714927 switch (ptr_info.flags.size) {
14928 .Slice => {
14928 .slice => {
1492914929 const val = try sema.resolveConstDefinedValue(block, src, operand, .{ .simple = .slice_cat_operand });
1493014930 return Type.ArrayInfo{
1493114931 .elem_type = Type.fromInterned(ptr_info.child),
......@@ -14936,12 +14936,12 @@ fn getArrayCatInfo(sema: *Sema, block: *Block, src: LazySrcLoc, operand: Air.Ins
1493614936 .len = try val.sliceLen(pt),
1493714937 };
1493814938 },
14939 .One => {
14939 .one => {
1494014940 if (Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .array) {
1494114941 return Type.fromInterned(ptr_info.child).arrayInfo(zcu);
1494214942 }
1494314943 },
14944 .C, .Many => {},
14944 .c, .many => {},
1494514945 }
1494614946 },
1494714947 .@"struct" => {
......@@ -16610,7 +16610,7 @@ fn analyzeArithmetic(
1661016610
1661116611 if (lhs_zig_ty_tag == .pointer) {
1661216612 if (rhs_zig_ty_tag == .pointer) {
16613 if (lhs_ty.ptrSize(zcu) != .Slice and rhs_ty.ptrSize(zcu) != .Slice) {
16613 if (lhs_ty.ptrSize(zcu) != .slice and rhs_ty.ptrSize(zcu) != .slice) {
1661416614 if (zir_tag != .sub) {
1661516615 return sema.failWithInvalidPtrArithmetic(block, src, "pointer-pointer", "subtraction");
1661616616 }
......@@ -16662,8 +16662,8 @@ fn analyzeArithmetic(
1666216662 }
1666316663 } else {
1666416664 switch (lhs_ty.ptrSize(zcu)) {
16665 .One, .Slice => {},
16666 .Many, .C => {
16665 .one, .slice => {},
16666 .many, .c => {
1666716667 const air_tag: Air.Inst.Tag = switch (zir_tag) {
1666816668 .add => .ptr_add,
1666916669 .sub => .ptr_sub,
......@@ -17160,7 +17160,7 @@ fn analyzePtrArithmetic(
1716017160 const opt_off_val = try sema.resolveDefinedValue(block, offset_src, offset);
1716117161 const ptr_ty = sema.typeOf(ptr);
1716217162 const ptr_info = ptr_ty.ptrInfo(zcu);
17163 assert(ptr_info.flags.size == .Many or ptr_info.flags.size == .C);
17163 assert(ptr_info.flags.size == .many or ptr_info.flags.size == .c);
1716417164
1716517165 const new_ptr_ty = t: {
1716617166 // Calculate the new pointer alignment.
......@@ -18092,7 +18092,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1809218092 const slice_ty = (try pt.ptrTypeSema(.{
1809318093 .child = param_info_ty.toIntern(),
1809418094 .flags = .{
18095 .size = .Slice,
18095 .size = .slice,
1809618096 .is_const = true,
1809718097 },
1809818098 })).toIntern();
......@@ -18335,7 +18335,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1833518335 const slice_errors_ty = try pt.ptrTypeSema(.{
1833618336 .child = error_field_ty.toIntern(),
1833718337 .flags = .{
18338 .size = .Slice,
18338 .size = .slice,
1833918339 .is_const = true,
1834018340 },
1834118341 });
......@@ -18462,7 +18462,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1846218462 const slice_ty = (try pt.ptrTypeSema(.{
1846318463 .child = enum_field_ty.toIntern(),
1846418464 .flags = .{
18465 .size = .Slice,
18465 .size = .slice,
1846618466 .is_const = true,
1846718467 },
1846818468 })).toIntern();
......@@ -18575,7 +18575,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1857518575 const slice_ty = (try pt.ptrTypeSema(.{
1857618576 .child = union_field_ty.toIntern(),
1857718577 .flags = .{
18578 .size = .Slice,
18578 .size = .slice,
1857918579 .is_const = true,
1858018580 },
1858118581 })).toIntern();
......@@ -18770,7 +18770,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1877018770 const slice_ty = (try pt.ptrTypeSema(.{
1877118771 .child = struct_field_ty.toIntern(),
1877218772 .flags = .{
18773 .size = .Slice,
18773 .size = .slice,
1877418774 .is_const = true,
1877518775 },
1877618776 })).toIntern();
......@@ -18879,7 +18879,7 @@ fn typeInfoDecls(
1887918879 const slice_ty = (try pt.ptrTypeSema(.{
1888018880 .child = declaration_ty.toIntern(),
1888118881 .flags = .{
18882 .size = .Slice,
18882 .size = .slice,
1888318883 .is_const = true,
1888418884 },
1888518885 })).toIntern();
......@@ -20138,12 +20138,12 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
2013820138 }
2013920139
2014020140 if (elem_ty.zigTypeTag(zcu) == .@"fn") {
20141 if (inst_data.size != .One) {
20141 if (inst_data.size != .one) {
2014220142 return sema.fail(block, elem_ty_src, "function pointers must be single pointers", .{});
2014320143 }
20144 } else if (inst_data.size == .Many and elem_ty.zigTypeTag(zcu) == .@"opaque") {
20144 } else if (inst_data.size == .many and elem_ty.zigTypeTag(zcu) == .@"opaque") {
2014520145 return sema.fail(block, elem_ty_src, "unknown-length pointer to opaque not allowed", .{});
20146 } else if (inst_data.size == .C) {
20146 } else if (inst_data.size == .c) {
2014720147 if (!try sema.validateExternType(elem_ty, .other)) {
2014820148 const msg = msg: {
2014920149 const msg = try sema.errMsg(elem_ty_src, "C pointers cannot point to non-C-ABI-compatible type '{}'", .{elem_ty.fmt(pt)});
......@@ -21645,7 +21645,7 @@ fn zirReify(
2164521645
2164621646 const actual_sentinel: InternPool.Index = s: {
2164721647 if (!sentinel_val.isNull(zcu)) {
21648 if (ptr_size == .One or ptr_size == .C) {
21648 if (ptr_size == .one or ptr_size == .c) {
2164921649 return sema.fail(block, src, "sentinels are only allowed on slices and unknown-length pointers", .{});
2165021650 }
2165121651 const sentinel_ptr_val = sentinel_val.optionalValue(zcu).?;
......@@ -21660,12 +21660,12 @@ fn zirReify(
2166021660 if (elem_ty.zigTypeTag(zcu) == .noreturn) {
2166121661 return sema.fail(block, src, "pointer to noreturn not allowed", .{});
2166221662 } else if (elem_ty.zigTypeTag(zcu) == .@"fn") {
21663 if (ptr_size != .One) {
21663 if (ptr_size != .one) {
2166421664 return sema.fail(block, src, "function pointers must be single pointers", .{});
2166521665 }
21666 } else if (ptr_size == .Many and elem_ty.zigTypeTag(zcu) == .@"opaque") {
21666 } else if (ptr_size == .many and elem_ty.zigTypeTag(zcu) == .@"opaque") {
2166721667 return sema.fail(block, src, "unknown-length pointer to opaque not allowed", .{});
21668 } else if (ptr_size == .C) {
21668 } else if (ptr_size == .c) {
2166921669 if (!try sema.validateExternType(elem_ty, .other)) {
2167021670 const msg = msg: {
2167121671 const msg = try sema.errMsg(src, "C pointers cannot point to non-C-ABI-compatible type '{}'", .{elem_ty.fmt(pt)});
......@@ -23321,21 +23321,21 @@ fn ptrCastFull(
2332123321 try Type.fromInterned(src_info.child).resolveLayout(pt);
2332223322 try Type.fromInterned(dest_info.child).resolveLayout(pt);
2332323323
23324 const src_slice_like = src_info.flags.size == .Slice or
23325 (src_info.flags.size == .One and Type.fromInterned(src_info.child).zigTypeTag(zcu) == .array);
23324 const src_slice_like = src_info.flags.size == .slice or
23325 (src_info.flags.size == .one and Type.fromInterned(src_info.child).zigTypeTag(zcu) == .array);
2332623326
23327 const dest_slice_like = dest_info.flags.size == .Slice or
23328 (dest_info.flags.size == .One and Type.fromInterned(dest_info.child).zigTypeTag(zcu) == .array);
23327 const dest_slice_like = dest_info.flags.size == .slice or
23328 (dest_info.flags.size == .one and Type.fromInterned(dest_info.child).zigTypeTag(zcu) == .array);
2332923329
23330 if (dest_info.flags.size == .Slice and !src_slice_like) {
23330 if (dest_info.flags.size == .slice and !src_slice_like) {
2333123331 return sema.fail(block, src, "illegal pointer cast to slice", .{});
2333223332 }
2333323333
23334 if (dest_info.flags.size == .Slice) {
23334 if (dest_info.flags.size == .slice) {
2333523335 const src_elem_size = switch (src_info.flags.size) {
23336 .Slice => Type.fromInterned(src_info.child).abiSize(zcu),
23336 .slice => Type.fromInterned(src_info.child).abiSize(zcu),
2333723337 // pointer to array
23338 .One => Type.fromInterned(src_info.child).childType(zcu).abiSize(zcu),
23338 .one => Type.fromInterned(src_info.child).childType(zcu).abiSize(zcu),
2333923339 else => unreachable,
2334023340 };
2334123341 const dest_elem_size = Type.fromInterned(dest_info.child).abiSize(zcu);
......@@ -23350,17 +23350,17 @@ fn ptrCastFull(
2335023350 check_size: {
2335123351 if (src_info.flags.size == dest_info.flags.size) break :check_size;
2335223352 if (src_slice_like and dest_slice_like) break :check_size;
23353 if (src_info.flags.size == .C) break :check_size;
23354 if (dest_info.flags.size == .C) break :check_size;
23353 if (src_info.flags.size == .c) break :check_size;
23354 if (dest_info.flags.size == .c) break :check_size;
2335523355 return sema.failWithOwnedErrorMsg(block, msg: {
2335623356 const msg = try sema.errMsg(src, "cannot implicitly convert {s} to {s}", .{
2335723357 pointerSizeString(src_info.flags.size),
2335823358 pointerSizeString(dest_info.flags.size),
2335923359 });
2336023360 errdefer msg.destroy(sema.gpa);
23361 if (dest_info.flags.size == .Many and
23362 (src_info.flags.size == .Slice or
23363 (src_info.flags.size == .One and Type.fromInterned(src_info.child).zigTypeTag(zcu) == .array)))
23361 if (dest_info.flags.size == .many and
23362 (src_info.flags.size == .slice or
23363 (src_info.flags.size == .one and Type.fromInterned(src_info.child).zigTypeTag(zcu) == .array)))
2336423364 {
2336523365 try sema.errNote(src, msg, "use 'ptr' field to convert slice to many pointer", .{});
2336623366 } else {
......@@ -23371,7 +23371,7 @@ fn ptrCastFull(
2337123371 }
2337223372
2337323373 check_child: {
23374 const src_child = if (dest_info.flags.size == .Slice and src_info.flags.size == .One) blk: {
23374 const src_child = if (dest_info.flags.size == .slice and src_info.flags.size == .one) blk: {
2337523375 // *[n]T -> []T
2337623376 break :blk Type.fromInterned(src_info.child).childType(zcu);
2337723377 } else Type.fromInterned(src_info.child);
......@@ -23402,12 +23402,12 @@ fn ptrCastFull(
2340223402
2340323403 check_sent: {
2340423404 if (dest_info.sentinel == .none) break :check_sent;
23405 if (src_info.flags.size == .C) break :check_sent;
23405 if (src_info.flags.size == .c) break :check_sent;
2340623406 if (src_info.sentinel != .none) {
2340723407 const coerced_sent = try zcu.intern_pool.getCoerced(sema.gpa, pt.tid, src_info.sentinel, dest_info.child);
2340823408 if (dest_info.sentinel == coerced_sent) break :check_sent;
2340923409 }
23410 if (src_slice_like and src_info.flags.size == .One and dest_info.flags.size == .Slice) {
23410 if (src_slice_like and src_info.flags.size == .one and dest_info.flags.size == .slice) {
2341123411 // [*]nT -> []T
2341223412 const arr_ty = Type.fromInterned(src_info.child);
2341323413 if (arr_ty.sentinel(zcu)) |src_sentinel| {
......@@ -23555,7 +23555,7 @@ fn ptrCastFull(
2355523555 }
2355623556 }
2355723557
23558 const ptr = if (src_info.flags.size == .Slice and dest_info.flags.size != .Slice) ptr: {
23558 const ptr = if (src_info.flags.size == .slice and dest_info.flags.size != .slice) ptr: {
2355923559 if (operand_ty.zigTypeTag(zcu) == .optional) {
2356023560 break :ptr try sema.analyzeOptionalSlicePtr(block, operand_src, operand, operand_ty);
2356123561 } else {
......@@ -23563,10 +23563,10 @@ fn ptrCastFull(
2356323563 }
2356423564 } else operand;
2356523565
23566 const dest_ptr_ty = if (dest_info.flags.size == .Slice and src_info.flags.size != .Slice) blk: {
23566 const dest_ptr_ty = if (dest_info.flags.size == .slice and src_info.flags.size != .slice) blk: {
2356723567 // Only convert to a many-pointer at first
2356823568 var info = dest_info;
23569 info.flags.size = .Many;
23569 info.flags.size = .many;
2357023570 const ty = try pt.ptrTypeSema(info);
2357123571 if (dest_ty.zigTypeTag(zcu) == .optional) {
2357223572 break :blk try pt.optionalType(ty.toIntern());
......@@ -23594,7 +23594,7 @@ fn ptrCastFull(
2359423594 }
2359523595 }
2359623596 }
23597 if (dest_info.flags.size == .Slice and src_info.flags.size != .Slice) {
23597 if (dest_info.flags.size == .slice and src_info.flags.size != .slice) {
2359823598 if (ptr_val.isUndef(zcu)) return pt.undefRef(dest_ty);
2359923599 const arr_len = try pt.intValue(Type.usize, Type.fromInterned(src_info.child).arrayLen(zcu));
2360023600 const ptr_val_key = zcu.intern_pool.indexToKey(ptr_val.toIntern()).ptr;
......@@ -23622,7 +23622,7 @@ fn ptrCastFull(
2362223622 {
2362323623 const ptr_int = try block.addUnOp(.int_from_ptr, ptr);
2362423624 const is_non_zero = try block.addBinOp(.cmp_neq, ptr_int, .zero_usize);
23625 const ok = if (src_info.flags.size == .Slice and dest_info.flags.size == .Slice) ok: {
23625 const ok = if (src_info.flags.size == .slice and dest_info.flags.size == .slice) ok: {
2362623626 const len = try sema.analyzeSliceLen(block, operand_src, ptr);
2362723627 const len_zero = try block.addBinOp(.cmp_eq, len, .zero_usize);
2362823628 break :ok try block.addBinOp(.bool_or, len_zero, is_non_zero);
......@@ -23639,7 +23639,7 @@ fn ptrCastFull(
2363923639 const ptr_int = try block.addUnOp(.int_from_ptr, ptr);
2364023640 const remainder = try block.addBinOp(.bit_and, ptr_int, align_minus_1);
2364123641 const is_aligned = try block.addBinOp(.cmp_eq, remainder, .zero_usize);
23642 const ok = if (src_info.flags.size == .Slice and dest_info.flags.size == .Slice) ok: {
23642 const ok = if (src_info.flags.size == .slice and dest_info.flags.size == .slice) ok: {
2364323643 const len = try sema.analyzeSliceLen(block, operand_src, ptr);
2364423644 const len_zero = try block.addBinOp(.cmp_eq, len, .zero_usize);
2364523645 break :ok try block.addBinOp(.bool_or, len_zero, is_aligned);
......@@ -23672,7 +23672,7 @@ fn ptrCastFull(
2367223672 break :ptr try block.addBitCast(dest_ptr_ty, ptr);
2367323673 };
2367423674
23675 if (dest_info.flags.size == .Slice and src_info.flags.size != .Slice) {
23675 if (dest_info.flags.size == .slice and src_info.flags.size != .slice) {
2367623676 // We have to construct a slice using the operand's child's array length
2367723677 // Note that we know from the check at the start of the function that operand_ty is slice-like
2367823678 const arr_len = Air.internedToRef((try pt.intValue(Type.usize, Type.fromInterned(src_info.child).arrayLen(zcu))).toIntern());
......@@ -24066,8 +24066,8 @@ fn checkInvalidPtrIntArithmetic(
2406624066 const zcu = pt.zcu;
2406724067 switch (try ty.zigTypeTagOrPoison(zcu)) {
2406824068 .pointer => switch (ty.ptrSize(zcu)) {
24069 .One, .Slice => return,
24070 .Many, .C => return sema.failWithInvalidPtrArithmetic(block, src, "pointer-integer", "addition and subtraction"),
24069 .one, .slice => return,
24070 .many, .c => return sema.failWithInvalidPtrArithmetic(block, src, "pointer-integer", "addition and subtraction"),
2407124071 },
2407224072 else => return,
2407324073 }
......@@ -25384,7 +25384,7 @@ fn zirFieldParentPtr(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Ins
2538425384 const parent_ptr_ty = try sema.resolveDestType(block, inst_src, extra.parent_ptr_type, .remove_eu, "@fieldParentPtr");
2538525385 try sema.checkPtrType(block, inst_src, parent_ptr_ty, true);
2538625386 const parent_ptr_info = parent_ptr_ty.ptrInfo(zcu);
25387 if (parent_ptr_info.flags.size != .One) {
25387 if (parent_ptr_info.flags.size != .one) {
2538825388 return sema.fail(block, inst_src, "expected single pointer type, found '{}'", .{parent_ptr_ty.fmt(pt)});
2538925389 }
2539025390 const parent_ty = Type.fromInterned(parent_ptr_info.child);
......@@ -25862,7 +25862,7 @@ fn upgradeToArrayPtr(sema: *Sema, block: *Block, ptr: Air.Inst.Ref, len: u64) !A
2586225862 const zcu = pt.zcu;
2586325863 const ptr_ty = sema.typeOf(ptr);
2586425864 const info = ptr_ty.ptrInfo(zcu);
25865 if (info.flags.size == .One) {
25865 if (info.flags.size == .one) {
2586625866 // Already an array pointer.
2586725867 return ptr;
2586825868 }
......@@ -25880,7 +25880,7 @@ fn upgradeToArrayPtr(sema: *Sema, block: *Block, ptr: Air.Inst.Ref, len: u64) !A
2588025880 .address_space = info.flags.address_space,
2588125881 },
2588225882 });
25883 const non_slice_ptr = if (info.flags.size == .Slice)
25883 const non_slice_ptr = if (info.flags.size == .slice)
2588425884 try block.addTyOp(.slice_ptr, ptr_ty.slicePtrFieldType(zcu), ptr)
2588525885 else
2588625886 ptr;
......@@ -26069,22 +26069,22 @@ fn zirMemcpy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void
2606926069 const new_dest_ptr_ty = sema.typeOf(new_dest_ptr);
2607026070 const raw_dest_ptr = if (new_dest_ptr_ty.isSlice(zcu))
2607126071 try sema.analyzeSlicePtr(block, dest_src, new_dest_ptr, new_dest_ptr_ty)
26072 else if (new_dest_ptr_ty.ptrSize(zcu) == .One) ptr: {
26072 else if (new_dest_ptr_ty.ptrSize(zcu) == .one) ptr: {
2607326073 var dest_manyptr_ty_key = zcu.intern_pool.indexToKey(new_dest_ptr_ty.toIntern()).ptr_type;
26074 assert(dest_manyptr_ty_key.flags.size == .One);
26074 assert(dest_manyptr_ty_key.flags.size == .one);
2607526075 dest_manyptr_ty_key.child = dest_elem_ty.toIntern();
26076 dest_manyptr_ty_key.flags.size = .Many;
26076 dest_manyptr_ty_key.flags.size = .many;
2607726077 break :ptr try sema.coerceCompatiblePtrs(block, try pt.ptrTypeSema(dest_manyptr_ty_key), new_dest_ptr, dest_src);
2607826078 } else new_dest_ptr;
2607926079
2608026080 const new_src_ptr_ty = sema.typeOf(new_src_ptr);
2608126081 const raw_src_ptr = if (new_src_ptr_ty.isSlice(zcu))
2608226082 try sema.analyzeSlicePtr(block, src_src, new_src_ptr, new_src_ptr_ty)
26083 else if (new_src_ptr_ty.ptrSize(zcu) == .One) ptr: {
26083 else if (new_src_ptr_ty.ptrSize(zcu) == .one) ptr: {
2608426084 var src_manyptr_ty_key = zcu.intern_pool.indexToKey(new_src_ptr_ty.toIntern()).ptr_type;
26085 assert(src_manyptr_ty_key.flags.size == .One);
26085 assert(src_manyptr_ty_key.flags.size == .one);
2608626086 src_manyptr_ty_key.child = src_elem_ty.toIntern();
26087 src_manyptr_ty_key.flags.size = .Many;
26087 src_manyptr_ty_key.flags.size = .many;
2608826088 break :ptr try sema.coerceCompatiblePtrs(block, try pt.ptrTypeSema(src_manyptr_ty_key), new_src_ptr, src_src);
2608926089 } else new_src_ptr;
2609026090
......@@ -26129,13 +26129,13 @@ fn zirMemset(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void
2612926129 const dest_elem_ty: Type = dest_elem_ty: {
2613026130 const ptr_info = dest_ptr_ty.ptrInfo(zcu);
2613126131 switch (ptr_info.flags.size) {
26132 .Slice => break :dest_elem_ty Type.fromInterned(ptr_info.child),
26133 .One => {
26132 .slice => break :dest_elem_ty Type.fromInterned(ptr_info.child),
26133 .one => {
2613426134 if (Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .array) {
2613526135 break :dest_elem_ty Type.fromInterned(ptr_info.child).childType(zcu);
2613626136 }
2613726137 },
26138 .Many, .C => {},
26138 .many, .c => {},
2613926139 }
2614026140 return sema.failWithOwnedErrorMsg(block, msg: {
2614126141 const msg = try sema.errMsg(src, "unknown @memset length", .{});
......@@ -26172,7 +26172,7 @@ fn zirMemset(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void
2617226172 } }));
2617326173 const array_ptr_ty = ty: {
2617426174 var info = dest_ptr_ty.ptrInfo(zcu);
26175 info.flags.size = .One;
26175 info.flags.size = .one;
2617626176 info.child = array_ty.toIntern();
2617726177 break :ty try pt.ptrType(info);
2617826178 };
......@@ -26754,15 +26754,15 @@ fn zirInplaceArithResultTy(sema: *Sema, extended: Zir.Inst.Extended.InstData) Co
2675426754 .add_eq => ty: {
2675526755 const ptr_size = lhs_ty.ptrSizeOrNull(zcu) orelse break :ty lhs_ty;
2675626756 switch (ptr_size) {
26757 .One, .Slice => break :ty lhs_ty, // invalid, let it error
26758 .Many, .C => break :ty .usize, // `[*]T + usize`
26757 .one, .slice => break :ty lhs_ty, // invalid, let it error
26758 .many, .c => break :ty .usize, // `[*]T + usize`
2675926759 }
2676026760 },
2676126761 .sub_eq => ty: {
2676226762 const ptr_size = lhs_ty.ptrSizeOrNull(zcu) orelse break :ty lhs_ty;
2676326763 switch (ptr_size) {
26764 .One, .Slice => break :ty lhs_ty, // invalid, let it error
26765 .Many, .C => break :ty .generic_poison, // could be `[*]T - [*]T` or `[*]T - usize`
26764 .one, .slice => break :ty lhs_ty, // invalid, let it error
26765 .many, .c => break :ty .generic_poison, // could be `[*]T - [*]T` or `[*]T - usize`
2676626766 }
2676726767 },
2676826768 };
......@@ -27556,7 +27556,7 @@ fn fieldVal(
2755627556 .child = Type.fromInterned(ptr_info.child).childType(zcu).toIntern(),
2755727557 .sentinel = if (inner_ty.sentinel(zcu)) |s| s.toIntern() else .none,
2755827558 .flags = .{
27559 .size = .Many,
27559 .size = .many,
2756027560 .alignment = ptr_info.flags.alignment,
2756127561 .is_const = ptr_info.flags.is_const,
2756227562 .is_volatile = ptr_info.flags.is_volatile,
......@@ -27578,7 +27578,7 @@ fn fieldVal(
2757827578 },
2757927579 .pointer => {
2758027580 const ptr_info = inner_ty.ptrInfo(zcu);
27581 if (ptr_info.flags.size == .Slice) {
27581 if (ptr_info.flags.size == .slice) {
2758227582 if (field_name.eqlSlice("ptr", ip)) {
2758327583 const slice = if (is_pointer_to)
2758427584 try sema.analyzeLoad(block, src, object, object_src)
......@@ -27740,7 +27740,7 @@ fn fieldPtr(
2774027740 .child = Type.fromInterned(ptr_info.child).childType(zcu).toIntern(),
2774127741 .sentinel = if (object_ty.sentinel(zcu)) |s| s.toIntern() else .none,
2774227742 .flags = .{
27743 .size = .Many,
27743 .size = .many,
2774427744 .alignment = ptr_info.flags.alignment,
2774527745 .is_const = ptr_info.flags.is_const,
2774627746 .is_volatile = ptr_info.flags.is_volatile,
......@@ -27953,13 +27953,13 @@ fn fieldCallBind(
2795327953 const ip = &zcu.intern_pool;
2795427954 const raw_ptr_src = src; // TODO better source location
2795527955 const raw_ptr_ty = sema.typeOf(raw_ptr);
27956 const inner_ty = if (raw_ptr_ty.zigTypeTag(zcu) == .pointer and (raw_ptr_ty.ptrSize(zcu) == .One or raw_ptr_ty.ptrSize(zcu) == .C))
27956 const inner_ty = if (raw_ptr_ty.zigTypeTag(zcu) == .pointer and (raw_ptr_ty.ptrSize(zcu) == .one or raw_ptr_ty.ptrSize(zcu) == .c))
2795727957 raw_ptr_ty.childType(zcu)
2795827958 else
2795927959 return sema.fail(block, raw_ptr_src, "expected single pointer, found '{}'", .{raw_ptr_ty.fmt(pt)});
2796027960
2796127961 // Optionally dereference a second pointer to get the concrete type.
27962 const is_double_ptr = inner_ty.zigTypeTag(zcu) == .pointer and inner_ty.ptrSize(zcu) == .One;
27962 const is_double_ptr = inner_ty.zigTypeTag(zcu) == .pointer and inner_ty.ptrSize(zcu) == .one;
2796327963 const concrete_ty = if (is_double_ptr) inner_ty.childType(zcu) else inner_ty;
2796427964 const ptr_ty = if (is_double_ptr) inner_ty else raw_ptr_ty;
2796527965 const object_ptr = if (is_double_ptr)
......@@ -28025,8 +28025,8 @@ fn fieldCallBind(
2802528025 const first_param_type = Type.fromInterned(func_type.param_types.get(ip)[0]);
2802628026 if (first_param_type.isGenericPoison() or
2802728027 (first_param_type.zigTypeTag(zcu) == .pointer and
28028 (first_param_type.ptrSize(zcu) == .One or
28029 first_param_type.ptrSize(zcu) == .C) and
28028 (first_param_type.ptrSize(zcu) == .one or
28029 first_param_type.ptrSize(zcu) == .c) and
2803028030 first_param_type.childType(zcu).eql(concrete_ty, zcu)))
2803128031 {
2803228032 // Note that if the param type is generic poison, we know that it must
......@@ -28053,7 +28053,7 @@ fn fieldCallBind(
2805328053 .arg0_inst = deref,
2805428054 } };
2805528055 } else if (child.zigTypeTag(zcu) == .pointer and
28056 child.ptrSize(zcu) == .One and
28056 child.ptrSize(zcu) == .one and
2805728057 child.childType(zcu).eql(concrete_ty, zcu))
2805828058 {
2805928059 return .{ .method = .{
......@@ -28673,8 +28673,8 @@ fn elemPtrOneLayerOnly(
2867328673 try checkIndexable(sema, block, src, indexable_ty);
2867428674
2867528675 switch (indexable_ty.ptrSize(zcu)) {
28676 .Slice => return sema.elemPtrSlice(block, src, indexable_src, indexable, elem_index_src, elem_index, oob_safety),
28677 .Many, .C => {
28676 .slice => return sema.elemPtrSlice(block, src, indexable_src, indexable, elem_index_src, elem_index, oob_safety),
28677 .many, .c => {
2867828678 const maybe_ptr_val = try sema.resolveDefinedValue(block, indexable_src, indexable);
2867928679 const maybe_index_val = try sema.resolveDefinedValue(block, elem_index_src, elem_index);
2868028680 ct: {
......@@ -28688,7 +28688,7 @@ fn elemPtrOneLayerOnly(
2868828688
2868928689 return block.addPtrElemPtr(indexable, elem_index, result_ty);
2869028690 },
28691 .One => {
28691 .one => {
2869228692 const child_ty = indexable_ty.childType(zcu);
2869328693 const elem_ptr = switch (child_ty.zigTypeTag(zcu)) {
2869428694 .array, .vector => try sema.elemPtrArray(block, src, indexable_src, indexable, elem_index_src, elem_index, init, oob_safety),
......@@ -28728,8 +28728,8 @@ fn elemVal(
2872828728
2872928729 switch (indexable_ty.zigTypeTag(zcu)) {
2873028730 .pointer => switch (indexable_ty.ptrSize(zcu)) {
28731 .Slice => return sema.elemValSlice(block, src, indexable_src, indexable, elem_index_src, elem_index, oob_safety),
28732 .Many, .C => {
28731 .slice => return sema.elemValSlice(block, src, indexable_src, indexable, elem_index_src, elem_index, oob_safety),
28732 .many, .c => {
2873328733 const maybe_indexable_val = try sema.resolveDefinedValue(block, indexable_src, indexable);
2873428734 const maybe_index_val = try sema.resolveDefinedValue(block, elem_index_src, elem_index);
2873528735
......@@ -28748,7 +28748,7 @@ fn elemVal(
2874828748
2874928749 return block.addBinOp(.ptr_elem_val, indexable, elem_index);
2875028750 },
28751 .One => {
28751 .one => {
2875228752 arr_sent: {
2875328753 const inner_ty = indexable_ty.childType(zcu);
2875428754 if (inner_ty.zigTypeTag(zcu) != .array) break :arr_sent;
......@@ -29293,7 +29293,7 @@ fn coerceExtra(
2929329293
2929429294 // *T to *[1]T
2929529295 single_item: {
29296 if (dest_info.flags.size != .One) break :single_item;
29296 if (dest_info.flags.size != .one) break :single_item;
2929729297 if (!inst_ty.isSinglePointer(zcu)) break :single_item;
2929829298 if (!sema.checkPtrAttributes(dest_ty, inst_ty, &in_memory_result)) break :pointer;
2929929299 const ptr_elem_ty = inst_ty.childType(zcu);
......@@ -29312,7 +29312,7 @@ fn coerceExtra(
2931229312 // Coercions where the source is a single pointer to an array.
2931329313 src_array_ptr: {
2931429314 if (!inst_ty.isSinglePointer(zcu)) break :src_array_ptr;
29315 if (dest_info.flags.size == .One) break :src_array_ptr; // `*[n]T` -> `*T` isn't valid
29315 if (dest_info.flags.size == .one) break :src_array_ptr; // `*[n]T` -> `*T` isn't valid
2931629316 if (!sema.checkPtrAttributes(dest_ty, inst_ty, &in_memory_result)) break :pointer;
2931729317 const array_ty = inst_ty.childType(zcu);
2931829318 if (array_ty.zigTypeTag(zcu) != .array) break :src_array_ptr;
......@@ -29356,25 +29356,25 @@ fn coerceExtra(
2935629356 }
2935729357
2935829358 switch (dest_info.flags.size) {
29359 .Slice => {
29359 .slice => {
2936029360 // *[N]T to []T
2936129361 return sema.coerceArrayPtrToSlice(block, dest_ty, inst, inst_src);
2936229362 },
29363 .C => {
29363 .c => {
2936429364 // *[N]T to [*c]T
2936529365 return sema.coerceCompatiblePtrs(block, dest_ty, inst, inst_src);
2936629366 },
29367 .Many => {
29367 .many => {
2936829368 // *[N]T to [*]T
2936929369 return sema.coerceCompatiblePtrs(block, dest_ty, inst, inst_src);
2937029370 },
29371 .One => unreachable, // early exit at top of block
29371 .one => unreachable, // early exit at top of block
2937229372 }
2937329373 }
2937429374
2937529375 // coercion from C pointer
2937629376 if (inst_ty.isCPtr(zcu)) src_c_ptr: {
29377 if (dest_info.flags.size == .Slice) break :src_c_ptr;
29377 if (dest_info.flags.size == .slice) break :src_c_ptr;
2937829378 if (!sema.checkPtrAttributes(dest_ty, inst_ty, &in_memory_result)) break :src_c_ptr;
2937929379 // In this case we must add a safety check because the C pointer
2938029380 // could be null.
......@@ -29413,7 +29413,7 @@ fn coerceExtra(
2941329413
2941429414 switch (dest_info.flags.size) {
2941529415 // coercion to C pointer
29416 .C => switch (inst_ty.zigTypeTag(zcu)) {
29416 .c => switch (inst_ty.zigTypeTag(zcu)) {
2941729417 .null => return Air.internedToRef(try pt.intern(.{ .ptr = .{
2941829418 .ty = dest_ty.toIntern(),
2941929419 .base_addr = .int,
......@@ -29457,7 +29457,7 @@ fn coerceExtra(
2945729457 .ok => {},
2945829458 else => break :p,
2945929459 }
29460 if (inst_info.flags.size == .Slice) {
29460 if (inst_info.flags.size == .slice) {
2946129461 assert(dest_info.sentinel == .none);
2946229462 if (inst_info.sentinel == .none or
2946329463 inst_info.sentinel != (try pt.intValue(Type.fromInterned(inst_info.child), 0)).toIntern())
......@@ -29470,8 +29470,8 @@ fn coerceExtra(
2947029470 },
2947129471 else => {},
2947229472 },
29473 .One => {},
29474 .Slice => to_slice: {
29473 .one => {},
29474 .slice => to_slice: {
2947529475 if (inst_ty.zigTypeTag(zcu) == .array) {
2947629476 return sema.fail(
2947729477 block,
......@@ -29512,7 +29512,7 @@ fn coerceExtra(
2951229512 }
2951329513 return sema.coerceTupleToSlicePtrs(block, dest_ty, dest_ty_src, inst, inst_src);
2951429514 },
29515 .Many => p: {
29515 .many => p: {
2951629516 if (!inst_ty.isSlice(zcu)) break :p;
2951729517 if (!sema.checkPtrAttributes(dest_ty, inst_ty, &in_memory_result)) break :p;
2951829518 const inst_info = inst_ty.ptrInfo(zcu);
......@@ -30224,10 +30224,10 @@ const InMemoryCoercionResult = union(enum) {
3022430224
3022530225fn pointerSizeString(size: std.builtin.Type.Pointer.Size) []const u8 {
3022630226 return switch (size) {
30227 .One => "single pointer",
30228 .Many => "many pointer",
30229 .C => "C pointer",
30230 .Slice => "slice",
30227 .one => "single pointer",
30228 .many => "many pointer",
30229 .c => "C pointer",
30230 .slice => "slice",
3023130231 };
3023230232}
3023330233
......@@ -30775,7 +30775,7 @@ fn coerceInMemoryAllowedPtrs(
3077530775 const src_info = src_ptr_ty.ptrInfo(zcu);
3077630776
3077730777 const ok_ptr_size = src_info.flags.size == dest_info.flags.size or
30778 src_info.flags.size == .C or dest_info.flags.size == .C;
30778 src_info.flags.size == .c or dest_info.flags.size == .c;
3077930779 if (!ok_ptr_size) {
3078030780 return InMemoryCoercionResult{ .ptr_size = .{
3078130781 .actual = src_info.flags.size,
......@@ -30874,7 +30874,7 @@ fn coerceInMemoryAllowedPtrs(
3087430874 if (ss != .none and ds != .none) {
3087530875 if (ds == try zcu.intern_pool.getCoerced(sema.gpa, pt.tid, ss, dest_info.child)) break :ok true;
3087630876 }
30877 if (src_info.flags.size == .C) break :ok true;
30877 if (src_info.flags.size == .c) break :ok true;
3087830878 if (!dest_is_mut and dest_info.sentinel == .none) break :ok true;
3087930879 break :ok false;
3088030880 };
......@@ -31392,7 +31392,7 @@ fn checkPtrAttributes(sema: *Sema, dest_ty: Type, inst_ty: Type, in_memory_resul
3139231392 const dest_info = dest_ty.ptrInfo(zcu);
3139331393 const inst_info = inst_ty.ptrInfo(zcu);
3139431394 const len0 = (Type.fromInterned(inst_info.child).zigTypeTag(zcu) == .array and (Type.fromInterned(inst_info.child).arrayLenIncludingSentinel(zcu) == 0 or
31395 (Type.fromInterned(inst_info.child).arrayLen(zcu) == 0 and dest_info.sentinel == .none and dest_info.flags.size != .C and dest_info.flags.size != .Many))) or
31395 (Type.fromInterned(inst_info.child).arrayLen(zcu) == 0 and dest_info.sentinel == .none and dest_info.flags.size != .c and dest_info.flags.size != .many))) or
3139631396 (Type.fromInterned(inst_info.child).isTuple(zcu) and Type.fromInterned(inst_info.child).structFieldCount(zcu) == 0);
3139731397
3139831398 const ok_const = (!inst_info.flags.is_const or dest_info.flags.is_const) or len0;
......@@ -32631,7 +32631,7 @@ fn analyzeSlice(
3263132631 elem_ty = ptr_ptr_child_ty.childType(zcu);
3263232632 },
3263332633 .pointer => switch (ptr_ptr_child_ty.ptrSize(zcu)) {
32634 .One => {
32634 .one => {
3263532635 const double_child_ty = ptr_ptr_child_ty.childType(zcu);
3263632636 ptr_or_slice = try sema.analyzeLoad(block, src, ptr_ptr, ptr_src);
3263732637 if (double_child_ty.zigTypeTag(zcu) == .array) {
......@@ -32721,14 +32721,14 @@ fn analyzeSlice(
3272132721 elem_ty = double_child_ty;
3272232722 }
3272332723 },
32724 .Many, .C => {
32724 .many, .c => {
3272532725 ptr_sentinel = ptr_ptr_child_ty.sentinel(zcu);
3272632726 ptr_or_slice = try sema.analyzeLoad(block, src, ptr_ptr, ptr_src);
3272732727 slice_ty = ptr_ptr_child_ty;
3272832728 array_ty = ptr_ptr_child_ty;
3272932729 elem_ty = ptr_ptr_child_ty.childType(zcu);
3273032730
32731 if (ptr_ptr_child_ty.ptrSize(zcu) == .C) {
32731 if (ptr_ptr_child_ty.ptrSize(zcu) == .c) {
3273232732 if (try sema.resolveDefinedValue(block, ptr_src, ptr_or_slice)) |ptr_val| {
3273332733 if (ptr_val.isNull(zcu)) {
3273432734 return sema.fail(block, src, "slice of null pointer", .{});
......@@ -32736,7 +32736,7 @@ fn analyzeSlice(
3273632736 }
3273732737 }
3273832738 },
32739 .Slice => {
32739 .slice => {
3274032740 ptr_sentinel = ptr_ptr_child_ty.sentinel(zcu);
3274132741 ptr_or_slice = try sema.analyzeLoad(block, src, ptr_ptr, ptr_src);
3274232742 slice_ty = ptr_ptr_child_ty;
......@@ -32752,9 +32752,9 @@ fn analyzeSlice(
3275232752 else if (array_ty.zigTypeTag(zcu) == .array) ptr: {
3275332753 var manyptr_ty_key = zcu.intern_pool.indexToKey(slice_ty.toIntern()).ptr_type;
3275432754 assert(manyptr_ty_key.child == array_ty.toIntern());
32755 assert(manyptr_ty_key.flags.size == .One);
32755 assert(manyptr_ty_key.flags.size == .one);
3275632756 manyptr_ty_key.child = elem_ty.toIntern();
32757 manyptr_ty_key.flags.size = .Many;
32757 manyptr_ty_key.flags.size = .many;
3275832758 break :ptr try sema.coerceCompatiblePtrs(block, try pt.ptrTypeSema(manyptr_ty_key), ptr_or_slice, ptr_src);
3275932759 } else ptr_or_slice;
3276032760
......@@ -32967,7 +32967,7 @@ fn analyzeSlice(
3296732967 const opt_new_len_val = try sema.resolveDefinedValue(block, src, new_len);
3296832968
3296932969 const new_ptr_ty_info = new_ptr_ty.ptrInfo(zcu);
32970 const new_allowzero = new_ptr_ty_info.flags.is_allowzero and sema.typeOf(ptr).ptrSize(zcu) != .C;
32970 const new_allowzero = new_ptr_ty_info.flags.is_allowzero and sema.typeOf(ptr).ptrSize(zcu) != .c;
3297132971
3297232972 if (opt_new_len_val) |new_len_val| {
3297332973 const new_len_int = try new_len_val.toUnsignedIntSema(pt);
......@@ -33038,7 +33038,7 @@ fn analyzeSlice(
3303833038 .child = elem_ty.toIntern(),
3303933039 .sentinel = if (sentinel) |s| s.toIntern() else .none,
3304033040 .flags = .{
33041 .size = .Slice,
33041 .size = .slice,
3304233042 .alignment = new_ptr_ty_info.flags.alignment,
3304333043 .is_const = new_ptr_ty_info.flags.is_const,
3304433044 .is_volatile = new_ptr_ty_info.flags.is_volatile,
......@@ -33739,7 +33739,7 @@ const PeerResolveStrategy = enum {
3373933739 .int => .fixed_int,
3374033740 .comptime_float => .comptime_float,
3374133741 .float => .fixed_float,
33742 .pointer => if (ty.ptrInfo(zcu).flags.size == .C) .c_ptr else .ptr,
33742 .pointer => if (ty.ptrInfo(zcu).flags.size == .c) .c_ptr else .ptr,
3374333743 .array => .array,
3374433744 .vector => .vector,
3374533745 .optional => .optional,
......@@ -34235,7 +34235,7 @@ fn resolvePeerTypesInner(
3423534235
3423634236 var ptr_info = opt_ptr_info orelse {
3423734237 opt_ptr_info = peer_info;
34238 opt_ptr_info.?.flags.size = .C;
34238 opt_ptr_info.?.flags.size = .c;
3423934239 first_idx = i;
3424034240 continue;
3424134241 };
......@@ -34323,9 +34323,9 @@ fn resolvePeerTypesInner(
3432334323 };
3432434324
3432534325 switch (peer_info.flags.size) {
34326 .One, .Many => {},
34327 .Slice => opt_slice_idx = i,
34328 .C => return .{ .conflict = .{
34326 .one, .many => {},
34327 .slice => opt_slice_idx = i,
34328 .c => return .{ .conflict = .{
3432934329 .peer_idx_a = strat_reason,
3433034330 .peer_idx_b = i,
3433134331 } },
......@@ -34370,21 +34370,21 @@ fn resolvePeerTypesInner(
3437034370 ptr_info.flags.is_allowzero = ptr_info.flags.is_allowzero or peer_info.flags.is_allowzero;
3437134371
3437234372 const peer_sentinel: InternPool.Index = switch (peer_info.flags.size) {
34373 .One => switch (ip.indexToKey(peer_info.child)) {
34373 .one => switch (ip.indexToKey(peer_info.child)) {
3437434374 .array_type => |array_type| array_type.sentinel,
3437534375 else => .none,
3437634376 },
34377 .Many, .Slice => peer_info.sentinel,
34378 .C => unreachable,
34377 .many, .slice => peer_info.sentinel,
34378 .c => unreachable,
3437934379 };
3438034380
3438134381 const cur_sentinel: InternPool.Index = switch (ptr_info.flags.size) {
34382 .One => switch (ip.indexToKey(ptr_info.child)) {
34382 .one => switch (ip.indexToKey(ptr_info.child)) {
3438334383 .array_type => |array_type| array_type.sentinel,
3438434384 else => .none,
3438534385 },
34386 .Many, .Slice => ptr_info.sentinel,
34387 .C => unreachable,
34386 .many, .slice => ptr_info.sentinel,
34387 .c => unreachable,
3438834388 };
3438934389
3439034390 // We abstract array handling slightly so that tuple pointers can work like array pointers
......@@ -34395,8 +34395,8 @@ fn resolvePeerTypesInner(
3439534395 // single-pointer array sentinel).
3439634396 good: {
3439734397 switch (peer_info.flags.size) {
34398 .One => switch (ptr_info.flags.size) {
34399 .One => {
34398 .one => switch (ptr_info.flags.size) {
34399 .one => {
3440034400 if (try sema.resolvePairInMemoryCoercible(block, src, Type.fromInterned(ptr_info.child), Type.fromInterned(peer_info.child))) |pointee| {
3440134401 ptr_info.child = pointee.toIntern();
3440234402 break :good;
......@@ -34415,28 +34415,28 @@ fn resolvePeerTypesInner(
3441534415 break :good;
3441634416 }
3441734417 // *[a]T + *[b]T = []T
34418 ptr_info.flags.size = .Slice;
34418 ptr_info.flags.size = .slice;
3441934419 ptr_info.child = elem_ty.toIntern();
3442034420 break :good;
3442134421 }
3442234422
3442334423 if (peer_arr.elem_ty.toIntern() == .noreturn_type) {
3442434424 // *struct{} + *[a]T = []T
34425 ptr_info.flags.size = .Slice;
34425 ptr_info.flags.size = .slice;
3442634426 ptr_info.child = cur_arr.elem_ty.toIntern();
3442734427 break :good;
3442834428 }
3442934429
3443034430 if (cur_arr.elem_ty.toIntern() == .noreturn_type) {
3443134431 // *[a]T + *struct{} = []T
34432 ptr_info.flags.size = .Slice;
34432 ptr_info.flags.size = .slice;
3443334433 ptr_info.child = peer_arr.elem_ty.toIntern();
3443434434 break :good;
3443534435 }
3443634436
3443734437 return generic_err;
3443834438 },
34439 .Many => {
34439 .many => {
3444034440 // Only works for *[n]T + [*]T -> [*]T
3444134441 const arr = peer_pointee_array orelse return generic_err;
3444234442 if (try sema.resolvePairInMemoryCoercible(block, src, Type.fromInterned(ptr_info.child), arr.elem_ty)) |pointee| {
......@@ -34449,7 +34449,7 @@ fn resolvePeerTypesInner(
3444934449 }
3445034450 return generic_err;
3445134451 },
34452 .Slice => {
34452 .slice => {
3445334453 // Only works for *[n]T + []T -> []T
3445434454 const arr = peer_pointee_array orelse return generic_err;
3445534455 if (try sema.resolvePairInMemoryCoercible(block, src, Type.fromInterned(ptr_info.child), arr.elem_ty)) |pointee| {
......@@ -34462,33 +34462,33 @@ fn resolvePeerTypesInner(
3446234462 }
3446334463 return generic_err;
3446434464 },
34465 .C => unreachable,
34465 .c => unreachable,
3446634466 },
34467 .Many => switch (ptr_info.flags.size) {
34468 .One => {
34467 .many => switch (ptr_info.flags.size) {
34468 .one => {
3446934469 // Only works for [*]T + *[n]T -> [*]T
3447034470 const arr = cur_pointee_array orelse return generic_err;
3447134471 if (try sema.resolvePairInMemoryCoercible(block, src, arr.elem_ty, Type.fromInterned(peer_info.child))) |pointee| {
34472 ptr_info.flags.size = .Many;
34472 ptr_info.flags.size = .many;
3447334473 ptr_info.child = pointee.toIntern();
3447434474 break :good;
3447534475 }
3447634476 if (arr.elem_ty.toIntern() == .noreturn_type) {
3447734477 // [*]T + *struct{} -> [*]T
34478 ptr_info.flags.size = .Many;
34478 ptr_info.flags.size = .many;
3447934479 ptr_info.child = peer_info.child;
3448034480 break :good;
3448134481 }
3448234482 return generic_err;
3448334483 },
34484 .Many => {
34484 .many => {
3448534485 if (try sema.resolvePairInMemoryCoercible(block, src, Type.fromInterned(ptr_info.child), Type.fromInterned(peer_info.child))) |pointee| {
3448634486 ptr_info.child = pointee.toIntern();
3448734487 break :good;
3448834488 }
3448934489 return generic_err;
3449034490 },
34491 .Slice => {
34491 .slice => {
3449234492 // Only works if no peers are actually slices
3449334493 if (opt_slice_idx) |slice_idx| {
3449434494 return .{ .conflict = .{
......@@ -34498,54 +34498,54 @@ fn resolvePeerTypesInner(
3449834498 }
3449934499 // Okay, then works for [*]T + "[]T" -> [*]T
3450034500 if (try sema.resolvePairInMemoryCoercible(block, src, Type.fromInterned(ptr_info.child), Type.fromInterned(peer_info.child))) |pointee| {
34501 ptr_info.flags.size = .Many;
34501 ptr_info.flags.size = .many;
3450234502 ptr_info.child = pointee.toIntern();
3450334503 break :good;
3450434504 }
3450534505 return generic_err;
3450634506 },
34507 .C => unreachable,
34507 .c => unreachable,
3450834508 },
34509 .Slice => switch (ptr_info.flags.size) {
34510 .One => {
34509 .slice => switch (ptr_info.flags.size) {
34510 .one => {
3451134511 // Only works for []T + *[n]T -> []T
3451234512 const arr = cur_pointee_array orelse return generic_err;
3451334513 if (try sema.resolvePairInMemoryCoercible(block, src, arr.elem_ty, Type.fromInterned(peer_info.child))) |pointee| {
34514 ptr_info.flags.size = .Slice;
34514 ptr_info.flags.size = .slice;
3451534515 ptr_info.child = pointee.toIntern();
3451634516 break :good;
3451734517 }
3451834518 if (arr.elem_ty.toIntern() == .noreturn_type) {
3451934519 // []T + *struct{} -> []T
34520 ptr_info.flags.size = .Slice;
34520 ptr_info.flags.size = .slice;
3452134521 ptr_info.child = peer_info.child;
3452234522 break :good;
3452334523 }
3452434524 return generic_err;
3452534525 },
34526 .Many => {
34526 .many => {
3452734527 // Impossible! (current peer is an actual slice)
3452834528 return generic_err;
3452934529 },
34530 .Slice => {
34530 .slice => {
3453134531 if (try sema.resolvePairInMemoryCoercible(block, src, Type.fromInterned(ptr_info.child), Type.fromInterned(peer_info.child))) |pointee| {
3453234532 ptr_info.child = pointee.toIntern();
3453334533 break :good;
3453434534 }
3453534535 return generic_err;
3453634536 },
34537 .C => unreachable,
34537 .c => unreachable,
3453834538 },
34539 .C => unreachable,
34539 .c => unreachable,
3454034540 }
3454134541 }
3454234542
3454334543 const sentinel_ty = switch (ptr_info.flags.size) {
34544 .One => switch (ip.indexToKey(ptr_info.child)) {
34544 .one => switch (ip.indexToKey(ptr_info.child)) {
3454534545 .array_type => |array_type| array_type.child,
3454634546 else => ptr_info.child,
3454734547 },
34548 .Many, .Slice, .C => ptr_info.child,
34548 .many, .slice, .c => ptr_info.child,
3454934549 };
3455034550
3455134551 sentinel: {
......@@ -34556,7 +34556,7 @@ fn resolvePeerTypesInner(
3455634556 const cur_sent_coerced = try ip.getCoerced(sema.gpa, pt.tid, cur_sentinel, sentinel_ty);
3455734557 if (peer_sent_coerced != cur_sent_coerced) break :no_sentinel;
3455834558 // Sentinels match
34559 if (ptr_info.flags.size == .One) switch (ip.indexToKey(ptr_info.child)) {
34559 if (ptr_info.flags.size == .one) switch (ip.indexToKey(ptr_info.child)) {
3456034560 .array_type => |array_type| ptr_info.child = (try pt.arrayType(.{
3456134561 .len = array_type.len,
3456234562 .child = array_type.child,
......@@ -35416,8 +35416,8 @@ fn checkMemOperand(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) !void
3541635416 const zcu = pt.zcu;
3541735417 if (ty.zigTypeTag(zcu) == .pointer) {
3541835418 switch (ty.ptrSize(zcu)) {
35419 .Slice, .Many, .C => return,
35420 .One => {
35419 .slice, .many, .c => return,
35420 .one => {
3542135421 const elem_ty = ty.childType(zcu);
3542235422 if (elem_ty.zigTypeTag(zcu) == .array) return;
3542335423 // TODO https://github.com/ziglang/zig/issues/15479
......@@ -37248,13 +37248,13 @@ fn typePtrOrOptionalPtrTy(sema: *Sema, ty: Type) !?Type {
3724837248 const zcu = pt.zcu;
3724937249 return switch (zcu.intern_pool.indexToKey(ty.toIntern())) {
3725037250 .ptr_type => |ptr_type| switch (ptr_type.flags.size) {
37251 .One, .Many, .C => ty,
37252 .Slice => null,
37251 .one, .many, .c => ty,
37252 .slice => null,
3725337253 },
3725437254 .opt_type => |opt_child| switch (zcu.intern_pool.indexToKey(opt_child)) {
3725537255 .ptr_type => |ptr_type| switch (ptr_type.flags.size) {
37256 .Slice, .C => null,
37257 .Many, .One => {
37256 .slice, .c => null,
37257 .many, .one => {
3725837258 if (ptr_type.flags.is_allowzero) return null;
3725937259
3726037260 // optionals of zero sized types behave like bools, not pointers
......@@ -38260,7 +38260,7 @@ fn maybeDerefSliceAsArray(
3826038260 });
3826138261 const ptr_ty = try pt.ptrTypeSema(p: {
3826238262 var p = Type.fromInterned(slice.ty).ptrInfo(zcu);
38263 p.flags.size = .One;
38263 p.flags.size = .one;
3826438264 p.child = array_ty.toIntern();
3826538265 p.sentinel = .none;
3826638266 break :p p;
src/Type.zig+32-32
......@@ -192,16 +192,16 @@ pub fn print(ty: Type, writer: anytype, pt: Zcu.PerThread) @TypeOf(writer).Error
192192 const info = ty.ptrInfo(zcu);
193193
194194 if (info.sentinel != .none) switch (info.flags.size) {
195 .One, .C => unreachable,
196 .Many => try writer.print("[*:{}]", .{Value.fromInterned(info.sentinel).fmtValue(pt)}),
197 .Slice => try writer.print("[:{}]", .{Value.fromInterned(info.sentinel).fmtValue(pt)}),
195 .one, .c => unreachable,
196 .many => try writer.print("[*:{}]", .{Value.fromInterned(info.sentinel).fmtValue(pt)}),
197 .slice => try writer.print("[:{}]", .{Value.fromInterned(info.sentinel).fmtValue(pt)}),
198198 } else switch (info.flags.size) {
199 .One => try writer.writeAll("*"),
200 .Many => try writer.writeAll("[*]"),
201 .C => try writer.writeAll("[*c]"),
202 .Slice => try writer.writeAll("[]"),
199 .one => try writer.writeAll("*"),
200 .many => try writer.writeAll("[*]"),
201 .c => try writer.writeAll("[*c]"),
202 .slice => try writer.writeAll("[]"),
203203 }
204 if (info.flags.is_allowzero and info.flags.size != .C) try writer.writeAll("allowzero ");
204 if (info.flags.is_allowzero and info.flags.size != .c) try writer.writeAll("allowzero ");
205205 if (info.flags.alignment != .none or
206206 info.packed_offset.host_size != 0 or
207207 info.flags.vector_index != .none)
......@@ -686,7 +686,7 @@ pub fn hasWellDefinedLayout(ty: Type, zcu: *const Zcu) bool {
686686
687687 .array_type => |array_type| Type.fromInterned(array_type.child).hasWellDefinedLayout(zcu),
688688 .opt_type => ty.isPtrLikeOptional(zcu),
689 .ptr_type => |ptr_type| ptr_type.flags.size != .Slice,
689 .ptr_type => |ptr_type| ptr_type.flags.size != .slice,
690690
691691 .simple_type => |t| switch (t) {
692692 .f16,
......@@ -1303,7 +1303,7 @@ pub fn abiSizeInner(
13031303 return .{ .scalar = intAbiSize(int_type.bits, target, use_llvm) };
13041304 },
13051305 .ptr_type => |ptr_type| switch (ptr_type.flags.size) {
1306 .Slice => return .{ .scalar = @divExact(target.ptrBitWidth(), 8) * 2 },
1306 .slice => return .{ .scalar = @divExact(target.ptrBitWidth(), 8) * 2 },
13071307 else => return .{ .scalar = @divExact(target.ptrBitWidth(), 8) },
13081308 },
13091309 .anyframe_type => return .{ .scalar = @divExact(target.ptrBitWidth(), 8) },
......@@ -1741,7 +1741,7 @@ pub fn bitSizeInner(
17411741 switch (ip.indexToKey(ty.toIntern())) {
17421742 .int_type => |int_type| return int_type.bits,
17431743 .ptr_type => |ptr_type| switch (ptr_type.flags.size) {
1744 .Slice => return target.ptrBitWidth() * 2,
1744 .slice => return target.ptrBitWidth() * 2,
17451745 else => return target.ptrBitWidth(),
17461746 },
17471747 .anyframe_type => return target.ptrBitWidth(),
......@@ -1903,7 +1903,7 @@ pub fn layoutIsResolved(ty: Type, zcu: *const Zcu) bool {
19031903
19041904pub fn isSinglePointer(ty: Type, zcu: *const Zcu) bool {
19051905 return switch (zcu.intern_pool.indexToKey(ty.toIntern())) {
1906 .ptr_type => |ptr_info| ptr_info.flags.size == .One,
1906 .ptr_type => |ptr_info| ptr_info.flags.size == .one,
19071907 else => false,
19081908 };
19091909}
......@@ -1923,7 +1923,7 @@ pub fn ptrSizeOrNull(ty: Type, zcu: *const Zcu) ?std.builtin.Type.Pointer.Size {
19231923
19241924pub fn isSlice(ty: Type, zcu: *const Zcu) bool {
19251925 return switch (zcu.intern_pool.indexToKey(ty.toIntern())) {
1926 .ptr_type => |ptr_type| ptr_type.flags.size == .Slice,
1926 .ptr_type => |ptr_type| ptr_type.flags.size == .slice,
19271927 else => false,
19281928 };
19291929}
......@@ -1960,7 +1960,7 @@ pub fn isAllowzeroPtr(ty: Type, zcu: *const Zcu) bool {
19601960
19611961pub fn isCPtr(ty: Type, zcu: *const Zcu) bool {
19621962 return switch (zcu.intern_pool.indexToKey(ty.toIntern())) {
1963 .ptr_type => |ptr_type| ptr_type.flags.size == .C,
1963 .ptr_type => |ptr_type| ptr_type.flags.size == .c,
19641964 else => false,
19651965 };
19661966}
......@@ -1968,13 +1968,13 @@ pub fn isCPtr(ty: Type, zcu: *const Zcu) bool {
19681968pub fn isPtrAtRuntime(ty: Type, zcu: *const Zcu) bool {
19691969 return switch (zcu.intern_pool.indexToKey(ty.toIntern())) {
19701970 .ptr_type => |ptr_type| switch (ptr_type.flags.size) {
1971 .Slice => false,
1972 .One, .Many, .C => true,
1971 .slice => false,
1972 .one, .many, .c => true,
19731973 },
19741974 .opt_type => |child| switch (zcu.intern_pool.indexToKey(child)) {
19751975 .ptr_type => |p| switch (p.flags.size) {
1976 .Slice, .C => false,
1977 .Many, .One => !p.flags.is_allowzero,
1976 .slice, .c => false,
1977 .many, .one => !p.flags.is_allowzero,
19781978 },
19791979 else => false,
19801980 },
......@@ -1995,11 +1995,11 @@ pub fn ptrAllowsZero(ty: Type, zcu: *const Zcu) bool {
19951995pub fn optionalReprIsPayload(ty: Type, zcu: *const Zcu) bool {
19961996 return switch (zcu.intern_pool.indexToKey(ty.toIntern())) {
19971997 .opt_type => |child_type| child_type == .anyerror_type or switch (zcu.intern_pool.indexToKey(child_type)) {
1998 .ptr_type => |ptr_type| ptr_type.flags.size != .C and !ptr_type.flags.is_allowzero,
1998 .ptr_type => |ptr_type| ptr_type.flags.size != .c and !ptr_type.flags.is_allowzero,
19991999 .error_set_type, .inferred_error_set_type => true,
20002000 else => false,
20012001 },
2002 .ptr_type => |ptr_type| ptr_type.flags.size == .C,
2002 .ptr_type => |ptr_type| ptr_type.flags.size == .c,
20032003 else => false,
20042004 };
20052005}
......@@ -2009,11 +2009,11 @@ pub fn optionalReprIsPayload(ty: Type, zcu: *const Zcu) bool {
20092009/// This function must be kept in sync with `Sema.typePtrOrOptionalPtrTy`.
20102010pub fn isPtrLikeOptional(ty: Type, zcu: *const Zcu) bool {
20112011 return switch (zcu.intern_pool.indexToKey(ty.toIntern())) {
2012 .ptr_type => |ptr_type| ptr_type.flags.size == .C,
2012 .ptr_type => |ptr_type| ptr_type.flags.size == .c,
20132013 .opt_type => |child| switch (zcu.intern_pool.indexToKey(child)) {
20142014 .ptr_type => |ptr_type| switch (ptr_type.flags.size) {
2015 .Slice, .C => false,
2016 .Many, .One => !ptr_type.flags.is_allowzero,
2015 .slice, .c => false,
2016 .many, .one => !ptr_type.flags.is_allowzero,
20172017 },
20182018 else => false,
20192019 },
......@@ -2044,8 +2044,8 @@ pub fn childTypeIp(ty: Type, ip: *const InternPool) Type {
20442044pub fn elemType2(ty: Type, zcu: *const Zcu) Type {
20452045 return switch (zcu.intern_pool.indexToKey(ty.toIntern())) {
20462046 .ptr_type => |ptr_type| switch (ptr_type.flags.size) {
2047 .One => Type.fromInterned(ptr_type.child).shallowElemType(zcu),
2048 .Many, .C, .Slice => Type.fromInterned(ptr_type.child),
2047 .one => Type.fromInterned(ptr_type.child).shallowElemType(zcu),
2048 .many, .c, .slice => Type.fromInterned(ptr_type.child),
20492049 },
20502050 .anyframe_type => |child| {
20512051 assert(child != .none);
......@@ -2079,7 +2079,7 @@ pub fn optionalChild(ty: Type, zcu: *const Zcu) Type {
20792079 return switch (zcu.intern_pool.indexToKey(ty.toIntern())) {
20802080 .opt_type => |child| Type.fromInterned(child),
20812081 .ptr_type => |ptr_type| b: {
2082 assert(ptr_type.flags.size == .C);
2082 assert(ptr_type.flags.size == .c);
20832083 break :b ty;
20842084 },
20852085 else => unreachable,
......@@ -2991,8 +2991,8 @@ pub fn isIndexable(ty: Type, zcu: *const Zcu) bool {
29912991 return switch (ty.zigTypeTag(zcu)) {
29922992 .array, .vector => true,
29932993 .pointer => switch (ty.ptrSize(zcu)) {
2994 .Slice, .Many, .C => true,
2995 .One => switch (ty.childType(zcu).zigTypeTag(zcu)) {
2994 .slice, .many, .c => true,
2995 .one => switch (ty.childType(zcu).zigTypeTag(zcu)) {
29962996 .array, .vector => true,
29972997 .@"struct" => ty.childType(zcu).isTuple(zcu),
29982998 else => false,
......@@ -3007,9 +3007,9 @@ pub fn indexableHasLen(ty: Type, zcu: *const Zcu) bool {
30073007 return switch (ty.zigTypeTag(zcu)) {
30083008 .array, .vector => true,
30093009 .pointer => switch (ty.ptrSize(zcu)) {
3010 .Many, .C => false,
3011 .Slice => true,
3012 .One => switch (ty.childType(zcu).zigTypeTag(zcu)) {
3010 .many, .c => false,
3011 .slice => true,
3012 .one => switch (ty.childType(zcu).zigTypeTag(zcu)) {
30133013 .array, .vector => true,
30143014 .@"struct" => ty.childType(zcu).isTuple(zcu),
30153015 else => false,
......@@ -4049,7 +4049,7 @@ pub fn elemPtrType(ptr_ty: Type, offset: ?usize, pt: Zcu.PerThread) !Type {
40494049 host_size: u16 = 0,
40504050 alignment: Alignment = .none,
40514051 vector_index: VI = .none,
4052 } = if (parent_ty.isVector(zcu) and ptr_info.flags.size == .One) blk: {
4052 } = if (parent_ty.isVector(zcu) and ptr_info.flags.size == .one) blk: {
40534053 const elem_bits = elem_ty.bitSize(zcu);
40544054 if (elem_bits == 0) break :blk .{};
40554055 const is_packed = elem_bits < 8 or !std.math.isPowerOfTwo(elem_bits);
src/Value.zig+16-16
......@@ -3724,7 +3724,7 @@ pub fn ptrOptPayload(parent_ptr: Value, pt: Zcu.PerThread) !Value {
37243724 const parent_ptr_ty = parent_ptr.typeOf(zcu);
37253725 const opt_ty = parent_ptr_ty.childType(zcu);
37263726
3727 assert(parent_ptr_ty.ptrSize(zcu) == .One);
3727 assert(parent_ptr_ty.ptrSize(zcu) == .one);
37283728 assert(opt_ty.zigTypeTag(zcu) == .optional);
37293729
37303730 const result_ty = try pt.ptrTypeSema(info: {
......@@ -3742,7 +3742,7 @@ pub fn ptrOptPayload(parent_ptr: Value, pt: Zcu.PerThread) !Value {
37423742 return pt.getCoerced(parent_ptr, result_ty);
37433743 }
37443744
3745 const base_ptr = try parent_ptr.canonicalizeBasePtr(.One, opt_ty, pt);
3745 const base_ptr = try parent_ptr.canonicalizeBasePtr(.one, opt_ty, pt);
37463746 return Value.fromInterned(try pt.intern(.{ .ptr = .{
37473747 .ty = result_ty.toIntern(),
37483748 .base_addr = .{ .opt_payload = base_ptr.toIntern() },
......@@ -3758,7 +3758,7 @@ pub fn ptrEuPayload(parent_ptr: Value, pt: Zcu.PerThread) !Value {
37583758 const parent_ptr_ty = parent_ptr.typeOf(zcu);
37593759 const eu_ty = parent_ptr_ty.childType(zcu);
37603760
3761 assert(parent_ptr_ty.ptrSize(zcu) == .One);
3761 assert(parent_ptr_ty.ptrSize(zcu) == .one);
37623762 assert(eu_ty.zigTypeTag(zcu) == .error_union);
37633763
37643764 const result_ty = try pt.ptrTypeSema(info: {
......@@ -3771,7 +3771,7 @@ pub fn ptrEuPayload(parent_ptr: Value, pt: Zcu.PerThread) !Value {
37713771
37723772 if (parent_ptr.isUndef(zcu)) return pt.undefValue(result_ty);
37733773
3774 const base_ptr = try parent_ptr.canonicalizeBasePtr(.One, eu_ty, pt);
3774 const base_ptr = try parent_ptr.canonicalizeBasePtr(.one, eu_ty, pt);
37753775 return Value.fromInterned(try pt.intern(.{ .ptr = .{
37763776 .ty = result_ty.toIntern(),
37773777 .base_addr = .{ .eu_payload = base_ptr.toIntern() },
......@@ -3789,7 +3789,7 @@ pub fn ptrField(parent_ptr: Value, field_idx: u32, pt: Zcu.PerThread) !Value {
37893789 const aggregate_ty = parent_ptr_ty.childType(zcu);
37903790
37913791 const parent_ptr_info = parent_ptr_ty.ptrInfo(zcu);
3792 assert(parent_ptr_info.flags.size == .One);
3792 assert(parent_ptr_info.flags.size == .one);
37933793
37943794 // Exiting this `switch` indicates that the `field` pointer representation should be used.
37953795 // `field_align` may be `.none` to represent the natural alignment of `field_ty`, but is not necessarily.
......@@ -3920,7 +3920,7 @@ pub fn ptrField(parent_ptr: Value, field_idx: u32, pt: Zcu.PerThread) !Value {
39203920
39213921 if (parent_ptr.isUndef(zcu)) return pt.undefValue(result_ty);
39223922
3923 const base_ptr = try parent_ptr.canonicalizeBasePtr(.One, aggregate_ty, pt);
3923 const base_ptr = try parent_ptr.canonicalizeBasePtr(.one, aggregate_ty, pt);
39243924 return Value.fromInterned(try pt.intern(.{ .ptr = .{
39253925 .ty = result_ty.toIntern(),
39263926 .base_addr = .{ .field = .{
......@@ -3937,8 +3937,8 @@ pub fn ptrField(parent_ptr: Value, field_idx: u32, pt: Zcu.PerThread) !Value {
39373937pub fn ptrElem(orig_parent_ptr: Value, field_idx: u64, pt: Zcu.PerThread) !Value {
39383938 const zcu = pt.zcu;
39393939 const parent_ptr = switch (orig_parent_ptr.typeOf(zcu).ptrSize(zcu)) {
3940 .One, .Many, .C => orig_parent_ptr,
3941 .Slice => orig_parent_ptr.slicePtr(zcu),
3940 .one, .many, .c => orig_parent_ptr,
3941 .slice => orig_parent_ptr.slicePtr(zcu),
39423942 };
39433943
39443944 const parent_ptr_ty = parent_ptr.typeOf(zcu);
......@@ -3959,7 +3959,7 @@ pub fn ptrElem(orig_parent_ptr: Value, field_idx: u64, pt: Zcu.PerThread) !Value
39593959 };
39603960
39613961 const strat: PtrStrat = switch (parent_ptr_ty.ptrSize(zcu)) {
3962 .One => switch (elem_ty.zigTypeTag(zcu)) {
3962 .one => switch (elem_ty.zigTypeTag(zcu)) {
39633963 .vector => .{ .offset = field_idx * @divExact(try elem_ty.childType(zcu).bitSizeSema(pt), 8) },
39643964 .array => strat: {
39653965 const arr_elem_ty = elem_ty.childType(zcu);
......@@ -3971,12 +3971,12 @@ pub fn ptrElem(orig_parent_ptr: Value, field_idx: u64, pt: Zcu.PerThread) !Value
39713971 else => unreachable,
39723972 },
39733973
3974 .Many, .C => if (try elem_ty.comptimeOnlySema(pt))
3974 .many, .c => if (try elem_ty.comptimeOnlySema(pt))
39753975 .{ .elem_ptr = elem_ty }
39763976 else
39773977 .{ .offset = field_idx * (try elem_ty.abiSizeInner(.sema, zcu, pt.tid)).scalar },
39783978
3979 .Slice => unreachable,
3979 .slice => unreachable,
39803980 };
39813981
39823982 switch (strat) {
......@@ -4004,7 +4004,7 @@ pub fn ptrElem(orig_parent_ptr: Value, field_idx: u64, pt: Zcu.PerThread) !Value
40044004 },
40054005 else => {},
40064006 }
4007 const base_ptr = try parent_ptr.canonicalizeBasePtr(.Many, arr_base_ty, pt);
4007 const base_ptr = try parent_ptr.canonicalizeBasePtr(.many, arr_base_ty, pt);
40084008 return Value.fromInterned(try pt.intern(.{ .ptr = .{
40094009 .ty = result_ty.toIntern(),
40104010 .base_addr = .{ .arr_elem = .{
......@@ -4234,7 +4234,7 @@ pub fn pointerDerivationAdvanced(ptr_val: Value, arena: Allocator, pt: Zcu.PerTh
42344234 .child = parent_ptr_info.child,
42354235 .flags = flags: {
42364236 var flags = parent_ptr_info.flags;
4237 flags.size = .One;
4237 flags.size = .one;
42384238 break :flags flags;
42394239 },
42404240 });
......@@ -4304,8 +4304,8 @@ pub fn pointerDerivationAdvanced(ptr_val: Value, arena: Allocator, pt: Zcu.PerTh
43044304 if (!cur_ty.isPtrLikeOptional(zcu)) break :ptr_opt;
43054305 if (need_child.zigTypeTag(zcu) != .pointer) break :ptr_opt;
43064306 switch (need_child.ptrSize(zcu)) {
4307 .One, .Many => {},
4308 .Slice, .C => break :ptr_opt,
4307 .one, .many => {},
4308 .slice, .c => break :ptr_opt,
43094309 }
43104310 const parent = try arena.create(PointerDeriveStep);
43114311 parent.* = cur_derive;
......@@ -4323,7 +4323,7 @@ pub fn pointerDerivationAdvanced(ptr_val: Value, arena: Allocator, pt: Zcu.PerTh
43234323 const elem_size = elem_ty.abiSize(zcu);
43244324 const start_idx = cur_offset / elem_size;
43254325 const end_idx = (cur_offset + need_bytes + elem_size - 1) / elem_size;
4326 if (end_idx == start_idx + 1 and ptr_ty_info.flags.size == .One) {
4326 if (end_idx == start_idx + 1 and ptr_ty_info.flags.size == .one) {
43274327 const parent = try arena.create(PointerDeriveStep);
43284328 parent.* = cur_derive;
43294329 cur_derive = .{ .elem_ptr = .{
src/Zcu/PerThread.zig+3-3
......@@ -3068,7 +3068,7 @@ pub fn populateTestFunctions(
30683068 .child = test_fn_ty.toIntern(),
30693069 .flags = .{
30703070 .is_const = true,
3071 .size = .Slice,
3071 .size = .slice,
30723072 },
30733073 });
30743074 const new_init = try pt.intern(.{ .slice = .{
......@@ -3303,7 +3303,7 @@ pub fn optionalType(pt: Zcu.PerThread, child_type: InternPool.Index) Allocator.E
33033303pub fn ptrType(pt: Zcu.PerThread, info: InternPool.Key.PtrType) Allocator.Error!Type {
33043304 var canon_info = info;
33053305
3306 if (info.flags.size == .C) canon_info.flags.is_allowzero = true;
3306 if (info.flags.size == .c) canon_info.flags.is_allowzero = true;
33073307
33083308 // Canonicalize non-zero alignment. If it matches the ABI alignment of the pointee
33093309 // type, we change it to 0 here. If this causes an assertion trip because the
......@@ -3360,7 +3360,7 @@ pub fn manyConstPtrType(pt: Zcu.PerThread, child_type: Type) Allocator.Error!Typ
33603360 return pt.ptrType(.{
33613361 .child = child_type.toIntern(),
33623362 .flags = .{
3363 .size = .Many,
3363 .size = .many,
33643364 .is_const = true,
33653365 },
33663366 });
src/arch/aarch64/CodeGen.zig+1-1
......@@ -2398,7 +2398,7 @@ fn ptrArithmetic(
23982398
23992399 const ptr_ty = lhs_ty;
24002400 const elem_ty = switch (ptr_ty.ptrSize(zcu)) {
2401 .One => ptr_ty.childType(zcu).childType(zcu), // ptr to array, so get array element type
2401 .one => ptr_ty.childType(zcu).childType(zcu), // ptr to array, so get array element type
24022402 else => ptr_ty.childType(zcu),
24032403 };
24042404 const elem_size = elem_ty.abiSize(zcu);
src/arch/arm/CodeGen.zig+1-1
......@@ -3919,7 +3919,7 @@ fn ptrArithmetic(
39193919
39203920 const ptr_ty = lhs_ty;
39213921 const elem_ty = switch (ptr_ty.ptrSize(zcu)) {
3922 .One => ptr_ty.childType(zcu).childType(zcu), // ptr to array, so get array element type
3922 .one => ptr_ty.childType(zcu).childType(zcu), // ptr to array, so get array element type
39233923 else => ptr_ty.childType(zcu),
39243924 };
39253925 const elem_size: u32 = @intCast(elem_ty.abiSize(zcu));
src/arch/riscv64/CodeGen.zig+11-11
......@@ -7843,15 +7843,15 @@ fn airMemset(func: *Func, inst: Air.Inst.Index, safety: bool) !void {
78437843 if (elem_abi_size == 1) {
78447844 const ptr: MCValue = switch (dst_ptr_ty.ptrSize(zcu)) {
78457845 // TODO: this only handles slices stored in the stack
7846 .Slice => dst_ptr,
7847 .One => dst_ptr,
7848 .C, .Many => unreachable,
7846 .slice => dst_ptr,
7847 .one => dst_ptr,
7848 .c, .many => unreachable,
78497849 };
78507850 const len: MCValue = switch (dst_ptr_ty.ptrSize(zcu)) {
78517851 // TODO: this only handles slices stored in the stack
7852 .Slice => dst_ptr.address().offset(8).deref(),
7853 .One => .{ .immediate = dst_ptr_ty.childType(zcu).arrayLen(zcu) },
7854 .C, .Many => unreachable,
7852 .slice => dst_ptr.address().offset(8).deref(),
7853 .one => .{ .immediate = dst_ptr_ty.childType(zcu).arrayLen(zcu) },
7854 .c, .many => unreachable,
78557855 };
78567856 const len_lock: ?RegisterLock = switch (len) {
78577857 .register => |reg| func.register_manager.lockRegAssumeUnused(reg),
......@@ -7867,8 +7867,8 @@ fn airMemset(func: *Func, inst: Air.Inst.Index, safety: bool) !void {
78677867 // Length zero requires a runtime check - so we handle arrays specially
78687868 // here to elide it.
78697869 switch (dst_ptr_ty.ptrSize(zcu)) {
7870 .Slice => return func.fail("TODO: airMemset Slices", .{}),
7871 .One => {
7870 .slice => return func.fail("TODO: airMemset Slices", .{}),
7871 .one => {
78727872 const elem_ptr_ty = try pt.singleMutPtrType(elem_ty);
78737873
78747874 const len = dst_ptr_ty.childType(zcu).arrayLen(zcu);
......@@ -7889,7 +7889,7 @@ fn airMemset(func: *Func, inst: Air.Inst.Index, safety: bool) !void {
78897889 const bytes_to_copy: MCValue = .{ .immediate = elem_abi_size * (len - 1) };
78907890 try func.genInlineMemcpy(second_elem_ptr_mcv, dst_ptr, bytes_to_copy);
78917891 },
7892 .C, .Many => unreachable,
7892 .c, .many => unreachable,
78937893 }
78947894 }
78957895 return func.finishAir(inst, .unreach, .{ bin_op.lhs, bin_op.rhs, .none });
......@@ -7906,7 +7906,7 @@ fn airMemcpy(func: *Func, inst: Air.Inst.Index) !void {
79067906 const dst_ty = func.typeOf(bin_op.lhs);
79077907
79087908 const len_mcv: MCValue = switch (dst_ty.ptrSize(zcu)) {
7909 .Slice => len: {
7909 .slice => len: {
79107910 const len_reg, const len_lock = try func.allocReg(.int);
79117911 defer func.register_manager.unlockReg(len_lock);
79127912
......@@ -7921,7 +7921,7 @@ fn airMemcpy(func: *Func, inst: Air.Inst.Index) !void {
79217921 );
79227922 break :len .{ .register = len_reg };
79237923 },
7924 .One => len: {
7924 .one => len: {
79257925 const array_ty = dst_ty.childType(zcu);
79267926 break :len .{ .immediate = array_ty.arrayLen(zcu) * array_ty.childType(zcu).abiSize(zcu) };
79277927 },
src/arch/riscv64/abi.zig+1-1
......@@ -109,7 +109,7 @@ pub fn classifySystem(ty: Type, zcu: *Zcu) [8]SystemClass {
109109 return result;
110110 },
111111 .pointer => switch (ty.ptrSize(zcu)) {
112 .Slice => {
112 .slice => {
113113 result[0] = .integer;
114114 result[1] = .integer;
115115 return result;
src/arch/sparc64/CodeGen.zig+1-1
......@@ -2953,7 +2953,7 @@ fn binOp(
29532953 .pointer => {
29542954 const ptr_ty = lhs_ty;
29552955 const elem_ty = switch (ptr_ty.ptrSize(zcu)) {
2956 .One => ptr_ty.childType(zcu).childType(zcu), // ptr to array, so get array element type
2956 .one => ptr_ty.childType(zcu).childType(zcu), // ptr to array, so get array element type
29572957 else => ptr_ty.childType(zcu),
29582958 };
29592959 const elem_size = elem_ty.abiSize(zcu);
src/arch/wasm/CodeGen.zig+8-8
......@@ -4726,7 +4726,7 @@ fn airPtrBinOp(cg: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void {
47264726 const offset = try cg.resolveInst(bin_op.rhs);
47274727 const ptr_ty = cg.typeOf(bin_op.lhs);
47284728 const pointee_ty = switch (ptr_ty.ptrSize(zcu)) {
4729 .One => ptr_ty.childType(zcu).childType(zcu), // ptr to array, so get array element type
4729 .one => ptr_ty.childType(zcu).childType(zcu), // ptr to array, so get array element type
47304730 else => ptr_ty.childType(zcu),
47314731 };
47324732
......@@ -4756,12 +4756,12 @@ fn airMemset(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void {
47564756 const ptr_ty = cg.typeOf(bin_op.lhs);
47574757 const value = try cg.resolveInst(bin_op.rhs);
47584758 const len = switch (ptr_ty.ptrSize(zcu)) {
4759 .Slice => try cg.sliceLen(ptr),
4760 .One => @as(WValue, .{ .imm32 = @as(u32, @intCast(ptr_ty.childType(zcu).arrayLen(zcu))) }),
4761 .C, .Many => unreachable,
4759 .slice => try cg.sliceLen(ptr),
4760 .one => @as(WValue, .{ .imm32 = @as(u32, @intCast(ptr_ty.childType(zcu).arrayLen(zcu))) }),
4761 .c, .many => unreachable,
47624762 };
47634763
4764 const elem_ty = if (ptr_ty.ptrSize(zcu) == .One)
4764 const elem_ty = if (ptr_ty.ptrSize(zcu) == .one)
47654765 ptr_ty.childType(zcu).childType(zcu)
47664766 else
47674767 ptr_ty.childType(zcu);
......@@ -5688,7 +5688,7 @@ fn airMemcpy(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
56885688 const src = try cg.resolveInst(bin_op.rhs);
56895689 const src_ty = cg.typeOf(bin_op.rhs);
56905690 const len = switch (dst_ty.ptrSize(zcu)) {
5691 .Slice => blk: {
5691 .slice => blk: {
56925692 const slice_len = try cg.sliceLen(dst);
56935693 if (ptr_elem_ty.abiSize(zcu) != 1) {
56945694 try cg.emitWValue(slice_len);
......@@ -5698,10 +5698,10 @@ fn airMemcpy(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
56985698 }
56995699 break :blk slice_len;
57005700 },
5701 .One => @as(WValue, .{
5701 .one => @as(WValue, .{
57025702 .imm32 = @as(u32, @intCast(ptr_elem_ty.arrayLen(zcu) * ptr_elem_ty.childType(zcu).abiSize(zcu))),
57035703 }),
5704 .C, .Many => unreachable,
5704 .c, .many => unreachable,
57055705 };
57065706 const dst_ptr = try cg.sliceOrArrayPtr(dst, dst_ty);
57075707 const src_ptr = try cg.sliceOrArrayPtr(src, src_ty);
src/arch/x86_64/CodeGen.zig+14-14
......@@ -9607,13 +9607,13 @@ fn genMulDivBinOp(
96079607 const manyptr_u32_ty = try pt.ptrType(.{
96089608 .child = .u32_type,
96099609 .flags = .{
9610 .size = .Many,
9610 .size = .many,
96119611 },
96129612 });
96139613 const manyptr_const_u32_ty = try pt.ptrType(.{
96149614 .child = .u32_type,
96159615 .flags = .{
9616 .size = .Many,
9616 .size = .many,
96179617 .is_const = true,
96189618 },
96199619 });
......@@ -16614,15 +16614,15 @@ fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void {
1661416614 if (elem_abi_size == 1) {
1661516615 const ptr: MCValue = switch (dst_ptr_ty.ptrSize(zcu)) {
1661616616 // TODO: this only handles slices stored in the stack
16617 .Slice => dst_ptr,
16618 .One => dst_ptr,
16619 .C, .Many => unreachable,
16617 .slice => dst_ptr,
16618 .one => dst_ptr,
16619 .c, .many => unreachable,
1662016620 };
1662116621 const len: MCValue = switch (dst_ptr_ty.ptrSize(zcu)) {
1662216622 // TODO: this only handles slices stored in the stack
16623 .Slice => dst_ptr.address().offset(8).deref(),
16624 .One => .{ .immediate = dst_ptr_ty.childType(zcu).arrayLen(zcu) },
16625 .C, .Many => unreachable,
16623 .slice => dst_ptr.address().offset(8).deref(),
16624 .one => .{ .immediate = dst_ptr_ty.childType(zcu).arrayLen(zcu) },
16625 .c, .many => unreachable,
1662616626 };
1662716627 const len_lock: ?RegisterLock = switch (len) {
1662816628 .register => |reg| self.register_manager.lockRegAssumeUnused(reg),
......@@ -16638,7 +16638,7 @@ fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void {
1663816638 // Length zero requires a runtime check - so we handle arrays specially
1663916639 // here to elide it.
1664016640 switch (dst_ptr_ty.ptrSize(zcu)) {
16641 .Slice => {
16641 .slice => {
1664216642 const slice_ptr_ty = dst_ptr_ty.slicePtrFieldType(zcu);
1664316643
1664416644 // TODO: this only handles slices stored in the stack
......@@ -16681,7 +16681,7 @@ fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void {
1668116681
1668216682 self.performReloc(skip_reloc);
1668316683 },
16684 .One => {
16684 .one => {
1668516685 const elem_ptr_ty = try pt.singleMutPtrType(elem_ty);
1668616686
1668716687 const len = dst_ptr_ty.childType(zcu).arrayLen(zcu);
......@@ -16704,7 +16704,7 @@ fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void {
1670416704 const bytes_to_copy: MCValue = .{ .immediate = elem_abi_size * (len - 1) };
1670516705 try self.genInlineMemcpy(second_elem_ptr_mcv, dst_ptr, bytes_to_copy);
1670616706 },
16707 .C, .Many => unreachable,
16707 .c, .many => unreachable,
1670816708 }
1670916709 }
1671016710 return self.finishAir(inst, .unreach, .{ bin_op.lhs, bin_op.rhs, .none });
......@@ -16735,7 +16735,7 @@ fn airMemcpy(self: *Self, inst: Air.Inst.Index) !void {
1673516735 defer if (src_ptr_lock) |lock| self.register_manager.unlockReg(lock);
1673616736
1673716737 const len: MCValue = switch (dst_ptr_ty.ptrSize(zcu)) {
16738 .Slice => len: {
16738 .slice => len: {
1673916739 const len_reg = try self.register_manager.allocReg(null, abi.RegisterClass.gp);
1674016740 const len_lock = self.register_manager.lockRegAssumeUnused(len_reg);
1674116741 defer self.register_manager.unlockReg(len_lock);
......@@ -16748,11 +16748,11 @@ fn airMemcpy(self: *Self, inst: Air.Inst.Index) !void {
1674816748 );
1674916749 break :len .{ .register = len_reg };
1675016750 },
16751 .One => len: {
16751 .one => len: {
1675216752 const array_ty = dst_ptr_ty.childType(zcu);
1675316753 break :len .{ .immediate = array_ty.arrayLen(zcu) * array_ty.childType(zcu).abiSize(zcu) };
1675416754 },
16755 .C, .Many => unreachable,
16755 .c, .many => unreachable,
1675616756 };
1675716757 const len_lock: ?RegisterLock = switch (len) {
1675816758 .register => |reg| self.register_manager.lockRegAssumeUnused(reg),
src/arch/x86_64/abi.zig+1-1
......@@ -108,7 +108,7 @@ pub fn classifySystemV(ty: Type, zcu: *Zcu, target: std.Target, ctx: Context) [8
108108 var result = [1]Class{.none} ** 8;
109109 switch (ty.zigTypeTag(zcu)) {
110110 .pointer => switch (ty.ptrSize(zcu)) {
111 .Slice => {
111 .slice => {
112112 result[0] = .integer;
113113 result[1] = .integer;
114114 return result;
src/clang.zig+1-1
......@@ -177,7 +177,7 @@ pub const ASTUnit = opaque {
177177 extern fn ZigClangASTUnit_visitLocalTopLevelDecls(
178178 *ASTUnit,
179179 context: ?*anyopaque,
180 Fn: ?*const fn (?*anyopaque, *const Decl) callconv(.C) bool,
180 Fn: ?*const fn (?*anyopaque, *const Decl) callconv(.c) bool,
181181 ) bool;
182182
183183 pub const getLocalPreprocessingEntities_begin = ZigClangASTUnit_getLocalPreprocessingEntities_begin;
src/codegen.zig+1-1
......@@ -945,7 +945,7 @@ pub fn genTypedValue(
945945 switch (ty.zigTypeTag(zcu)) {
946946 .void => return .{ .mcv = .none },
947947 .pointer => switch (ty.ptrSize(zcu)) {
948 .Slice => {},
948 .slice => {},
949949 else => switch (val.toIntern()) {
950950 .null_value => {
951951 return .{ .mcv = .{ .immediate = 0 } };
src/codegen/c.zig+19-19
......@@ -1589,14 +1589,14 @@ pub const DeclGen = struct {
15891589 try dg.fmtIntLiteral(try pt.undefValue(ty), location),
15901590 }),
15911591 .ptr_type => |ptr_type| switch (ptr_type.flags.size) {
1592 .One, .Many, .C => {
1592 .one, .many, .c => {
15931593 try writer.writeAll("((");
15941594 try dg.renderCType(writer, ctype);
15951595 return writer.print("){x})", .{
15961596 try dg.fmtIntLiteral(try pt.undefValue(Type.usize), .Other),
15971597 });
15981598 },
1599 .Slice => {
1599 .slice => {
16001600 if (!location.isInitializer()) {
16011601 try writer.writeByte('(');
16021602 try dg.renderCType(writer, ctype);
......@@ -3570,7 +3570,7 @@ fn airPtrElemPtr(f: *Function, inst: Air.Inst.Index) !CValue {
35703570 try f.renderType(writer, inst_ty);
35713571 try writer.writeByte(')');
35723572 if (elem_has_bits) try writer.writeByte('&');
3573 if (elem_has_bits and ptr_ty.ptrSize(zcu) == .One) {
3573 if (elem_has_bits and ptr_ty.ptrSize(zcu) == .one) {
35743574 // It's a pointer to an array, so we need to de-reference.
35753575 try f.writeCValueDeref(writer, ptr);
35763576 } else try f.writeCValue(writer, ptr, .Other);
......@@ -5798,8 +5798,8 @@ fn fieldLocation(
57985798 }
57995799 },
58005800 .ptr_type => |ptr_info| switch (ptr_info.flags.size) {
5801 .One, .Many, .C => unreachable,
5802 .Slice => switch (field_index) {
5801 .one, .many, .c => unreachable,
5802 .slice => switch (field_index) {
58035803 0 => return .{ .field = .{ .identifier = "ptr" } },
58045804 1 => return .{ .field = .{ .identifier = "len" } },
58055805 else => unreachable,
......@@ -6902,7 +6902,7 @@ fn airMemset(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue {
69026902
69036903 try writer.writeAll("memset(");
69046904 switch (dest_ty.ptrSize(zcu)) {
6905 .Slice => {
6905 .slice => {
69066906 try f.writeCValueMember(writer, dest_slice, .{ .identifier = "ptr" });
69076907 try writer.writeAll(", 0xaa, ");
69086908 try f.writeCValueMember(writer, dest_slice, .{ .identifier = "len" });
......@@ -6912,14 +6912,14 @@ fn airMemset(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue {
69126912 try writer.writeAll(");\n");
69136913 }
69146914 },
6915 .One => {
6915 .one => {
69166916 const array_ty = dest_ty.childType(zcu);
69176917 const len = array_ty.arrayLen(zcu) * elem_abi_size;
69186918
69196919 try f.writeCValue(writer, dest_slice, .FunctionArgument);
69206920 try writer.print(", 0xaa, {d});\n", .{len});
69216921 },
6922 .Many, .C => unreachable,
6922 .many, .c => unreachable,
69236923 }
69246924 try reap(f, inst, &.{ bin_op.lhs, bin_op.rhs });
69256925 return .none;
......@@ -6932,7 +6932,7 @@ fn airMemset(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue {
69326932 const elem_ptr_ty = try pt.ptrType(.{
69336933 .child = elem_ty.toIntern(),
69346934 .flags = .{
6935 .size = .C,
6935 .size = .c,
69366936 },
69376937 });
69386938
......@@ -6946,14 +6946,14 @@ fn airMemset(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue {
69466946 try f.writeCValue(writer, index, .Other);
69476947 try writer.writeAll(" != ");
69486948 switch (dest_ty.ptrSize(zcu)) {
6949 .Slice => {
6949 .slice => {
69506950 try f.writeCValueMember(writer, dest_slice, .{ .identifier = "len" });
69516951 },
6952 .One => {
6952 .one => {
69536953 const array_ty = dest_ty.childType(zcu);
69546954 try writer.print("{d}", .{array_ty.arrayLen(zcu)});
69556955 },
6956 .Many, .C => unreachable,
6956 .many, .c => unreachable,
69576957 }
69586958 try writer.writeAll("; ++");
69596959 try f.writeCValue(writer, index, .Other);
......@@ -6981,7 +6981,7 @@ fn airMemset(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue {
69816981
69826982 try writer.writeAll("memset(");
69836983 switch (dest_ty.ptrSize(zcu)) {
6984 .Slice => {
6984 .slice => {
69856985 try f.writeCValueMember(writer, dest_slice, .{ .identifier = "ptr" });
69866986 try writer.writeAll(", ");
69876987 try f.writeCValue(writer, bitcasted, .FunctionArgument);
......@@ -6989,7 +6989,7 @@ fn airMemset(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue {
69896989 try f.writeCValueMember(writer, dest_slice, .{ .identifier = "len" });
69906990 try writer.writeAll(");\n");
69916991 },
6992 .One => {
6992 .one => {
69936993 const array_ty = dest_ty.childType(zcu);
69946994 const len = array_ty.arrayLen(zcu) * elem_abi_size;
69956995
......@@ -6998,7 +6998,7 @@ fn airMemset(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue {
69986998 try f.writeCValue(writer, bitcasted, .FunctionArgument);
69996999 try writer.print(", {d});\n", .{len});
70007000 },
7001 .Many, .C => unreachable,
7001 .many, .c => unreachable,
70027002 }
70037003 try f.freeCValue(inst, bitcasted);
70047004 try reap(f, inst, &.{ bin_op.lhs, bin_op.rhs });
......@@ -7015,7 +7015,7 @@ fn airMemcpy(f: *Function, inst: Air.Inst.Index) !CValue {
70157015 const src_ty = f.typeOf(bin_op.rhs);
70167016 const writer = f.object.writer();
70177017
7018 if (dest_ty.ptrSize(zcu) != .One) {
7018 if (dest_ty.ptrSize(zcu) != .one) {
70197019 try writer.writeAll("if (");
70207020 try writeArrayLen(f, writer, dest_ptr, dest_ty);
70217021 try writer.writeAll(" != 0) ");
......@@ -7038,11 +7038,11 @@ fn writeArrayLen(f: *Function, writer: ArrayListWriter, dest_ptr: CValue, dest_t
70387038 const pt = f.object.dg.pt;
70397039 const zcu = pt.zcu;
70407040 switch (dest_ty.ptrSize(zcu)) {
7041 .One => try writer.print("{}", .{
7041 .one => try writer.print("{}", .{
70427042 try f.fmtIntLiteral(try pt.intValue(Type.usize, dest_ty.childType(zcu).arrayLen(zcu))),
70437043 }),
7044 .Many, .C => unreachable,
7045 .Slice => try f.writeCValueMember(writer, dest_ptr, .{ .identifier = "len" }),
7044 .many, .c => unreachable,
7045 .slice => try f.writeCValueMember(writer, dest_ptr, .{ .identifier = "len" }),
70467046 }
70477047}
70487048
src/codegen/c/Type.zig+3-3
......@@ -1458,7 +1458,7 @@ pub const Pool = struct {
14581458 _ => |ip_index| switch (ip.indexToKey(ip_index)) {
14591459 .int_type => |int_info| return pool.fromIntInfo(allocator, int_info, mod, kind),
14601460 .ptr_type => |ptr_info| switch (ptr_info.flags.size) {
1461 .One, .Many, .C => {
1461 .one, .many, .c => {
14621462 const elem_ctype = elem_ctype: {
14631463 if (ptr_info.packed_offset.host_size > 0 and
14641464 ptr_info.flags.vector_index == .none)
......@@ -1505,7 +1505,7 @@ pub const Pool = struct {
15051505 .@"volatile" = ptr_info.flags.is_volatile,
15061506 });
15071507 },
1508 .Slice => {
1508 .slice => {
15091509 const target = &mod.resolved_target.result;
15101510 var fields = [_]Info.Field{
15111511 .{
......@@ -1598,7 +1598,7 @@ pub const Pool = struct {
15981598 switch (payload_type) {
15991599 .anyerror_type => return payload_ctype,
16001600 else => switch (ip.indexToKey(payload_type)) {
1601 .ptr_type => |payload_ptr_info| if (payload_ptr_info.flags.size != .C and
1601 .ptr_type => |payload_ptr_info| if (payload_ptr_info.flags.size != .c and
16021602 !payload_ptr_info.flags.is_allowzero) return payload_ctype,
16031603 .error_set_type, .inferred_error_set_type => return payload_ctype,
16041604 else => {},
src/codegen/llvm.zig+17-17
......@@ -2109,7 +2109,7 @@ pub const Object = struct {
21092109 ptr_info.flags.is_allowzero or
21102110 ptr_info.flags.is_const or
21112111 ptr_info.flags.is_volatile or
2112 ptr_info.flags.size == .Many or ptr_info.flags.size == .C or
2112 ptr_info.flags.size == .many or ptr_info.flags.size == .c or
21132113 !Type.fromInterned(ptr_info.child).hasRuntimeBitsIgnoreComptime(zcu))
21142114 {
21152115 const bland_ptr_ty = try pt.ptrType(.{
......@@ -2120,8 +2120,8 @@ pub const Object = struct {
21202120 .flags = .{
21212121 .alignment = ptr_info.flags.alignment,
21222122 .size = switch (ptr_info.flags.size) {
2123 .Many, .C, .One => .One,
2124 .Slice => .Slice,
2123 .many, .c, .one => .one,
2124 .slice => .slice,
21252125 },
21262126 },
21272127 });
......@@ -3382,8 +3382,8 @@ pub const Object = struct {
33823382 toLlvmAddressSpace(ptr_type.flags.address_space, target),
33833383 );
33843384 break :type switch (ptr_type.flags.size) {
3385 .One, .Many, .C => ptr_ty,
3386 .Slice => try o.builder.structType(.normal, &.{
3385 .one, .many, .c => ptr_ty,
3386 .slice => try o.builder.structType(.normal, &.{
33873387 ptr_ty,
33883388 try o.lowerType(Type.usize),
33893389 }),
......@@ -6988,7 +6988,7 @@ pub const FuncGen = struct {
69886988 const zcu = pt.zcu;
69896989 const llvm_usize = try o.lowerType(Type.usize);
69906990 switch (ty.ptrSize(zcu)) {
6991 .Slice => {
6991 .slice => {
69926992 const len = try fg.wip.extractValue(ptr, &.{1}, "");
69936993 const elem_ty = ty.childType(zcu);
69946994 const abi_size = elem_ty.abiSize(zcu);
......@@ -6996,13 +6996,13 @@ pub const FuncGen = struct {
69966996 const abi_size_llvm_val = try o.builder.intValue(llvm_usize, abi_size);
69976997 return fg.wip.bin(.@"mul nuw", len, abi_size_llvm_val, "");
69986998 },
6999 .One => {
6999 .one => {
70007000 const array_ty = ty.childType(zcu);
70017001 const elem_ty = array_ty.childType(zcu);
70027002 const abi_size = elem_ty.abiSize(zcu);
70037003 return o.builder.intValue(llvm_usize, array_ty.arrayLen(zcu) * abi_size);
70047004 },
7005 .Many, .C => unreachable,
7005 .many, .c => unreachable,
70067006 }
70077007 }
70087008
......@@ -8670,11 +8670,11 @@ pub const FuncGen = struct {
86708670 const llvm_elem_ty = try o.lowerPtrElemTy(ptr_ty.childType(zcu));
86718671 switch (ptr_ty.ptrSize(zcu)) {
86728672 // It's a pointer to an array, so according to LLVM we need an extra GEP index.
8673 .One => return self.wip.gep(.inbounds, llvm_elem_ty, ptr, &.{
8673 .one => return self.wip.gep(.inbounds, llvm_elem_ty, ptr, &.{
86748674 try o.builder.intValue(try o.lowerType(Type.usize), 0), offset,
86758675 }, ""),
8676 .C, .Many => return self.wip.gep(.inbounds, llvm_elem_ty, ptr, &.{offset}, ""),
8677 .Slice => {
8676 .c, .many => return self.wip.gep(.inbounds, llvm_elem_ty, ptr, &.{offset}, ""),
8677 .slice => {
86788678 const base = try self.wip.extractValue(ptr, &.{0}, "");
86798679 return self.wip.gep(.inbounds, llvm_elem_ty, base, &.{offset}, "");
86808680 },
......@@ -8693,11 +8693,11 @@ pub const FuncGen = struct {
86938693 const llvm_elem_ty = try o.lowerPtrElemTy(ptr_ty.childType(zcu));
86948694 switch (ptr_ty.ptrSize(zcu)) {
86958695 // It's a pointer to an array, so according to LLVM we need an extra GEP index.
8696 .One => return self.wip.gep(.inbounds, llvm_elem_ty, ptr, &.{
8696 .one => return self.wip.gep(.inbounds, llvm_elem_ty, ptr, &.{
86978697 try o.builder.intValue(try o.lowerType(Type.usize), 0), negative_offset,
86988698 }, ""),
8699 .C, .Many => return self.wip.gep(.inbounds, llvm_elem_ty, ptr, &.{negative_offset}, ""),
8700 .Slice => {
8699 .c, .many => return self.wip.gep(.inbounds, llvm_elem_ty, ptr, &.{negative_offset}, ""),
8700 .slice => {
87018701 const base = try self.wip.extractValue(ptr, &.{0}, "");
87028702 return self.wip.gep(.inbounds, llvm_elem_ty, base, &.{negative_offset}, "");
87038703 },
......@@ -10034,9 +10034,9 @@ pub const FuncGen = struct {
1003410034
1003510035 const llvm_usize_ty = try o.lowerType(Type.usize);
1003610036 const len = switch (ptr_ty.ptrSize(zcu)) {
10037 .Slice => try self.wip.extractValue(dest_slice, &.{1}, ""),
10038 .One => try o.builder.intValue(llvm_usize_ty, ptr_ty.childType(zcu).arrayLen(zcu)),
10039 .Many, .C => unreachable,
10037 .slice => try self.wip.extractValue(dest_slice, &.{1}, ""),
10038 .one => try o.builder.intValue(llvm_usize_ty, ptr_ty.childType(zcu).arrayLen(zcu)),
10039 .many, .c => unreachable,
1004010040 };
1004110041 const elem_llvm_ty = try o.lowerType(elem_ty);
1004210042 const end_ptr = try self.wip.gep(.inbounds, elem_llvm_ty, dest_ptr, &.{len}, "");
src/codegen/spirv.zig+8-8
......@@ -1705,13 +1705,13 @@ const NavGen = struct {
17051705 const storage_class = self.spvStorageClass(ptr_info.flags.address_space);
17061706 const ptr_ty_id = try self.ptrType(child_ty, storage_class);
17071707
1708 if (target.os.tag == .vulkan and ptr_info.flags.size == .Many) {
1708 if (target.os.tag == .vulkan and ptr_info.flags.size == .many) {
17091709 try self.spv.decorate(ptr_ty_id, .{ .ArrayStride = .{
17101710 .array_stride = @intCast(child_ty.abiSize(zcu)),
17111711 } });
17121712 }
17131713
1714 if (ptr_info.flags.size != .Slice) {
1714 if (ptr_info.flags.size != .slice) {
17151715 return ptr_ty_id;
17161716 }
17171717
......@@ -4399,15 +4399,15 @@ const NavGen = struct {
43994399 const result_ty_id = try self.resolveType(result_ty, .direct);
44004400
44014401 switch (ptr_ty.ptrSize(zcu)) {
4402 .One => {
4402 .one => {
44034403 // Pointer to array
44044404 // TODO: Is this correct?
44054405 return try self.accessChainId(result_ty_id, ptr_id, &.{offset_id});
44064406 },
4407 .C, .Many => {
4407 .c, .many => {
44084408 return try self.ptrAccessChain(result_ty_id, ptr_id, offset_id, &.{});
44094409 },
4410 .Slice => {
4410 .slice => {
44114411 // TODO: This is probably incorrect. A slice should be returned here, though this is what llvm does.
44124412 const slice_ptr_id = try self.extractField(result_ty, ptr_id, 0);
44134413 return try self.ptrAccessChain(result_ty_id, slice_ptr_id, offset_id, &.{});
......@@ -4989,15 +4989,15 @@ const NavGen = struct {
49894989 const pt = self.pt;
49904990 const zcu = pt.zcu;
49914991 switch (ty.ptrSize(zcu)) {
4992 .Slice => return self.extractField(Type.usize, operand_id, 1),
4993 .One => {
4992 .slice => return self.extractField(Type.usize, operand_id, 1),
4993 .one => {
49944994 const array_ty = ty.childType(zcu);
49954995 const elem_ty = array_ty.childType(zcu);
49964996 const abi_size = elem_ty.abiSize(zcu);
49974997 const size = array_ty.arrayLenIncludingSentinel(zcu) * abi_size;
49984998 return try self.constInt(Type.usize, size, .direct);
49994999 },
5000 .Many, .C => unreachable,
5000 .many, .c => unreachable,
50015001 }
50025002 }
50035003
src/codegen/spirv/Section.zig+2-2
......@@ -159,7 +159,7 @@ pub fn writeOperand(section: *Section, comptime Operand: type, operand: Operand)
159159 section.writeOperand(info.child, child);
160160 },
161161 .pointer => |info| {
162 std.debug.assert(info.size == .Slice); // Should be no other pointer types in the spec.
162 std.debug.assert(info.size == .slice); // Should be no other pointer types in the spec.
163163 for (operand) |item| {
164164 section.writeOperand(info.child, item);
165165 }
......@@ -292,7 +292,7 @@ fn operandSize(comptime Operand: type, operand: Operand) usize {
292292 .@"enum" => 1,
293293 .optional => |info| if (operand) |child| operandSize(info.child, child) else 0,
294294 .pointer => |info| blk: {
295 std.debug.assert(info.size == .Slice); // Should be no other pointer types in the spec.
295 std.debug.assert(info.size == .slice); // Should be no other pointer types in the spec.
296296 var total: usize = 0;
297297 for (operand) |item| {
298298 total += operandSize(info.child, item);
src/crash_report.zig+1-1
......@@ -190,7 +190,7 @@ pub fn attachSegfaultHandler() void {
190190 debug.updateSegfaultHandler(&act);
191191}
192192
193fn handleSegfaultPosix(sig: i32, info: *const posix.siginfo_t, ctx_ptr: ?*anyopaque) callconv(.C) noreturn {
193fn handleSegfaultPosix(sig: i32, info: *const posix.siginfo_t, ctx_ptr: ?*anyopaque) callconv(.c) noreturn {
194194 // TODO: use alarm() here to prevent infinite loops
195195 PanicSwitch.preDispatch();
196196
src/link/Dwarf.zig+2-2
......@@ -3182,7 +3182,7 @@ fn updateLazyType(
31823182 try uleb128(diw, ty.abiAlignment(zcu).toByteUnits().?);
31833183 },
31843184 .ptr_type => |ptr_type| switch (ptr_type.flags.size) {
3185 .One, .Many, .C => {
3185 .one, .many, .c => {
31863186 const ptr_child_type: Type = .fromInterned(ptr_type.child);
31873187 try wip_nav.abbrevCode(if (ptr_type.sentinel == .none) .ptr_type else .ptr_sentinel_type);
31883188 try wip_nav.strp(name);
......@@ -3210,7 +3210,7 @@ fn updateLazyType(
32103210 try wip_nav.refType(ptr_child_type);
32113211 }
32123212 },
3213 .Slice => {
3213 .slice => {
32143214 try wip_nav.abbrevCode(.generated_struct_type);
32153215 try wip_nav.strp(name);
32163216 try uleb128(diw, ty.abiSize(zcu));
src/link/tapi/yaml.zig+4-4
......@@ -248,7 +248,7 @@ pub const Value = union(enum) {
248248 .array => return encode(arena, &input),
249249
250250 .pointer => |info| switch (info.size) {
251 .One => switch (@typeInfo(info.child)) {
251 .one => switch (@typeInfo(info.child)) {
252252 .array => |child_info| {
253253 const Slice = []const child_info.child;
254254 return encode(arena, @as(Slice, input));
......@@ -257,7 +257,7 @@ pub const Value = union(enum) {
257257 @compileError("Unhandled type: {s}" ++ @typeName(info.child));
258258 },
259259 },
260 .Slice => {
260 .slice => {
261261 if (info.child == u8) {
262262 return Value{ .string = try arena.dupe(u8, input) };
263263 }
......@@ -357,7 +357,7 @@ pub const Yaml = struct {
357357 },
358358 .pointer => |info| {
359359 switch (info.size) {
360 .Slice => {
360 .slice => {
361361 var parsed = try self.arena.allocator().alloc(info.child, self.docs.items.len);
362362 for (self.docs.items, 0..) |doc, i| {
363363 parsed[i] = try self.parseValue(info.child, doc);
......@@ -446,7 +446,7 @@ pub const Yaml = struct {
446446 const arena = self.arena.allocator();
447447
448448 switch (ptr_info.size) {
449 .Slice => {
449 .slice => {
450450 if (ptr_info.child == u8) {
451451 return value.asString();
452452 }
src/mutable_value.zig+1-1
......@@ -256,7 +256,7 @@ pub const MutableValue = union(enum) {
256256 },
257257 .pointer => {
258258 const ptr_ty = ip.indexToKey(ty_ip).ptr_type;
259 if (ptr_ty.flags.size != .Slice) return;
259 if (ptr_ty.flags.size != .slice) return;
260260 const ptr = try arena.create(MutableValue);
261261 const len = try arena.create(MutableValue);
262262 ptr.* = .{ .interned = try pt.intern(.{ .undef = ip.slicePtrType(ty_ip) }) };
src/translate_c.zig+2-2
......@@ -231,13 +231,13 @@ fn prepopulateGlobalNameTable(ast_unit: *clang.ASTUnit, c: *Context) !void {
231231 }
232232}
233233
234fn declVisitorNamesOnlyC(context: ?*anyopaque, decl: *const clang.Decl) callconv(.C) bool {
234fn declVisitorNamesOnlyC(context: ?*anyopaque, decl: *const clang.Decl) callconv(.c) bool {
235235 const c: *Context = @ptrCast(@alignCast(context));
236236 declVisitorNamesOnly(c, decl) catch return false;
237237 return true;
238238}
239239
240fn declVisitorC(context: ?*anyopaque, decl: *const clang.Decl) callconv(.C) bool {
240fn declVisitorC(context: ?*anyopaque, decl: *const clang.Decl) callconv(.c) bool {
241241 const c: *Context = @ptrCast(@alignCast(context));
242242 declVisitor(c, decl) catch return false;
243243 return true;
test/behavior/align.zig+2-2
......@@ -410,11 +410,11 @@ test "alignment of function with c calling convention" {
410410 var runtime_nothing = &nothing;
411411 _ = &runtime_nothing;
412412 const casted1: *align(a) const u8 = @ptrCast(runtime_nothing);
413 const casted2: *const fn () callconv(.C) void = @ptrCast(casted1);
413 const casted2: *const fn () callconv(.c) void = @ptrCast(casted1);
414414 casted2();
415415}
416416
417fn nothing() callconv(.C) void {}
417fn nothing() callconv(.c) void {}
418418
419419const DefaultAligned = struct {
420420 nevermind: u32,
test/behavior/cast.zig+5-5
......@@ -1118,7 +1118,7 @@ test "compile time int to ptr of function" {
11181118// On some architectures function pointers must be aligned.
11191119const hardcoded_fn_addr = maxInt(usize) & ~@as(usize, 0xf);
11201120pub const FUNCTION_CONSTANT = @as(PFN_void, @ptrFromInt(hardcoded_fn_addr));
1121pub const PFN_void = *const fn (*anyopaque) callconv(.C) void;
1121pub const PFN_void = *const fn (*anyopaque) callconv(.c) void;
11221122
11231123fn foobar(func: PFN_void) !void {
11241124 try std.testing.expect(@intFromPtr(func) == hardcoded_fn_addr);
......@@ -1281,11 +1281,11 @@ test "implicit cast *[0]T to E![]const u8" {
12811281
12821282var global_array: [4]u8 = undefined;
12831283test "cast from array reference to fn: comptime fn ptr" {
1284 const f = @as(*align(1) const fn () callconv(.C) void, @ptrCast(&global_array));
1284 const f = @as(*align(1) const fn () callconv(.c) void, @ptrCast(&global_array));
12851285 try expect(@intFromPtr(f) == @intFromPtr(&global_array));
12861286}
12871287test "cast from array reference to fn: runtime fn ptr" {
1288 var f = @as(*align(1) const fn () callconv(.C) void, @ptrCast(&global_array));
1288 var f = @as(*align(1) const fn () callconv(.c) void, @ptrCast(&global_array));
12891289 _ = &f;
12901290 try expect(@intFromPtr(f) == @intFromPtr(&global_array));
12911291}
......@@ -1309,12 +1309,12 @@ test "*const [N]null u8 to ?[]const u8" {
13091309
13101310test "cast between [*c]T and ?[*:0]T on fn parameter" {
13111311 const S = struct {
1312 const Handler = ?fn ([*c]const u8) callconv(.C) void;
1312 const Handler = ?fn ([*c]const u8) callconv(.c) void;
13131313 fn addCallback(comptime handler: Handler) void {
13141314 _ = handler;
13151315 }
13161316
1317 fn myCallback(cstr: ?[*:0]const u8) callconv(.C) void {
1317 fn myCallback(cstr: ?[*:0]const u8) callconv(.c) void {
13181318 _ = cstr;
13191319 }
13201320
test/behavior/export_builtin.zig+1-1
......@@ -26,7 +26,7 @@ test "exporting with internal linkage" {
2626 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
2727
2828 const S = struct {
29 fn foo() callconv(.C) void {}
29 fn foo() callconv(.c) void {}
3030 comptime {
3131 @export(&foo, .{ .name = "exporting_with_internal_linkage_foo", .linkage = .internal });
3232 }
test/behavior/export_keyword.zig+1-1
......@@ -44,7 +44,7 @@ test "export function alias" {
4444 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest;
4545
4646 _ = struct {
47 fn foo_internal() callconv(.C) u32 {
47 fn foo_internal() callconv(.c) u32 {
4848 return 123;
4949 }
5050 export const foo_exported = foo_internal;
test/behavior/extern.zig+3-3
......@@ -20,7 +20,7 @@ test "function extern symbol" {
2020 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest;
2121 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
2222
23 const a = @extern(*const fn () callconv(.C) i32, .{ .name = "a_mystery_function" });
23 const a = @extern(*const fn () callconv(.c) i32, .{ .name = "a_mystery_function" });
2424 try expect(a() == 4567);
2525}
2626
......@@ -35,7 +35,7 @@ test "function extern symbol matches extern decl" {
3535
3636 const S = struct {
3737 extern fn another_mystery_function() u32;
38 const same_thing = @extern(*const fn () callconv(.C) u32, .{ .name = "another_mystery_function" });
38 const same_thing = @extern(*const fn () callconv(.c) u32, .{ .name = "another_mystery_function" });
3939 };
4040 try expect(S.another_mystery_function() == 12345);
4141 try expect(S.same_thing() == 12345);
......@@ -55,5 +55,5 @@ test "coerce extern function types" {
5555 };
5656 _ = S;
5757
58 _ = @as(fn () callconv(.C) ?*u32, c_extern_function);
58 _ = @as(fn () callconv(.c) ?*u32, c_extern_function);
5959}
test/behavior/fn.zig+5-5
......@@ -153,9 +153,9 @@ test "extern struct with stdcallcc fn pointer" {
153153 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
154154
155155 const S = extern struct {
156 ptr: *const fn () callconv(if (builtin.target.cpu.arch == .x86) .Stdcall else .C) i32,
156 ptr: *const fn () callconv(if (builtin.target.cpu.arch == .x86) .Stdcall else .c) i32,
157157
158 fn foo() callconv(if (builtin.target.cpu.arch == .x86) .Stdcall else .C) i32 {
158 fn foo() callconv(if (builtin.target.cpu.arch == .x86) .Stdcall else .c) i32 {
159159 return 1234;
160160 }
161161 };
......@@ -169,7 +169,7 @@ const nComplexCallconv = 100;
169169fn fComplexCallconvRet(x: u32) callconv(blk: {
170170 const s: struct { n: u32 } = .{ .n = nComplexCallconv };
171171 break :blk switch (s.n) {
172 0 => .C,
172 0 => .c,
173173 1 => .Inline,
174174 else => .Unspecified,
175175 };
......@@ -435,13 +435,13 @@ test "implicit cast function to function ptr" {
435435 return 123;
436436 }
437437 };
438 var fnPtr1: *const fn () callconv(.C) c_int = S1.someFunctionThatReturnsAValue;
438 var fnPtr1: *const fn () callconv(.c) c_int = S1.someFunctionThatReturnsAValue;
439439 _ = &fnPtr1;
440440 try expect(fnPtr1() == 123);
441441 const S2 = struct {
442442 extern fn someFunctionThatReturnsAValue() c_int;
443443 };
444 var fnPtr2: *const fn () callconv(.C) c_int = S2.someFunctionThatReturnsAValue;
444 var fnPtr2: *const fn () callconv(.c) c_int = S2.someFunctionThatReturnsAValue;
445445 _ = &fnPtr2;
446446 try expect(fnPtr2() == 123);
447447}
test/behavior/generics.zig+6-6
......@@ -324,7 +324,7 @@ test "generic function instantiation non-duplicates" {
324324 for (source, 0..) |s, i| dest[i] = s;
325325 }
326326
327 fn foo() callconv(.C) void {}
327 fn foo() callconv(.c) void {}
328328 };
329329 var buffer: [100]u8 = undefined;
330330 S.copy(u8, &buffer, "hello");
......@@ -471,13 +471,13 @@ test "coerced function body has inequal value with its uncoerced body" {
471471 try expect(S.A.do() == 1234);
472472}
473473
474test "generic function returns value from callconv(.C) function" {
474test "generic function returns value from callconv(.c) function" {
475475 const S = struct {
476 fn getU8() callconv(.C) u8 {
476 fn getU8() callconv(.c) u8 {
477477 return 123;
478478 }
479479
480 fn getGeneric(comptime T: type, supplier: fn () callconv(.C) T) T {
480 fn getGeneric(comptime T: type, supplier: fn () callconv(.c) T) T {
481481 return supplier();
482482 }
483483 };
......@@ -521,11 +521,11 @@ test "function argument tuple used as struct field" {
521521 try expect(c.t[0] == null);
522522}
523523
524test "comptime callconv(.C) function ptr uses comptime type argument" {
524test "comptime callconv(.c) function ptr uses comptime type argument" {
525525 const S = struct {
526526 fn A(
527527 comptime T: type,
528 comptime destroycb: ?*const fn (?*T) callconv(.C) void,
528 comptime destroycb: ?*const fn (?*T) callconv(.c) void,
529529 ) !void {
530530 try expect(destroycb == null);
531531 }
test/behavior/import_c_keywords.zig+1-1
......@@ -80,7 +80,7 @@ test "import c keywords" {
8080 try std.testing.expect(ptr_id == &some_non_c_keyword_constant);
8181
8282 if (builtin.target.ofmt != .coff and builtin.target.os.tag != .windows) {
83 var ptr_fn: *const fn () callconv(.C) Id = &double;
83 var ptr_fn: *const fn () callconv(.c) Id = &double;
8484 try std.testing.expect(ptr_fn == &float);
8585 ptr_fn = &an_alias_of_float;
8686 try std.testing.expect(ptr_fn == &float);
test/behavior/packed-struct.zig+3-3
......@@ -891,7 +891,7 @@ test "runtime init of unnamed packed struct type" {
891891 }{ .x = z }).m();
892892}
893893
894test "packed struct passed to callconv(.C) function" {
894test "packed struct passed to callconv(.c) function" {
895895 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
896896 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
897897 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
......@@ -906,7 +906,7 @@ test "packed struct passed to callconv(.C) function" {
906906 d: u46 = 0,
907907 };
908908
909 fn foo(p: Packed, a1: u64, a2: u64, a3: u64, a4: u64, a5: u64) callconv(.C) bool {
909 fn foo(p: Packed, a1: u64, a2: u64, a3: u64, a4: u64, a5: u64) callconv(.c) bool {
910910 return p.a == 12345 and p.b == true and p.c == true and p.d == 0 and a1 == 5 and a2 == 4 and a3 == 3 and a4 == 2 and a5 == 1;
911911 }
912912 };
......@@ -1270,7 +1270,7 @@ test "2-byte packed struct argument in C calling convention" {
12701270 x: u15 = 0,
12711271 y: u1 = 0,
12721272
1273 fn foo(s: @This()) callconv(.C) i32 {
1273 fn foo(s: @This()) callconv(.c) i32 {
12741274 return s.x;
12751275 }
12761276 fn bar(s: @This()) !void {
test/behavior/struct.zig+1-1
......@@ -803,7 +803,7 @@ test "fn with C calling convention returns struct by value" {
803803 handle: i32,
804804 };
805805
806 fn makeBar(t: i32) callconv(.C) ExternBar {
806 fn makeBar(t: i32) callconv(.c) ExternBar {
807807 return ExternBar{
808808 .handle = t,
809809 };
test/behavior/type.zig+3-3
......@@ -141,7 +141,7 @@ test "Type.Array" {
141141test "@Type create slice with null sentinel" {
142142 const Slice = @Type(.{
143143 .pointer = .{
144 .size = .Slice,
144 .size = .slice,
145145 .is_const = true,
146146 .is_volatile = false,
147147 .is_allowzero = false,
......@@ -548,11 +548,11 @@ test "Type.Fn" {
548548
549549 const some_opaque = opaque {};
550550 const some_ptr = *some_opaque;
551 const T = fn (c_int, some_ptr) callconv(.C) void;
551 const T = fn (c_int, some_ptr) callconv(.c) void;
552552
553553 {
554554 const fn_info = std.builtin.Type{ .@"fn" = .{
555 .calling_convention = .C,
555 .calling_convention = .c,
556556 .is_generic = false,
557557 .is_var_args = false,
558558 .return_type = void,
test/behavior/type_info.zig+9-9
......@@ -44,7 +44,7 @@ test "type info: C pointer type info" {
4444fn testCPtr() !void {
4545 const ptr_info = @typeInfo([*c]align(4) const i8);
4646 try expect(ptr_info == .pointer);
47 try expect(ptr_info.pointer.size == .C);
47 try expect(ptr_info.pointer.size == .c);
4848 try expect(ptr_info.pointer.is_const);
4949 try expect(!ptr_info.pointer.is_volatile);
5050 try expect(ptr_info.pointer.alignment == 4);
......@@ -54,8 +54,8 @@ fn testCPtr() !void {
5454test "type info: value is correctly copied" {
5555 comptime {
5656 var ptrInfo = @typeInfo([]u32);
57 ptrInfo.pointer.size = .One;
58 try expect(@typeInfo([]u32).pointer.size == .Slice);
57 ptrInfo.pointer.size = .one;
58 try expect(@typeInfo([]u32).pointer.size == .slice);
5959 }
6060}
6161
......@@ -79,7 +79,7 @@ test "type info: pointer type info" {
7979fn testPointer() !void {
8080 const u32_ptr_info = @typeInfo(*u32);
8181 try expect(u32_ptr_info == .pointer);
82 try expect(u32_ptr_info.pointer.size == .One);
82 try expect(u32_ptr_info.pointer.size == .one);
8383 try expect(u32_ptr_info.pointer.is_const == false);
8484 try expect(u32_ptr_info.pointer.is_volatile == false);
8585 try expect(u32_ptr_info.pointer.alignment == @alignOf(u32));
......@@ -95,7 +95,7 @@ test "type info: unknown length pointer type info" {
9595fn testUnknownLenPtr() !void {
9696 const u32_ptr_info = @typeInfo([*]const volatile f64);
9797 try expect(u32_ptr_info == .pointer);
98 try expect(u32_ptr_info.pointer.size == .Many);
98 try expect(u32_ptr_info.pointer.size == .many);
9999 try expect(u32_ptr_info.pointer.is_const == true);
100100 try expect(u32_ptr_info.pointer.is_volatile == true);
101101 try expect(u32_ptr_info.pointer.sentinel == null);
......@@ -111,7 +111,7 @@ test "type info: null terminated pointer type info" {
111111fn testNullTerminatedPtr() !void {
112112 const ptr_info = @typeInfo([*:0]u8);
113113 try expect(ptr_info == .pointer);
114 try expect(ptr_info.pointer.size == .Many);
114 try expect(ptr_info.pointer.size == .many);
115115 try expect(ptr_info.pointer.is_const == false);
116116 try expect(ptr_info.pointer.is_volatile == false);
117117 try expect(@as(*const u8, @ptrCast(ptr_info.pointer.sentinel.?)).* == 0);
......@@ -127,7 +127,7 @@ test "type info: slice type info" {
127127fn testSlice() !void {
128128 const u32_slice_info = @typeInfo([]u32);
129129 try expect(u32_slice_info == .pointer);
130 try expect(u32_slice_info.pointer.size == .Slice);
130 try expect(u32_slice_info.pointer.size == .slice);
131131 try expect(u32_slice_info.pointer.is_const == false);
132132 try expect(u32_slice_info.pointer.is_volatile == false);
133133 try expect(u32_slice_info.pointer.alignment == 4);
......@@ -374,7 +374,7 @@ fn testFunction() !void {
374374 try expect(foo_fn_info.@"fn".is_var_args);
375375 try expect(foo_fn_info.@"fn".return_type.? == usize);
376376 const foo_ptr_fn_info = @typeInfo(@TypeOf(&typeInfoFoo));
377 try expect(foo_ptr_fn_info.pointer.size == .One);
377 try expect(foo_ptr_fn_info.pointer.size == .one);
378378 try expect(foo_ptr_fn_info.pointer.is_const);
379379 try expect(!foo_ptr_fn_info.pointer.is_volatile);
380380 try expect(foo_ptr_fn_info.pointer.address_space == .generic);
......@@ -401,7 +401,7 @@ fn testFunction() !void {
401401 try expect(aligned_foo_fn_info.@"fn".is_var_args);
402402 try expect(aligned_foo_fn_info.@"fn".return_type.? == usize);
403403 const aligned_foo_ptr_fn_info = @typeInfo(@TypeOf(&typeInfoFooAligned));
404 try expect(aligned_foo_ptr_fn_info.pointer.size == .One);
404 try expect(aligned_foo_ptr_fn_info.pointer.size == .one);
405405 try expect(aligned_foo_ptr_fn_info.pointer.is_const);
406406 try expect(!aligned_foo_ptr_fn_info.pointer.is_volatile);
407407 try expect(aligned_foo_ptr_fn_info.pointer.alignment == 4);
test/behavior/union.zig+1-1
......@@ -1229,7 +1229,7 @@ test "return an extern union from C calling convention" {
12291229 s: S,
12301230 };
12311231
1232 fn bar(arg_u: U) callconv(.C) U {
1232 fn bar(arg_u: U) callconv(.c) U {
12331233 var u = arg_u;
12341234 _ = &u;
12351235 return u;
test/behavior/var_args.zig+8-8
......@@ -108,19 +108,19 @@ test "simple variadic function" {
108108 if (builtin.cpu.arch == .s390x and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21350
109109
110110 const S = struct {
111 fn simple(...) callconv(.C) c_int {
111 fn simple(...) callconv(.c) c_int {
112112 var ap = @cVaStart();
113113 defer @cVaEnd(&ap);
114114 return @cVaArg(&ap, c_int);
115115 }
116116
117 fn compatible(_: c_int, ...) callconv(.C) c_int {
117 fn compatible(_: c_int, ...) callconv(.c) c_int {
118118 var ap = @cVaStart();
119119 defer @cVaEnd(&ap);
120120 return @cVaArg(&ap, c_int);
121121 }
122122
123 fn add(count: c_int, ...) callconv(.C) c_int {
123 fn add(count: c_int, ...) callconv(.c) c_int {
124124 var ap = @cVaStart();
125125 defer @cVaEnd(&ap);
126126 var i: usize = 0;
......@@ -169,7 +169,7 @@ test "coerce reference to var arg" {
169169 if (builtin.cpu.arch == .s390x and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21350
170170
171171 const S = struct {
172 fn addPtr(count: c_int, ...) callconv(.C) c_int {
172 fn addPtr(count: c_int, ...) callconv(.c) c_int {
173173 var ap = @cVaStart();
174174 defer @cVaEnd(&ap);
175175 var i: usize = 0;
......@@ -202,7 +202,7 @@ test "variadic functions" {
202202 if (builtin.cpu.arch == .s390x and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21350
203203
204204 const S = struct {
205 fn printf(list_ptr: *std.ArrayList(u8), format: [*:0]const u8, ...) callconv(.C) void {
205 fn printf(list_ptr: *std.ArrayList(u8), format: [*:0]const u8, ...) callconv(.c) void {
206206 var ap = @cVaStart();
207207 defer @cVaEnd(&ap);
208208 vprintf(list_ptr, format, &ap);
......@@ -212,7 +212,7 @@ test "variadic functions" {
212212 list: *std.ArrayList(u8),
213213 format: [*:0]const u8,
214214 ap: *std.builtin.VaList,
215 ) callconv(.C) void {
215 ) callconv(.c) void {
216216 for (std.mem.span(format)) |c| switch (c) {
217217 's' => {
218218 const arg = @cVaArg(ap, [*:0]const u8);
......@@ -247,7 +247,7 @@ test "copy VaList" {
247247 if (builtin.cpu.arch == .s390x and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21350
248248
249249 const S = struct {
250 fn add(count: c_int, ...) callconv(.C) c_int {
250 fn add(count: c_int, ...) callconv(.c) c_int {
251251 var ap = @cVaStart();
252252 defer @cVaEnd(&ap);
253253 var copy = @cVaCopy(&ap);
......@@ -284,7 +284,7 @@ test "unused VaList arg" {
284284 if (builtin.cpu.arch == .s390x and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21350
285285
286286 const S = struct {
287 fn thirdArg(dummy: c_int, ...) callconv(.C) c_int {
287 fn thirdArg(dummy: c_int, ...) callconv(.c) c_int {
288288 _ = dummy;
289289
290290 var ap = @cVaStart();
test/cases/compile_errors/generic_instantiation_failure_in_generic_function_return_type.zig+1-1
......@@ -21,7 +21,7 @@ pub fn isPtrTo(comptime id: std.builtin.TypeId) TraitFn {
2121
2222pub fn isSingleItemPtr(comptime T: type) bool {
2323 if (comptime is(.pointer)(T)) {
24 return @typeInfo(T).pointer.size == .One;
24 return @typeInfo(T).pointer.size == .one;
2525 }
2626 return false;
2727}
test/cases/compile_errors/invalid_pointer_with_reify_type.zig+1-3
......@@ -1,6 +1,6 @@
11export fn entry() void {
22 _ = @Type(.{ .pointer = .{
3 .size = .One,
3 .size = .one,
44 .is_const = false,
55 .is_volatile = false,
66 .alignment = 1,
......@@ -12,7 +12,5 @@ export fn entry() void {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :2:9: error: sentinels are only allowed on slices and unknown-length pointers
test/cases/compile_errors/non_scalar_sentinel.zig+2-2
......@@ -16,7 +16,7 @@ comptime {
1616}
1717comptime {
1818 _ = @Type(.{ .pointer = .{
19 .size = .Many,
19 .size = .slice,
2020 .is_const = false,
2121 .is_volatile = false,
2222 .alignment = @alignOf(S),
......@@ -28,7 +28,7 @@ comptime {
2828}
2929comptime {
3030 _ = @Type(.{ .pointer = .{
31 .size = .Many,
31 .size = .many,
3232 .is_const = false,
3333 .is_volatile = false,
3434 .alignment = @alignOf(S),
test/cases/compile_errors/reify_type_with_invalid_field_alignment.zig+1-3
......@@ -29,7 +29,7 @@ comptime {
2929comptime {
3030 _ = @Type(.{
3131 .pointer = .{
32 .size = .Many,
32 .size = .many,
3333 .is_const = true,
3434 .is_volatile = false,
3535 .alignment = 7,
......@@ -42,8 +42,6 @@ comptime {
4242}
4343
4444// error
45// backend=stage2
46// target=native
4745//
4846// :2:9: error: alignment value '3' is not a power of two or zero
4947// :14:9: error: alignment value '5' is not a power of two or zero