authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-02-09 20:21:31-08:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-02-10 04:21:31+00:00
log91424823724de866776c8b6a999ea45f1ca9d374
tree43c794431c7e5d83dc434117cca5884d8e01c672
parent75df7e502c05e7e6a9b00a5a28854ae4a1aa8ea6
signaturebadge-check Signed by PGP key B5690EEEBB952194

std.ArrayList: popOrNull() -> pop() [v2] (#22720)


29 files changed, 162 insertions(+), 177 deletions(-)

lib/compiler/aro/aro/Preprocessor.zig+2-2
......@@ -2446,7 +2446,7 @@ pub fn expandedSlice(pp: *const Preprocessor, tok: anytype) []const u8 {
24462446
24472447/// Concat two tokens and add the result to pp.generated
24482448fn pasteTokens(pp: *Preprocessor, lhs_toks: *ExpandBuf, rhs_toks: []const TokenWithExpansionLocs) Error!void {
2449 const lhs = while (lhs_toks.popOrNull()) |lhs| {
2449 const lhs = while (lhs_toks.pop()) |lhs| {
24502450 if ((pp.comp.langopts.preserve_comments_in_macros and lhs.id == .comment) or
24512451 (lhs.id != .macro_ws and lhs.id != .comment))
24522452 break lhs;
......@@ -2676,7 +2676,7 @@ fn defineFn(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken, macr
26762676 tok = tokenizer.nextNoWS();
26772677 if (tok.id == .ellipsis) {
26782678 try pp.err(tok, .gnu_va_macro);
2679 gnu_var_args = params.pop();
2679 gnu_var_args = params.pop().?;
26802680 const r_paren = tokenizer.nextNoWS();
26812681 if (r_paren.id != .r_paren) {
26822682 try pp.err(r_paren, .missing_paren_param_list);
lib/compiler/aro/aro/pragmas/gcc.zig+1-1
......@@ -103,7 +103,7 @@ fn diagnosticHandler(self: *GCC, pp: *Preprocessor, start_idx: TokenIndex) Pragm
103103 try pp.comp.diagnostics.set(str[2..], new_kind);
104104 },
105105 .push => try self.options_stack.append(pp.comp.gpa, pp.comp.diagnostics.options),
106 .pop => pp.comp.diagnostics.options = self.options_stack.popOrNull() orelse self.original_options,
106 .pop => pp.comp.diagnostics.options = self.options_stack.pop() orelse self.original_options,
107107 }
108108}
109109
lib/compiler/aro/aro/pragmas/pack.zig+1-1
......@@ -149,7 +149,7 @@ fn pop(pack: *Pack, p: *Parser, maybe_label: ?[]const u8) void {
149149 }
150150 }
151151 } else {
152 const prev = pack.stack.popOrNull() orelse {
152 const prev = pack.stack.pop() orelse {
153153 p.pragma_pack = 2;
154154 return;
155155 };
lib/compiler/build_runner.zig+1-1
......@@ -1190,7 +1190,7 @@ pub fn printErrorMessages(
11901190 const ttyconf = options.ttyconf;
11911191 try ttyconf.setColor(stderr, .dim);
11921192 var indent: usize = 0;
1193 while (step_stack.popOrNull()) |s| : (indent += 1) {
1193 while (step_stack.pop()) |s| : (indent += 1) {
11941194 if (indent > 0) {
11951195 try stderr.writer().writeByteNTimes(' ', (indent - 1) * 3);
11961196 try printChildNodePrefix(stderr, ttyconf);
lib/docs/wasm/markdown/Parser.zig+1-1
......@@ -816,7 +816,7 @@ fn isThematicBreak(line: []const u8) bool {
816816}
817817
818818fn closeLastBlock(p: *Parser) !void {
819 const b = p.pending_blocks.pop();
819 const b = p.pending_blocks.pop().?;
820820 const node = switch (b.tag) {
821821 .list => list: {
822822 assert(b.string_start == p.scratch_string.items.len);
lib/std/Build/Step/ConfigHeader.zig+1-1
......@@ -616,7 +616,7 @@ fn expand_variables_cmake(
616616 // no open bracket, preserve as a literal
617617 break :blk;
618618 }
619 const open_pos = var_stack.pop();
619 const open_pos = var_stack.pop().?;
620620 if (source_offset == open_pos.source) {
621621 source_offset += open_var.len;
622622 }
lib/std/array_list.zig+16-31
......@@ -289,10 +289,10 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type {
289289 /// Asserts that the list is not empty.
290290 /// Asserts that the index is in bounds.
291291 pub fn swapRemove(self: *Self, i: usize) T {
292 if (self.items.len - 1 == i) return self.pop();
292 if (self.items.len - 1 == i) return self.pop().?;
293293
294294 const old_item = self.items[i];
295 self.items[i] = self.pop();
295 self.items[i] = self.pop().?;
296296 return old_item;
297297 }
298298
......@@ -555,23 +555,15 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type {
555555 return self.items[prev_len..][0..n];
556556 }
557557
558 /// Remove and return the last element from the list.
559 /// Invalidates element pointers to the removed element.
560 /// Asserts that the list is not empty.
561 pub fn pop(self: *Self) T {
558 /// Remove and return the last element from the list, or return `null` if list is empty.
559 /// Invalidates element pointers to the removed element, if any.
560 pub fn pop(self: *Self) ?T {
561 if (self.items.len == 0) return null;
562562 const val = self.items[self.items.len - 1];
563563 self.items.len -= 1;
564564 return val;
565565 }
566566
567 /// Remove and return the last element from the list, or
568 /// return `null` if list is empty.
569 /// Invalidates element pointers to the removed element, if any.
570 pub fn popOrNull(self: *Self) ?T {
571 if (self.items.len == 0) return null;
572 return self.pop();
573 }
574
575567 /// Returns a slice of all the items plus the extra capacity, whose memory
576568 /// contents are `undefined`.
577569 pub fn allocatedSlice(self: Self) Slice {
......@@ -897,10 +889,10 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ
897889 /// Asserts that the list is not empty.
898890 /// Asserts that the index is in bounds.
899891 pub fn swapRemove(self: *Self, i: usize) T {
900 if (self.items.len - 1 == i) return self.pop();
892 if (self.items.len - 1 == i) return self.pop().?;
901893
902894 const old_item = self.items[i];
903 self.items[i] = self.pop();
895 self.items[i] = self.pop().?;
904896 return old_item;
905897 }
906898
......@@ -1190,22 +1182,15 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ
11901182 }
11911183
11921184 /// Remove and return the last element from the list.
1185 /// If the list is empty, returns `null`.
11931186 /// Invalidates pointers to last element.
1194 /// Asserts that the list is not empty.
1195 pub fn pop(self: *Self) T {
1187 pub fn pop(self: *Self) ?T {
1188 if (self.items.len == 0) return null;
11961189 const val = self.items[self.items.len - 1];
11971190 self.items.len -= 1;
11981191 return val;
11991192 }
12001193
1201 /// Remove and return the last element from the list.
1202 /// If the list is empty, returns `null`.
1203 /// Invalidates pointers to last element.
1204 pub fn popOrNull(self: *Self) ?T {
1205 if (self.items.len == 0) return null;
1206 return self.pop();
1207 }
1208
12091194 /// Returns a slice of all the items plus the extra capacity, whose memory
12101195 /// contents are `undefined`.
12111196 pub fn allocatedSlice(self: Self) Slice {
......@@ -2184,7 +2169,7 @@ test "ArrayList(u0)" {
21842169 try testing.expectEqual(count, 3);
21852170}
21862171
2187test "ArrayList(?u32).popOrNull()" {
2172test "ArrayList(?u32).pop()" {
21882173 const a = testing.allocator;
21892174
21902175 var list = ArrayList(?u32).init(a);
......@@ -2195,10 +2180,10 @@ test "ArrayList(?u32).popOrNull()" {
21952180 try list.append(2);
21962181 try testing.expectEqual(list.items.len, 3);
21972182
2198 try testing.expect(list.popOrNull().? == @as(u32, 2));
2199 try testing.expect(list.popOrNull().? == @as(u32, 1));
2200 try testing.expect(list.popOrNull().? == null);
2201 try testing.expect(list.popOrNull() == null);
2183 try testing.expect(list.pop().? == @as(u32, 2));
2184 try testing.expect(list.pop().? == @as(u32, 1));
2185 try testing.expect(list.pop().? == null);
2186 try testing.expect(list.pop() == null);
22022187}
22032188
22042189test "ArrayList(u32).getLast()" {
lib/std/debug/Dwarf/expression.zig+68-68
......@@ -527,14 +527,14 @@ pub fn StackMachine(comptime options: Options) type {
527527 },
528528 OP.@"and" => {
529529 if (self.stack.items.len < 2) return error.InvalidExpression;
530 const a = try self.stack.pop().asIntegral();
530 const a = try self.stack.pop().?.asIntegral();
531531 self.stack.items[self.stack.items.len - 1] = .{
532532 .generic = a & try self.stack.items[self.stack.items.len - 1].asIntegral(),
533533 };
534534 },
535535 OP.div => {
536536 if (self.stack.items.len < 2) return error.InvalidExpression;
537 const a: isize = @bitCast(try self.stack.pop().asIntegral());
537 const a: isize = @bitCast(try self.stack.pop().?.asIntegral());
538538 const b: isize = @bitCast(try self.stack.items[self.stack.items.len - 1].asIntegral());
539539 self.stack.items[self.stack.items.len - 1] = .{
540540 .generic = @bitCast(try std.math.divTrunc(isize, b, a)),
......@@ -542,14 +542,14 @@ pub fn StackMachine(comptime options: Options) type {
542542 },
543543 OP.minus => {
544544 if (self.stack.items.len < 2) return error.InvalidExpression;
545 const b = try self.stack.pop().asIntegral();
545 const b = try self.stack.pop().?.asIntegral();
546546 self.stack.items[self.stack.items.len - 1] = .{
547547 .generic = try std.math.sub(addr_type, try self.stack.items[self.stack.items.len - 1].asIntegral(), b),
548548 };
549549 },
550550 OP.mod => {
551551 if (self.stack.items.len < 2) return error.InvalidExpression;
552 const a: isize = @bitCast(try self.stack.pop().asIntegral());
552 const a: isize = @bitCast(try self.stack.pop().?.asIntegral());
553553 const b: isize = @bitCast(try self.stack.items[self.stack.items.len - 1].asIntegral());
554554 self.stack.items[self.stack.items.len - 1] = .{
555555 .generic = @bitCast(@mod(b, a)),
......@@ -557,7 +557,7 @@ pub fn StackMachine(comptime options: Options) type {
557557 },
558558 OP.mul => {
559559 if (self.stack.items.len < 2) return error.InvalidExpression;
560 const a: isize = @bitCast(try self.stack.pop().asIntegral());
560 const a: isize = @bitCast(try self.stack.pop().?.asIntegral());
561561 const b: isize = @bitCast(try self.stack.items[self.stack.items.len - 1].asIntegral());
562562 self.stack.items[self.stack.items.len - 1] = .{
563563 .generic = @bitCast(@mulWithOverflow(a, b)[0]),
......@@ -581,14 +581,14 @@ pub fn StackMachine(comptime options: Options) type {
581581 },
582582 OP.@"or" => {
583583 if (self.stack.items.len < 2) return error.InvalidExpression;
584 const a = try self.stack.pop().asIntegral();
584 const a = try self.stack.pop().?.asIntegral();
585585 self.stack.items[self.stack.items.len - 1] = .{
586586 .generic = a | try self.stack.items[self.stack.items.len - 1].asIntegral(),
587587 };
588588 },
589589 OP.plus => {
590590 if (self.stack.items.len < 2) return error.InvalidExpression;
591 const b = try self.stack.pop().asIntegral();
591 const b = try self.stack.pop().?.asIntegral();
592592 self.stack.items[self.stack.items.len - 1] = .{
593593 .generic = try std.math.add(addr_type, try self.stack.items[self.stack.items.len - 1].asIntegral(), b),
594594 };
......@@ -602,7 +602,7 @@ pub fn StackMachine(comptime options: Options) type {
602602 },
603603 OP.shl => {
604604 if (self.stack.items.len < 2) return error.InvalidExpression;
605 const a = try self.stack.pop().asIntegral();
605 const a = try self.stack.pop().?.asIntegral();
606606 const b = try self.stack.items[self.stack.items.len - 1].asIntegral();
607607 self.stack.items[self.stack.items.len - 1] = .{
608608 .generic = std.math.shl(usize, b, a),
......@@ -610,7 +610,7 @@ pub fn StackMachine(comptime options: Options) type {
610610 },
611611 OP.shr => {
612612 if (self.stack.items.len < 2) return error.InvalidExpression;
613 const a = try self.stack.pop().asIntegral();
613 const a = try self.stack.pop().?.asIntegral();
614614 const b = try self.stack.items[self.stack.items.len - 1].asIntegral();
615615 self.stack.items[self.stack.items.len - 1] = .{
616616 .generic = std.math.shr(usize, b, a),
......@@ -618,7 +618,7 @@ pub fn StackMachine(comptime options: Options) type {
618618 },
619619 OP.shra => {
620620 if (self.stack.items.len < 2) return error.InvalidExpression;
621 const a = try self.stack.pop().asIntegral();
621 const a = try self.stack.pop().?.asIntegral();
622622 const b: isize = @bitCast(try self.stack.items[self.stack.items.len - 1].asIntegral());
623623 self.stack.items[self.stack.items.len - 1] = .{
624624 .generic = @bitCast(std.math.shr(isize, b, a)),
......@@ -626,7 +626,7 @@ pub fn StackMachine(comptime options: Options) type {
626626 },
627627 OP.xor => {
628628 if (self.stack.items.len < 2) return error.InvalidExpression;
629 const a = try self.stack.pop().asIntegral();
629 const a = try self.stack.pop().?.asIntegral();
630630 self.stack.items[self.stack.items.len - 1] = .{
631631 .generic = a ^ try self.stack.items[self.stack.items.len - 1].asIntegral(),
632632 };
......@@ -641,7 +641,7 @@ pub fn StackMachine(comptime options: Options) type {
641641 OP.ne,
642642 => {
643643 if (self.stack.items.len < 2) return error.InvalidExpression;
644 const a = self.stack.pop();
644 const a = self.stack.pop().?;
645645 const b = self.stack.items[self.stack.items.len - 1];
646646
647647 if (a == .generic and b == .generic) {
......@@ -667,7 +667,7 @@ pub fn StackMachine(comptime options: Options) type {
667667 const branch_offset = operand.?.branch_offset;
668668 const condition = if (opcode == OP.bra) blk: {
669669 if (self.stack.items.len == 0) return error.InvalidExpression;
670 break :blk try self.stack.pop().asIntegral() != 0;
670 break :blk try self.stack.pop().?.asIntegral() != 0;
671671 } else true;
672672
673673 if (condition) {
......@@ -1080,7 +1080,7 @@ test "DWARF expressions" {
10801080
10811081 for (0..32) |i| {
10821082 const expected = 31 - i;
1083 try testing.expectEqual(expected, stack_machine.stack.popOrNull().?.generic);
1083 try testing.expectEqual(expected, stack_machine.stack.pop().?.generic);
10841084 }
10851085 }
10861086
......@@ -1141,7 +1141,7 @@ test "DWARF expressions" {
11411141
11421142 _ = try stack_machine.run(program.items, allocator, context, 0);
11431143
1144 const const_type = stack_machine.stack.popOrNull().?.const_type;
1144 const const_type = stack_machine.stack.pop().?.const_type;
11451145 try testing.expectEqual(die_offset, const_type.type_offset);
11461146 try testing.expectEqualSlices(u8, type_bytes, const_type.value_bytes);
11471147
......@@ -1162,7 +1162,7 @@ test "DWARF expressions" {
11621162 };
11631163
11641164 inline for (expected) |e| {
1165 try testing.expectEqual(@as(e[0], e[1]), @as(e[2], @bitCast(stack_machine.stack.popOrNull().?.generic)));
1165 try testing.expectEqual(@as(e[0], e[1]), @as(e[2], @bitCast(stack_machine.stack.pop().?.generic)));
11661166 }
11671167 }
11681168
......@@ -1199,14 +1199,14 @@ test "DWARF expressions" {
11991199
12001200 _ = try stack_machine.run(program.items, allocator, context, 0);
12011201
1202 const regval_type = stack_machine.stack.popOrNull().?.regval_type;
1202 const regval_type = stack_machine.stack.pop().?.regval_type;
12031203 try testing.expectEqual(@as(usize, 400), regval_type.type_offset);
12041204 try testing.expectEqual(@as(u8, @sizeOf(usize)), regval_type.type_size);
12051205 try testing.expectEqual(@as(usize, 0xee), regval_type.value);
12061206
1207 try testing.expectEqual(@as(usize, 303), stack_machine.stack.popOrNull().?.generic);
1208 try testing.expectEqual(@as(usize, 202), stack_machine.stack.popOrNull().?.generic);
1209 try testing.expectEqual(@as(usize, 101), stack_machine.stack.popOrNull().?.generic);
1207 try testing.expectEqual(@as(usize, 303), stack_machine.stack.pop().?.generic);
1208 try testing.expectEqual(@as(usize, 202), stack_machine.stack.pop().?.generic);
1209 try testing.expectEqual(@as(usize, 101), stack_machine.stack.pop().?.generic);
12101210 } else |err| {
12111211 switch (err) {
12121212 error.UnimplementedArch,
......@@ -1227,15 +1227,15 @@ test "DWARF expressions" {
12271227 try b.writeConst(writer, u8, 1);
12281228 try b.writeOpcode(writer, OP.dup);
12291229 _ = try stack_machine.run(program.items, allocator, context, null);
1230 try testing.expectEqual(@as(usize, 1), stack_machine.stack.popOrNull().?.generic);
1231 try testing.expectEqual(@as(usize, 1), stack_machine.stack.popOrNull().?.generic);
1230 try testing.expectEqual(@as(usize, 1), stack_machine.stack.pop().?.generic);
1231 try testing.expectEqual(@as(usize, 1), stack_machine.stack.pop().?.generic);
12321232
12331233 stack_machine.reset();
12341234 program.clearRetainingCapacity();
12351235 try b.writeConst(writer, u8, 1);
12361236 try b.writeOpcode(writer, OP.drop);
12371237 _ = try stack_machine.run(program.items, allocator, context, null);
1238 try testing.expect(stack_machine.stack.popOrNull() == null);
1238 try testing.expect(stack_machine.stack.pop() == null);
12391239
12401240 stack_machine.reset();
12411241 program.clearRetainingCapacity();
......@@ -1244,7 +1244,7 @@ test "DWARF expressions" {
12441244 try b.writeConst(writer, u8, 6);
12451245 try b.writePick(writer, 2);
12461246 _ = try stack_machine.run(program.items, allocator, context, null);
1247 try testing.expectEqual(@as(usize, 4), stack_machine.stack.popOrNull().?.generic);
1247 try testing.expectEqual(@as(usize, 4), stack_machine.stack.pop().?.generic);
12481248
12491249 stack_machine.reset();
12501250 program.clearRetainingCapacity();
......@@ -1253,7 +1253,7 @@ test "DWARF expressions" {
12531253 try b.writeConst(writer, u8, 6);
12541254 try b.writeOpcode(writer, OP.over);
12551255 _ = try stack_machine.run(program.items, allocator, context, null);
1256 try testing.expectEqual(@as(usize, 5), stack_machine.stack.popOrNull().?.generic);
1256 try testing.expectEqual(@as(usize, 5), stack_machine.stack.pop().?.generic);
12571257
12581258 stack_machine.reset();
12591259 program.clearRetainingCapacity();
......@@ -1261,8 +1261,8 @@ test "DWARF expressions" {
12611261 try b.writeConst(writer, u8, 6);
12621262 try b.writeOpcode(writer, OP.swap);
12631263 _ = try stack_machine.run(program.items, allocator, context, null);
1264 try testing.expectEqual(@as(usize, 5), stack_machine.stack.popOrNull().?.generic);
1265 try testing.expectEqual(@as(usize, 6), stack_machine.stack.popOrNull().?.generic);
1264 try testing.expectEqual(@as(usize, 5), stack_machine.stack.pop().?.generic);
1265 try testing.expectEqual(@as(usize, 6), stack_machine.stack.pop().?.generic);
12661266
12671267 stack_machine.reset();
12681268 program.clearRetainingCapacity();
......@@ -1271,9 +1271,9 @@ test "DWARF expressions" {
12711271 try b.writeConst(writer, u8, 6);
12721272 try b.writeOpcode(writer, OP.rot);
12731273 _ = try stack_machine.run(program.items, allocator, context, null);
1274 try testing.expectEqual(@as(usize, 5), stack_machine.stack.popOrNull().?.generic);
1275 try testing.expectEqual(@as(usize, 4), stack_machine.stack.popOrNull().?.generic);
1276 try testing.expectEqual(@as(usize, 6), stack_machine.stack.popOrNull().?.generic);
1274 try testing.expectEqual(@as(usize, 5), stack_machine.stack.pop().?.generic);
1275 try testing.expectEqual(@as(usize, 4), stack_machine.stack.pop().?.generic);
1276 try testing.expectEqual(@as(usize, 6), stack_machine.stack.pop().?.generic);
12771277
12781278 const deref_target: usize = @truncate(0xffeeffee_ffeeffee);
12791279
......@@ -1282,7 +1282,7 @@ test "DWARF expressions" {
12821282 try b.writeAddr(writer, @intFromPtr(&deref_target));
12831283 try b.writeOpcode(writer, OP.deref);
12841284 _ = try stack_machine.run(program.items, allocator, context, null);
1285 try testing.expectEqual(deref_target, stack_machine.stack.popOrNull().?.generic);
1285 try testing.expectEqual(deref_target, stack_machine.stack.pop().?.generic);
12861286
12871287 stack_machine.reset();
12881288 program.clearRetainingCapacity();
......@@ -1290,14 +1290,14 @@ test "DWARF expressions" {
12901290 try b.writeAddr(writer, @intFromPtr(&deref_target));
12911291 try b.writeOpcode(writer, OP.xderef);
12921292 _ = try stack_machine.run(program.items, allocator, context, null);
1293 try testing.expectEqual(deref_target, stack_machine.stack.popOrNull().?.generic);
1293 try testing.expectEqual(deref_target, stack_machine.stack.pop().?.generic);
12941294
12951295 stack_machine.reset();
12961296 program.clearRetainingCapacity();
12971297 try b.writeAddr(writer, @intFromPtr(&deref_target));
12981298 try b.writeDerefSize(writer, 1);
12991299 _ = try stack_machine.run(program.items, allocator, context, null);
1300 try testing.expectEqual(@as(usize, @as(*const u8, @ptrCast(&deref_target)).*), stack_machine.stack.popOrNull().?.generic);
1300 try testing.expectEqual(@as(usize, @as(*const u8, @ptrCast(&deref_target)).*), stack_machine.stack.pop().?.generic);
13011301
13021302 stack_machine.reset();
13031303 program.clearRetainingCapacity();
......@@ -1305,7 +1305,7 @@ test "DWARF expressions" {
13051305 try b.writeAddr(writer, @intFromPtr(&deref_target));
13061306 try b.writeXDerefSize(writer, 1);
13071307 _ = try stack_machine.run(program.items, allocator, context, null);
1308 try testing.expectEqual(@as(usize, @as(*const u8, @ptrCast(&deref_target)).*), stack_machine.stack.popOrNull().?.generic);
1308 try testing.expectEqual(@as(usize, @as(*const u8, @ptrCast(&deref_target)).*), stack_machine.stack.pop().?.generic);
13091309
13101310 const type_offset: usize = @truncate(0xaabbaabb_aabbaabb);
13111311
......@@ -1314,7 +1314,7 @@ test "DWARF expressions" {
13141314 try b.writeAddr(writer, @intFromPtr(&deref_target));
13151315 try b.writeDerefType(writer, 1, type_offset);
13161316 _ = try stack_machine.run(program.items, allocator, context, null);
1317 const deref_type = stack_machine.stack.popOrNull().?.regval_type;
1317 const deref_type = stack_machine.stack.pop().?.regval_type;
13181318 try testing.expectEqual(type_offset, deref_type.type_offset);
13191319 try testing.expectEqual(@as(u8, 1), deref_type.type_size);
13201320 try testing.expectEqual(@as(usize, @as(*const u8, @ptrCast(&deref_target)).*), deref_type.value);
......@@ -1325,7 +1325,7 @@ test "DWARF expressions" {
13251325 try b.writeAddr(writer, @intFromPtr(&deref_target));
13261326 try b.writeXDerefType(writer, 1, type_offset);
13271327 _ = try stack_machine.run(program.items, allocator, context, null);
1328 const xderef_type = stack_machine.stack.popOrNull().?.regval_type;
1328 const xderef_type = stack_machine.stack.pop().?.regval_type;
13291329 try testing.expectEqual(type_offset, xderef_type.type_offset);
13301330 try testing.expectEqual(@as(u8, 1), xderef_type.type_size);
13311331 try testing.expectEqual(@as(usize, @as(*const u8, @ptrCast(&deref_target)).*), xderef_type.value);
......@@ -1336,7 +1336,7 @@ test "DWARF expressions" {
13361336 program.clearRetainingCapacity();
13371337 try b.writeOpcode(writer, OP.push_object_address);
13381338 _ = try stack_machine.run(program.items, allocator, context, null);
1339 try testing.expectEqual(@as(usize, @intFromPtr(context.object_address.?)), stack_machine.stack.popOrNull().?.generic);
1339 try testing.expectEqual(@as(usize, @intFromPtr(context.object_address.?)), stack_machine.stack.pop().?.generic);
13401340
13411341 // TODO: Test OP.form_tls_address
13421342
......@@ -1346,7 +1346,7 @@ test "DWARF expressions" {
13461346 program.clearRetainingCapacity();
13471347 try b.writeOpcode(writer, OP.call_frame_cfa);
13481348 _ = try stack_machine.run(program.items, allocator, context, null);
1349 try testing.expectEqual(context.cfa.?, stack_machine.stack.popOrNull().?.generic);
1349 try testing.expectEqual(context.cfa.?, stack_machine.stack.pop().?.generic);
13501350 }
13511351
13521352 // Arithmetic and Logical Operations
......@@ -1358,7 +1358,7 @@ test "DWARF expressions" {
13581358 try b.writeConst(writer, i16, -4096);
13591359 try b.writeOpcode(writer, OP.abs);
13601360 _ = try stack_machine.run(program.items, allocator, context, null);
1361 try testing.expectEqual(@as(usize, 4096), stack_machine.stack.popOrNull().?.generic);
1361 try testing.expectEqual(@as(usize, 4096), stack_machine.stack.pop().?.generic);
13621362
13631363 stack_machine.reset();
13641364 program.clearRetainingCapacity();
......@@ -1366,7 +1366,7 @@ test "DWARF expressions" {
13661366 try b.writeConst(writer, u16, 0xf0ff);
13671367 try b.writeOpcode(writer, OP.@"and");
13681368 _ = try stack_machine.run(program.items, allocator, context, null);
1369 try testing.expectEqual(@as(usize, 0xf00f), stack_machine.stack.popOrNull().?.generic);
1369 try testing.expectEqual(@as(usize, 0xf00f), stack_machine.stack.pop().?.generic);
13701370
13711371 stack_machine.reset();
13721372 program.clearRetainingCapacity();
......@@ -1374,7 +1374,7 @@ test "DWARF expressions" {
13741374 try b.writeConst(writer, i16, 100);
13751375 try b.writeOpcode(writer, OP.div);
13761376 _ = try stack_machine.run(program.items, allocator, context, null);
1377 try testing.expectEqual(@as(isize, -404 / 100), @as(isize, @bitCast(stack_machine.stack.popOrNull().?.generic)));
1377 try testing.expectEqual(@as(isize, -404 / 100), @as(isize, @bitCast(stack_machine.stack.pop().?.generic)));
13781378
13791379 stack_machine.reset();
13801380 program.clearRetainingCapacity();
......@@ -1382,7 +1382,7 @@ test "DWARF expressions" {
13821382 try b.writeConst(writer, u16, 50);
13831383 try b.writeOpcode(writer, OP.minus);
13841384 _ = try stack_machine.run(program.items, allocator, context, null);
1385 try testing.expectEqual(@as(usize, 150), stack_machine.stack.popOrNull().?.generic);
1385 try testing.expectEqual(@as(usize, 150), stack_machine.stack.pop().?.generic);
13861386
13871387 stack_machine.reset();
13881388 program.clearRetainingCapacity();
......@@ -1390,7 +1390,7 @@ test "DWARF expressions" {
13901390 try b.writeConst(writer, u16, 100);
13911391 try b.writeOpcode(writer, OP.mod);
13921392 _ = try stack_machine.run(program.items, allocator, context, null);
1393 try testing.expectEqual(@as(usize, 23), stack_machine.stack.popOrNull().?.generic);
1393 try testing.expectEqual(@as(usize, 23), stack_machine.stack.pop().?.generic);
13941394
13951395 stack_machine.reset();
13961396 program.clearRetainingCapacity();
......@@ -1398,7 +1398,7 @@ test "DWARF expressions" {
13981398 try b.writeConst(writer, u16, 0xee);
13991399 try b.writeOpcode(writer, OP.mul);
14001400 _ = try stack_machine.run(program.items, allocator, context, null);
1401 try testing.expectEqual(@as(usize, 0xed12), stack_machine.stack.popOrNull().?.generic);
1401 try testing.expectEqual(@as(usize, 0xed12), stack_machine.stack.pop().?.generic);
14021402
14031403 stack_machine.reset();
14041404 program.clearRetainingCapacity();
......@@ -1407,15 +1407,15 @@ test "DWARF expressions" {
14071407 try b.writeConst(writer, i16, -6);
14081408 try b.writeOpcode(writer, OP.neg);
14091409 _ = try stack_machine.run(program.items, allocator, context, null);
1410 try testing.expectEqual(@as(usize, 6), stack_machine.stack.popOrNull().?.generic);
1411 try testing.expectEqual(@as(isize, -5), @as(isize, @bitCast(stack_machine.stack.popOrNull().?.generic)));
1410 try testing.expectEqual(@as(usize, 6), stack_machine.stack.pop().?.generic);
1411 try testing.expectEqual(@as(isize, -5), @as(isize, @bitCast(stack_machine.stack.pop().?.generic)));
14121412
14131413 stack_machine.reset();
14141414 program.clearRetainingCapacity();
14151415 try b.writeConst(writer, u16, 0xff0f);
14161416 try b.writeOpcode(writer, OP.not);
14171417 _ = try stack_machine.run(program.items, allocator, context, null);
1418 try testing.expectEqual(~@as(usize, 0xff0f), stack_machine.stack.popOrNull().?.generic);
1418 try testing.expectEqual(~@as(usize, 0xff0f), stack_machine.stack.pop().?.generic);
14191419
14201420 stack_machine.reset();
14211421 program.clearRetainingCapacity();
......@@ -1423,7 +1423,7 @@ test "DWARF expressions" {
14231423 try b.writeConst(writer, u16, 0xf0ff);
14241424 try b.writeOpcode(writer, OP.@"or");
14251425 _ = try stack_machine.run(program.items, allocator, context, null);
1426 try testing.expectEqual(@as(usize, 0xffff), stack_machine.stack.popOrNull().?.generic);
1426 try testing.expectEqual(@as(usize, 0xffff), stack_machine.stack.pop().?.generic);
14271427
14281428 stack_machine.reset();
14291429 program.clearRetainingCapacity();
......@@ -1431,14 +1431,14 @@ test "DWARF expressions" {
14311431 try b.writeConst(writer, i16, 100);
14321432 try b.writeOpcode(writer, OP.plus);
14331433 _ = try stack_machine.run(program.items, allocator, context, null);
1434 try testing.expectEqual(@as(usize, 502), stack_machine.stack.popOrNull().?.generic);
1434 try testing.expectEqual(@as(usize, 502), stack_machine.stack.pop().?.generic);
14351435
14361436 stack_machine.reset();
14371437 program.clearRetainingCapacity();
14381438 try b.writeConst(writer, u16, 4096);
14391439 try b.writePlusUconst(writer, @as(usize, 8192));
14401440 _ = try stack_machine.run(program.items, allocator, context, null);
1441 try testing.expectEqual(@as(usize, 4096 + 8192), stack_machine.stack.popOrNull().?.generic);
1441 try testing.expectEqual(@as(usize, 4096 + 8192), stack_machine.stack.pop().?.generic);
14421442
14431443 stack_machine.reset();
14441444 program.clearRetainingCapacity();
......@@ -1446,7 +1446,7 @@ test "DWARF expressions" {
14461446 try b.writeConst(writer, u16, 1);
14471447 try b.writeOpcode(writer, OP.shl);
14481448 _ = try stack_machine.run(program.items, allocator, context, null);
1449 try testing.expectEqual(@as(usize, 0xfff << 1), stack_machine.stack.popOrNull().?.generic);
1449 try testing.expectEqual(@as(usize, 0xfff << 1), stack_machine.stack.pop().?.generic);
14501450
14511451 stack_machine.reset();
14521452 program.clearRetainingCapacity();
......@@ -1454,7 +1454,7 @@ test "DWARF expressions" {
14541454 try b.writeConst(writer, u16, 1);
14551455 try b.writeOpcode(writer, OP.shr);
14561456 _ = try stack_machine.run(program.items, allocator, context, null);
1457 try testing.expectEqual(@as(usize, 0xfff >> 1), stack_machine.stack.popOrNull().?.generic);
1457 try testing.expectEqual(@as(usize, 0xfff >> 1), stack_machine.stack.pop().?.generic);
14581458
14591459 stack_machine.reset();
14601460 program.clearRetainingCapacity();
......@@ -1462,7 +1462,7 @@ test "DWARF expressions" {
14621462 try b.writeConst(writer, u16, 1);
14631463 try b.writeOpcode(writer, OP.shr);
14641464 _ = try stack_machine.run(program.items, allocator, context, null);
1465 try testing.expectEqual(@as(usize, @bitCast(@as(isize, 0xfff) >> 1)), stack_machine.stack.popOrNull().?.generic);
1465 try testing.expectEqual(@as(usize, @bitCast(@as(isize, 0xfff) >> 1)), stack_machine.stack.pop().?.generic);
14661466
14671467 stack_machine.reset();
14681468 program.clearRetainingCapacity();
......@@ -1470,7 +1470,7 @@ test "DWARF expressions" {
14701470 try b.writeConst(writer, u16, 0xff0f);
14711471 try b.writeOpcode(writer, OP.xor);
14721472 _ = try stack_machine.run(program.items, allocator, context, null);
1473 try testing.expectEqual(@as(usize, 0x0ff0), stack_machine.stack.popOrNull().?.generic);
1473 try testing.expectEqual(@as(usize, 0x0ff0), stack_machine.stack.pop().?.generic);
14741474 }
14751475
14761476 // Control Flow Operations
......@@ -1499,9 +1499,9 @@ test "DWARF expressions" {
14991499 try b.writeConst(writer, u16, 0);
15001500 try b.writeOpcode(writer, e[0]);
15011501 _ = try stack_machine.run(program.items, allocator, context, null);
1502 try testing.expectEqual(@as(usize, e[3]), stack_machine.stack.popOrNull().?.generic);
1503 try testing.expectEqual(@as(usize, e[2]), stack_machine.stack.popOrNull().?.generic);
1504 try testing.expectEqual(@as(usize, e[1]), stack_machine.stack.popOrNull().?.generic);
1502 try testing.expectEqual(@as(usize, e[3]), stack_machine.stack.pop().?.generic);
1503 try testing.expectEqual(@as(usize, e[2]), stack_machine.stack.pop().?.generic);
1504 try testing.expectEqual(@as(usize, e[1]), stack_machine.stack.pop().?.generic);
15051505 }
15061506
15071507 stack_machine.reset();
......@@ -1510,7 +1510,7 @@ test "DWARF expressions" {
15101510 try b.writeSkip(writer, 1);
15111511 try b.writeLiteral(writer, 3);
15121512 _ = try stack_machine.run(program.items, allocator, context, null);
1513 try testing.expectEqual(@as(usize, 2), stack_machine.stack.popOrNull().?.generic);
1513 try testing.expectEqual(@as(usize, 2), stack_machine.stack.pop().?.generic);
15141514
15151515 stack_machine.reset();
15161516 program.clearRetainingCapacity();
......@@ -1522,9 +1522,9 @@ test "DWARF expressions" {
15221522 try b.writeLiteral(writer, 4);
15231523 try b.writeLiteral(writer, 5);
15241524 _ = try stack_machine.run(program.items, allocator, context, null);
1525 try testing.expectEqual(@as(usize, 5), stack_machine.stack.popOrNull().?.generic);
1526 try testing.expectEqual(@as(usize, 4), stack_machine.stack.popOrNull().?.generic);
1527 try testing.expect(stack_machine.stack.popOrNull() == null);
1525 try testing.expectEqual(@as(usize, 5), stack_machine.stack.pop().?.generic);
1526 try testing.expectEqual(@as(usize, 4), stack_machine.stack.pop().?.generic);
1527 try testing.expect(stack_machine.stack.pop() == null);
15281528
15291529 // TODO: Test call2, call4, call_ref once implemented
15301530
......@@ -1548,7 +1548,7 @@ test "DWARF expressions" {
15481548 try b.writeConstType(writer, @as(usize, 0), &value_bytes);
15491549 try b.writeConvert(writer, @as(usize, 0));
15501550 _ = try stack_machine.run(program.items, allocator, context, null);
1551 try testing.expectEqual(value, stack_machine.stack.popOrNull().?.generic);
1551 try testing.expectEqual(value, stack_machine.stack.pop().?.generic);
15521552
15531553 // Reinterpret to generic type
15541554 stack_machine.reset();
......@@ -1556,7 +1556,7 @@ test "DWARF expressions" {
15561556 try b.writeConstType(writer, @as(usize, 0), &value_bytes);
15571557 try b.writeReinterpret(writer, @as(usize, 0));
15581558 _ = try stack_machine.run(program.items, allocator, context, null);
1559 try testing.expectEqual(value, stack_machine.stack.popOrNull().?.generic);
1559 try testing.expectEqual(value, stack_machine.stack.pop().?.generic);
15601560
15611561 // Reinterpret to new type
15621562 const die_offset: usize = 0xffee;
......@@ -1566,7 +1566,7 @@ test "DWARF expressions" {
15661566 try b.writeConstType(writer, @as(usize, 0), &value_bytes);
15671567 try b.writeReinterpret(writer, die_offset);
15681568 _ = try stack_machine.run(program.items, allocator, context, null);
1569 const const_type = stack_machine.stack.popOrNull().?.const_type;
1569 const const_type = stack_machine.stack.pop().?.const_type;
15701570 try testing.expectEqual(die_offset, const_type.type_offset);
15711571
15721572 stack_machine.reset();
......@@ -1574,7 +1574,7 @@ test "DWARF expressions" {
15741574 try b.writeLiteral(writer, 0);
15751575 try b.writeReinterpret(writer, die_offset);
15761576 _ = try stack_machine.run(program.items, allocator, context, null);
1577 const regval_type = stack_machine.stack.popOrNull().?.regval_type;
1577 const regval_type = stack_machine.stack.pop().?.regval_type;
15781578 try testing.expectEqual(die_offset, regval_type.type_offset);
15791579 }
15801580
......@@ -1586,7 +1586,7 @@ test "DWARF expressions" {
15861586 program.clearRetainingCapacity();
15871587 try b.writeOpcode(writer, OP.nop);
15881588 _ = try stack_machine.run(program.items, allocator, context, null);
1589 try testing.expect(stack_machine.stack.popOrNull() == null);
1589 try testing.expect(stack_machine.stack.pop() == null);
15901590
15911591 // Sub-expression
15921592 {
......@@ -1599,7 +1599,7 @@ test "DWARF expressions" {
15991599 program.clearRetainingCapacity();
16001600 try b.writeEntryValue(writer, sub_program.items);
16011601 _ = try stack_machine.run(program.items, allocator, context, null);
1602 try testing.expectEqual(@as(usize, 3), stack_machine.stack.popOrNull().?.generic);
1602 try testing.expectEqual(@as(usize, 3), stack_machine.stack.pop().?.generic);
16031603 }
16041604
16051605 // Register location description
......@@ -1626,7 +1626,7 @@ test "DWARF expressions" {
16261626 program.clearRetainingCapacity();
16271627 try b.writeEntryValue(writer, sub_program.items);
16281628 _ = try stack_machine.run(program.items, allocator, context, null);
1629 try testing.expectEqual(@as(usize, 0xee), stack_machine.stack.popOrNull().?.generic);
1629 try testing.expectEqual(@as(usize, 0xee), stack_machine.stack.pop().?.generic);
16301630 } else |err| {
16311631 switch (err) {
16321632 error.UnimplementedArch,
lib/std/debug/SelfInfo.zig+1-1
......@@ -2138,7 +2138,7 @@ pub const VirtualMachine = struct {
21382138 self.current_row.copy_on_write = true;
21392139 },
21402140 .restore_state => {
2141 const restored_columns = self.stack.popOrNull() orelse return error.InvalidOperation;
2141 const restored_columns = self.stack.pop() orelse return error.InvalidOperation;
21422142 self.columns.shrinkRetainingCapacity(self.columns.items.len - self.current_row.columns.len);
21432143 try self.columns.ensureUnusedCapacity(allocator, restored_columns.len);
21442144
lib/std/fs/Dir.zig+2-2
......@@ -682,7 +682,7 @@ pub const Walker = struct {
682682 // walking if they want, which means that we need to pop the directory
683683 // that errored from the stack. Otherwise, all future `next` calls would
684684 // likely just fail with the same error.
685 var item = self.stack.pop();
685 var item = self.stack.pop().?;
686686 if (self.stack.items.len != 0) {
687687 item.iter.dir.close();
688688 }
......@@ -718,7 +718,7 @@ pub const Walker = struct {
718718 .kind = base.kind,
719719 };
720720 } else {
721 var item = self.stack.pop();
721 var item = self.stack.pop().?;
722722 if (self.stack.items.len != 0) {
723723 item.iter.dir.close();
724724 }
lib/std/heap.zig+1-1
......@@ -681,7 +681,7 @@ pub fn testAllocatorAlignedShrink(base_allocator: mem.Allocator) !void {
681681 try stuff_to_free.append(slice);
682682 slice = try allocator.alignedAlloc(u8, 16, alloc_size);
683683 }
684 while (stuff_to_free.popOrNull()) |item| {
684 while (stuff_to_free.pop()) |item| {
685685 allocator.free(item);
686686 }
687687 slice[0] = 0x12;
lib/std/heap/debug_allocator.zig+3-3
......@@ -1070,7 +1070,7 @@ test "small allocations - free in reverse order" {
10701070 try list.append(ptr);
10711071 }
10721072
1073 while (list.popOrNull()) |ptr| {
1073 while (list.pop()) |ptr| {
10741074 allocator.destroy(ptr);
10751075 }
10761076}
......@@ -1227,7 +1227,7 @@ test "shrink large object to large object with larger alignment" {
12271227 try stuff_to_free.append(slice);
12281228 slice = try allocator.alignedAlloc(u8, 16, alloc_size);
12291229 }
1230 while (stuff_to_free.popOrNull()) |item| {
1230 while (stuff_to_free.pop()) |item| {
12311231 allocator.free(item);
12321232 }
12331233 slice[0] = 0x12;
......@@ -1299,7 +1299,7 @@ test "realloc large object to larger alignment" {
12991299 try stuff_to_free.append(slice);
13001300 slice = try allocator.alignedAlloc(u8, 16, default_page_size * 2 + 50);
13011301 }
1302 while (stuff_to_free.popOrNull()) |item| {
1302 while (stuff_to_free.pop()) |item| {
13031303 allocator.free(item);
13041304 }
13051305 slice[0] = 0x12;
lib/std/json/dynamic.zig+2-2
......@@ -124,7 +124,7 @@ pub const Value = union(enum) {
124124 .array_begin => {
125125 try stack.append(Value{ .array = Array.init(allocator) });
126126 },
127 .array_end => return try handleCompleteValue(&stack, allocator, source, stack.pop(), options) orelse continue,
127 .array_end => return try handleCompleteValue(&stack, allocator, source, stack.pop().?, options) orelse continue,
128128
129129 else => unreachable,
130130 }
......@@ -171,7 +171,7 @@ fn handleCompleteValue(stack: *Array, allocator: Allocator, source: anytype, val
171171 switch (try source.nextAllocMax(allocator, .alloc_always, options.max_value_len.?)) {
172172 .object_end => {
173173 // This object is complete.
174 value = stack.pop();
174 value = stack.pop().?;
175175 // Effectively recurse now that we have a complete value.
176176 if (stack.items.len == 0) return value;
177177 continue;
src/Compilation.zig+2-2
......@@ -657,7 +657,7 @@ pub const CObject = struct {
657657 .end_block => |block| switch (@as(BlockId, @enumFromInt(block.id))) {
658658 .Meta => {},
659659 .Diag => {
660 var wip_diag = stack.pop();
660 var wip_diag = stack.pop().?;
661661 errdefer wip_diag.deinit(gpa);
662662
663663 const src_ranges = try wip_diag.src_ranges.toOwnedSlice(gpa);
......@@ -5915,7 +5915,7 @@ pub fn addCCArgs(
59155915 try san_arg.appendSlice(arena, "fuzzer-no-link,");
59165916 }
59175917 // Chop off the trailing comma and append to argv.
5918 if (san_arg.popOrNull()) |_| {
5918 if (san_arg.pop()) |_| {
59195919 try argv.append(san_arg.items);
59205920
59215921 // These args have to be added after the `-fsanitize` arg or
src/InternPool.zig+2-2
......@@ -929,7 +929,7 @@ pub fn addDependency(ip: *InternPool, gpa: Allocator, depender: AnalUnit, depend
929929 }
930930
931931 // Prepend a new dependency.
932 const new_index: DepEntry.Index, const ptr = if (ip.free_dep_entries.popOrNull()) |new_index| new: {
932 const new_index: DepEntry.Index, const ptr = if (ip.free_dep_entries.pop()) |new_index| new: {
933933 break :new .{ new_index, &ip.dep_entries.items[@intFromEnum(new_index)] };
934934 } else .{ @enumFromInt(ip.dep_entries.items.len), ip.dep_entries.addOneAssumeCapacity() };
935935 if (deps.unwrap()) |old_first| {
......@@ -960,7 +960,7 @@ pub fn addDependency(ip: *InternPool, gpa: Allocator, depender: AnalUnit, depend
960960 }
961961
962962 // Prepend a new dependency.
963 const new_index: DepEntry.Index, const ptr = if (ip.free_dep_entries.popOrNull()) |new_index| new: {
963 const new_index: DepEntry.Index, const ptr = if (ip.free_dep_entries.pop()) |new_index| new: {
964964 break :new .{ new_index, &ip.dep_entries.items[@intFromEnum(new_index)] };
965965 } else .{ @enumFromInt(ip.dep_entries.items.len), ip.dep_entries.addOneAssumeCapacity() };
966966 if (gop.found_existing) {
src/Package/Fetch.zig+1-1
......@@ -127,7 +127,7 @@ pub const JobQueue = struct {
127127 // `Fetch` instances are allocated in prior ones' arenas.
128128 // Sorry, I know it's a bit weird, but it slightly simplifies the
129129 // critical section.
130 while (jq.all_fetches.popOrNull()) |f| f.deinit();
130 while (jq.all_fetches.pop()) |f| f.deinit();
131131 jq.all_fetches.deinit(gpa);
132132 jq.* = undefined;
133133 }
src/Sema.zig+2-2
......@@ -3912,7 +3912,7 @@ fn resolveComptimeKnownAllocPtr(sema: *Sema, block: *Block, alloc: Air.Inst.Ref,
39123912
39133913 const tmp_air = sema.getTmpAir();
39143914
3915 while (to_map.popOrNull()) |air_ptr| {
3915 while (to_map.pop()) |air_ptr| {
39163916 if (ptr_mapping.contains(air_ptr)) continue;
39173917 const PointerMethod = union(enum) {
39183918 same_addr,
......@@ -38422,7 +38422,7 @@ pub fn flushExports(sema: *Sema) !void {
3842238422 // `sema.exports` is completed; store the data into the `Zcu`.
3842338423 if (sema.exports.items.len == 1) {
3842438424 try zcu.single_exports.ensureUnusedCapacity(gpa, 1);
38425 const export_idx: Zcu.Export.Index = zcu.free_exports.popOrNull() orelse idx: {
38425 const export_idx: Zcu.Export.Index = zcu.free_exports.pop() orelse idx: {
3842638426 _ = try zcu.all_exports.addOne(gpa);
3842738427 break :idx @enumFromInt(zcu.all_exports.items.len - 1);
3842838428 };
src/Zcu.zig+3-3
......@@ -3130,7 +3130,7 @@ pub fn mapOldZirToNew(
31303130 }
31313131 }
31323132
3133 while (match_stack.popOrNull()) |match_item| {
3133 while (match_stack.pop()) |match_item| {
31343134 // First, a check: if the number of captures of this type has changed, we can't map it, because
31353135 // we wouldn't know how to correlate type information with the last update.
31363136 // Synchronizes with logic in `Zcu.PerThread.recreateStructType` etc.
......@@ -3412,7 +3412,7 @@ pub fn addUnitReference(zcu: *Zcu, src_unit: AnalUnit, referenced_unit: AnalUnit
34123412
34133413 try zcu.reference_table.ensureUnusedCapacity(gpa, 1);
34143414
3415 const ref_idx = zcu.free_references.popOrNull() orelse idx: {
3415 const ref_idx = zcu.free_references.pop() orelse idx: {
34163416 _ = try zcu.all_references.addOne(gpa);
34173417 break :idx zcu.all_references.items.len - 1;
34183418 };
......@@ -3437,7 +3437,7 @@ pub fn addTypeReference(zcu: *Zcu, src_unit: AnalUnit, referenced_type: InternPo
34373437
34383438 try zcu.type_reference_table.ensureUnusedCapacity(gpa, 1);
34393439
3440 const ref_idx = zcu.free_type_references.popOrNull() orelse idx: {
3440 const ref_idx = zcu.free_type_references.pop() orelse idx: {
34413441 _ = try zcu.all_type_references.addOne(gpa);
34423442 break :idx zcu.all_type_references.items.len - 1;
34433443 };
src/arch/aarch64/CodeGen.zig+9-9
......@@ -572,7 +572,7 @@ fn gen(self: *Self) !void {
572572 // dbg_epilogue_begin) is the last exitlude jump
573573 // relocation (which would just jump one instruction
574574 // further), it can be safely removed
575 self.mir_instructions.orderedRemove(self.exitlude_jump_relocs.pop());
575 self.mir_instructions.orderedRemove(self.exitlude_jump_relocs.pop().?);
576576 }
577577
578578 for (self.exitlude_jump_relocs.items) |jmp_reloc| {
......@@ -4694,7 +4694,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) InnerError!void {
46944694
46954695 try self.branch_stack.append(.{});
46964696 errdefer {
4697 _ = self.branch_stack.pop();
4697 _ = self.branch_stack.pop().?;
46984698 }
46994699
47004700 try self.ensureProcessDeathCapacity(liveness_condbr.then_deaths.len);
......@@ -4705,7 +4705,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) InnerError!void {
47054705
47064706 // Revert to the previous register and stack allocation state.
47074707
4708 var saved_then_branch = self.branch_stack.pop();
4708 var saved_then_branch = self.branch_stack.pop().?;
47094709 defer saved_then_branch.deinit(self.gpa);
47104710
47114711 self.register_manager.registers = parent_registers;
......@@ -4800,7 +4800,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) InnerError!void {
48004800 }
48014801
48024802 {
4803 var item = self.branch_stack.pop();
4803 var item = self.branch_stack.pop().?;
48044804 item.deinit(self.gpa);
48054805 }
48064806
......@@ -5059,7 +5059,7 @@ fn lowerBlock(self: *Self, inst: Air.Inst.Index, body: []const Air.Inst.Index) !
50595059 // If the last Mir instruction is the last relocation (which
50605060 // would just jump one instruction further), it can be safely
50615061 // removed
5062 self.mir_instructions.orderedRemove(relocs.pop());
5062 self.mir_instructions.orderedRemove(relocs.pop().?);
50635063 }
50645064 for (relocs.items) |reloc| {
50655065 try self.performReloc(reloc);
......@@ -5125,7 +5125,7 @@ fn airSwitch(self: *Self, inst: Air.Inst.Index) InnerError!void {
51255125
51265126 try self.branch_stack.append(.{});
51275127 errdefer {
5128 _ = self.branch_stack.pop();
5128 _ = self.branch_stack.pop().?;
51295129 }
51305130
51315131 try self.ensureProcessDeathCapacity(liveness.deaths[case.idx].len);
......@@ -5135,7 +5135,7 @@ fn airSwitch(self: *Self, inst: Air.Inst.Index) InnerError!void {
51355135 try self.genBody(case.body);
51365136
51375137 // Revert to the previous register and stack allocation state.
5138 var saved_case_branch = self.branch_stack.pop();
5138 var saved_case_branch = self.branch_stack.pop().?;
51395139 defer saved_case_branch.deinit(self.gpa);
51405140
51415141 self.register_manager.registers = parent_registers;
......@@ -5163,7 +5163,7 @@ fn airSwitch(self: *Self, inst: Air.Inst.Index) InnerError!void {
51635163
51645164 try self.branch_stack.append(.{});
51655165 errdefer {
5166 _ = self.branch_stack.pop();
5166 _ = self.branch_stack.pop().?;
51675167 }
51685168
51695169 const else_deaths = liveness.deaths.len - 1;
......@@ -5174,7 +5174,7 @@ fn airSwitch(self: *Self, inst: Air.Inst.Index) InnerError!void {
51745174 try self.genBody(else_body);
51755175
51765176 // Revert to the previous register and stack allocation state.
5177 var saved_case_branch = self.branch_stack.pop();
5177 var saved_case_branch = self.branch_stack.pop().?;
51785178 defer saved_case_branch.deinit(self.gpa);
51795179
51805180 self.register_manager.registers = parent_registers;
src/arch/arm/CodeGen.zig+9-9
......@@ -568,7 +568,7 @@ fn gen(self: *Self) !void {
568568 // dbg_epilogue_begin) is the last exitlude jump
569569 // relocation (which would just jump one instruction
570570 // further), it can be safely removed
571 self.mir_instructions.orderedRemove(self.exitlude_jump_relocs.pop());
571 self.mir_instructions.orderedRemove(self.exitlude_jump_relocs.pop().?);
572572 }
573573
574574 for (self.exitlude_jump_relocs.items) |jmp_reloc| {
......@@ -4669,7 +4669,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void {
46694669
46704670 try self.branch_stack.append(.{});
46714671 errdefer {
4672 _ = self.branch_stack.pop();
4672 _ = self.branch_stack.pop().?;
46734673 }
46744674
46754675 try self.ensureProcessDeathCapacity(liveness_condbr.then_deaths.len);
......@@ -4680,7 +4680,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void {
46804680
46814681 // Revert to the previous register and stack allocation state.
46824682
4683 var saved_then_branch = self.branch_stack.pop();
4683 var saved_then_branch = self.branch_stack.pop().?;
46844684 defer saved_then_branch.deinit(self.gpa);
46854685
46864686 self.register_manager.registers = parent_registers;
......@@ -4775,7 +4775,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void {
47754775 }
47764776
47774777 {
4778 var item = self.branch_stack.pop();
4778 var item = self.branch_stack.pop().?;
47794779 item.deinit(self.gpa);
47804780 }
47814781
......@@ -5009,7 +5009,7 @@ fn lowerBlock(self: *Self, inst: Air.Inst.Index, body: []const Air.Inst.Index) !
50095009 // If the last Mir instruction is the last relocation (which
50105010 // would just jump one instruction further), it can be safely
50115011 // removed
5012 self.mir_instructions.orderedRemove(relocs.pop());
5012 self.mir_instructions.orderedRemove(relocs.pop().?);
50135013 }
50145014 for (relocs.items) |reloc| {
50155015 try self.performReloc(reloc);
......@@ -5074,7 +5074,7 @@ fn airSwitch(self: *Self, inst: Air.Inst.Index) !void {
50745074
50755075 try self.branch_stack.append(.{});
50765076 errdefer {
5077 _ = self.branch_stack.pop();
5077 _ = self.branch_stack.pop().?;
50785078 }
50795079
50805080 try self.ensureProcessDeathCapacity(liveness.deaths[case.idx].len);
......@@ -5084,7 +5084,7 @@ fn airSwitch(self: *Self, inst: Air.Inst.Index) !void {
50845084 try self.genBody(case.body);
50855085
50865086 // Revert to the previous register and stack allocation state.
5087 var saved_case_branch = self.branch_stack.pop();
5087 var saved_case_branch = self.branch_stack.pop().?;
50885088 defer saved_case_branch.deinit(self.gpa);
50895089
50905090 self.register_manager.registers = parent_registers;
......@@ -5112,7 +5112,7 @@ fn airSwitch(self: *Self, inst: Air.Inst.Index) !void {
51125112
51135113 try self.branch_stack.append(.{});
51145114 errdefer {
5115 _ = self.branch_stack.pop();
5115 _ = self.branch_stack.pop().?;
51165116 }
51175117
51185118 const else_deaths = liveness.deaths.len - 1;
......@@ -5123,7 +5123,7 @@ fn airSwitch(self: *Self, inst: Air.Inst.Index) !void {
51235123 try self.genBody(else_body);
51245124
51255125 // Revert to the previous register and stack allocation state.
5126 var saved_case_branch = self.branch_stack.pop();
5126 var saved_case_branch = self.branch_stack.pop().?;
51275127 defer saved_case_branch.deinit(self.gpa);
51285128
51295129 self.register_manager.registers = parent_registers;
src/arch/sparc64/CodeGen.zig+5-5
......@@ -392,7 +392,7 @@ fn gen(self: *Self) !void {
392392 // dbg_epilogue_begin) is the last exitlude jump
393393 // relocation (which would just jump two instructions
394394 // further), it can be safely removed
395 const index = self.exitlude_jump_relocs.pop();
395 const index = self.exitlude_jump_relocs.pop().?;
396396
397397 // First, remove the delay slot, then remove
398398 // the branch instruction itself.
......@@ -1147,7 +1147,7 @@ fn lowerBlock(self: *Self, inst: Air.Inst.Index, body: []const Air.Inst.Index) !
11471147 // If the last Mir instruction is the last relocation (which
11481148 // would just jump two instruction further), it can be safely
11491149 // removed
1150 const index = relocs.pop();
1150 const index = relocs.pop().?;
11511151
11521152 // First, remove the delay slot, then remove
11531153 // the branch instruction itself.
......@@ -1501,7 +1501,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void {
15011501
15021502 try self.branch_stack.append(.{});
15031503 errdefer {
1504 _ = self.branch_stack.pop();
1504 _ = self.branch_stack.pop().?;
15051505 }
15061506
15071507 try self.ensureProcessDeathCapacity(liveness_condbr.then_deaths.len);
......@@ -1512,7 +1512,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void {
15121512
15131513 // Revert to the previous register and stack allocation state.
15141514
1515 var saved_then_branch = self.branch_stack.pop();
1515 var saved_then_branch = self.branch_stack.pop().?;
15161516 defer saved_then_branch.deinit(self.gpa);
15171517
15181518 self.register_manager.registers = parent_registers;
......@@ -1608,7 +1608,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void {
16081608 }
16091609
16101610 {
1611 var item = self.branch_stack.pop();
1611 var item = self.branch_stack.pop().?;
16121612 item.deinit(self.gpa);
16131613 }
16141614
src/arch/wasm/CodeGen.zig+11-11
......@@ -1121,11 +1121,11 @@ fn allocLocal(cg: *CodeGen, ty: Type) InnerError!WValue {
11211121 const zcu = cg.pt.zcu;
11221122 const valtype = typeToValtype(ty, zcu, cg.target);
11231123 const index_or_null = switch (valtype) {
1124 .i32 => cg.free_locals_i32.popOrNull(),
1125 .i64 => cg.free_locals_i64.popOrNull(),
1126 .f32 => cg.free_locals_f32.popOrNull(),
1127 .f64 => cg.free_locals_f64.popOrNull(),
1128 .v128 => cg.free_locals_v128.popOrNull(),
1124 .i32 => cg.free_locals_i32.pop(),
1125 .i64 => cg.free_locals_i64.pop(),
1126 .f32 => cg.free_locals_f32.pop(),
1127 .f64 => cg.free_locals_f64.pop(),
1128 .v128 => cg.free_locals_v128.pop(),
11291129 };
11301130 if (index_or_null) |index| {
11311131 log.debug("reusing local ({d}) of type {}", .{ index, valtype });
......@@ -1309,7 +1309,7 @@ fn functionInner(cg: *CodeGen, any_returns: bool) InnerError!Function {
13091309 try cg.branches.append(cg.gpa, .{});
13101310 // clean up outer branch
13111311 defer {
1312 var outer_branch = cg.branches.pop();
1312 var outer_branch = cg.branches.pop().?;
13131313 outer_branch.deinit(cg.gpa);
13141314 assert(cg.branches.items.len == 0); // missing branch merge
13151315 }
......@@ -3482,7 +3482,7 @@ fn airCondBr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
34823482 cg.branches.appendAssumeCapacity(.{});
34833483 try cg.currentBranch().values.ensureUnusedCapacity(cg.gpa, @as(u32, @intCast(liveness_condbr.else_deaths.len)));
34843484 defer {
3485 var else_stack = cg.branches.pop();
3485 var else_stack = cg.branches.pop().?;
34863486 else_stack.deinit(cg.gpa);
34873487 }
34883488 try cg.genBody(else_body);
......@@ -3494,7 +3494,7 @@ fn airCondBr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
34943494 cg.branches.appendAssumeCapacity(.{});
34953495 try cg.currentBranch().values.ensureUnusedCapacity(cg.gpa, @as(u32, @intCast(liveness_condbr.then_deaths.len)));
34963496 defer {
3497 var then_stack = cg.branches.pop();
3497 var then_stack = cg.branches.pop().?;
34983498 then_stack.deinit(cg.gpa);
34993499 }
35003500 try cg.genBody(then_body);
......@@ -4132,7 +4132,7 @@ fn airSwitchBr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
41324132 cg.branches.appendAssumeCapacity(.{});
41334133 try cg.currentBranch().values.ensureUnusedCapacity(cg.gpa, liveness.deaths[index].len);
41344134 defer {
4135 var case_branch = cg.branches.pop();
4135 var case_branch = cg.branches.pop().?;
41364136 case_branch.deinit(cg.gpa);
41374137 }
41384138 try cg.genBody(case.body);
......@@ -4144,7 +4144,7 @@ fn airSwitchBr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void {
41444144 const else_deaths = liveness.deaths.len - 1;
41454145 try cg.currentBranch().values.ensureUnusedCapacity(cg.gpa, liveness.deaths[else_deaths].len);
41464146 defer {
4147 var else_branch = cg.branches.pop();
4147 var else_branch = cg.branches.pop().?;
41484148 else_branch.deinit(cg.gpa);
41494149 }
41504150 try cg.genBody(else_body);
......@@ -6459,7 +6459,7 @@ fn lowerTry(
64596459 try cg.branches.append(cg.gpa, .{});
64606460 try cg.currentBranch().values.ensureUnusedCapacity(cg.gpa, liveness.else_deaths.len + liveness.then_deaths.len);
64616461 defer {
6462 var branch = cg.branches.pop();
6462 var branch = cg.branches.pop().?;
64636463 branch.deinit(cg.gpa);
64646464 }
64656465 try cg.genBody(body);
src/link.zig+1-1
......@@ -1888,7 +1888,7 @@ pub fn resolveInputs(
18881888 // that this library search logic can be applied to them.
18891889 mem.reverse(UnresolvedInput, unresolved_inputs.items);
18901890
1891 syslib: while (unresolved_inputs.popOrNull()) |unresolved_input| {
1891 syslib: while (unresolved_inputs.pop()) |unresolved_input| {
18921892 const name_query: UnresolvedInput.NameQuery = switch (unresolved_input) {
18931893 .name_query => |nq| nq,
18941894 .ambiguous_name => |an| an: {
src/link/Coff.zig+4-4
......@@ -707,7 +707,7 @@ pub fn allocateSymbol(coff: *Coff) !u32 {
707707 try coff.locals.ensureUnusedCapacity(gpa, 1);
708708
709709 const index = blk: {
710 if (coff.locals_free_list.popOrNull()) |index| {
710 if (coff.locals_free_list.pop()) |index| {
711711 log.debug(" (reusing symbol index {d})", .{index});
712712 break :blk index;
713713 } else {
......@@ -735,7 +735,7 @@ fn allocateGlobal(coff: *Coff) !u32 {
735735 try coff.globals.ensureUnusedCapacity(gpa, 1);
736736
737737 const index = blk: {
738 if (coff.globals_free_list.popOrNull()) |index| {
738 if (coff.globals_free_list.pop()) |index| {
739739 log.debug(" (reusing global index {d})", .{index});
740740 break :blk index;
741741 } else {
......@@ -861,7 +861,7 @@ fn writeAtom(coff: *Coff, atom_index: Atom.Index, code: []u8) !void {
861861 try coff.pwriteAll(code, file_offset);
862862
863863 // Now we can mark the relocs as resolved.
864 while (relocs.popOrNull()) |reloc| {
864 while (relocs.pop()) |reloc| {
865865 reloc.dirty = false;
866866 }
867867}
......@@ -3670,7 +3670,7 @@ const ImportTable = struct {
36703670 fn addImport(itab: *ImportTable, allocator: Allocator, target: SymbolWithLoc) !ImportIndex {
36713671 try itab.entries.ensureUnusedCapacity(allocator, 1);
36723672 const index: u32 = blk: {
3673 if (itab.free_list.popOrNull()) |index| {
3673 if (itab.free_list.pop()) |index| {
36743674 log.debug(" (reusing import entry index {d})", .{index});
36753675 break :blk index;
36763676 } else {
src/link/Dwarf.zig+4-4
......@@ -363,7 +363,7 @@ pub const Section = struct {
363363 fn popUnit(sec: *Section, gpa: std.mem.Allocator) void {
364364 const unit_index: Unit.Index = @enumFromInt(sec.units.items.len - 1);
365365 sec.unlinkUnit(unit_index);
366 var unit = sec.units.pop();
366 var unit = sec.units.pop().?;
367367 unit.deinit(gpa);
368368 }
369369
......@@ -1559,7 +1559,7 @@ pub const WipNav = struct {
15591559
15601560 pub fn leaveBlock(wip_nav: *WipNav, code_off: u64) UpdateError!void {
15611561 const block_bytes = comptime uleb128Bytes(@intFromEnum(AbbrevCode.block));
1562 const block = wip_nav.blocks.pop();
1562 const block = wip_nav.blocks.pop().?;
15631563 if (wip_nav.any_children)
15641564 try uleb128(wip_nav.debug_info.writer(wip_nav.dwarf.gpa), @intFromEnum(AbbrevCode.null))
15651565 else
......@@ -1599,7 +1599,7 @@ pub const WipNav = struct {
15991599
16001600 pub fn leaveInlineFunc(wip_nav: *WipNav, func: InternPool.Index, code_off: u64) UpdateError!void {
16011601 const inlined_func_bytes = comptime uleb128Bytes(@intFromEnum(AbbrevCode.inlined_func));
1602 const block = wip_nav.blocks.pop();
1602 const block = wip_nav.blocks.pop().?;
16031603 if (wip_nav.any_children)
16041604 try uleb128(wip_nav.debug_info.writer(wip_nav.dwarf.gpa), @intFromEnum(AbbrevCode.null))
16051605 else
......@@ -2054,7 +2054,7 @@ pub const WipNav = struct {
20542054
20552055 fn updateLazy(wip_nav: *WipNav, src_loc: Zcu.LazySrcLoc) UpdateError!void {
20562056 const ip = &wip_nav.pt.zcu.intern_pool;
2057 while (wip_nav.pending_lazy.popOrNull()) |val| switch (ip.typeOf(val)) {
2057 while (wip_nav.pending_lazy.pop()) |val| switch (ip.typeOf(val)) {
20582058 .type_type => try wip_nav.dwarf.updateLazyType(wip_nav.pt, src_loc, val, &wip_nav.pending_lazy),
20592059 else => try wip_nav.dwarf.updateLazyValue(wip_nav.pt, src_loc, val, &wip_nav.pending_lazy),
20602060 };
src/link/Plan9.zig+2-2
......@@ -515,7 +515,7 @@ fn updateFinish(self: *Plan9, pt: Zcu.PerThread, nav_index: InternPool.Nav.Index
515515
516516fn allocateSymbolIndex(self: *Plan9) !usize {
517517 const gpa = self.base.comp.gpa;
518 if (self.syms_index_free_list.popOrNull()) |i| {
518 if (self.syms_index_free_list.pop()) |i| {
519519 return i;
520520 } else {
521521 _ = try self.syms.addOne(gpa);
......@@ -524,7 +524,7 @@ fn allocateSymbolIndex(self: *Plan9) !usize {
524524}
525525
526526fn allocateGotIndex(self: *Plan9) usize {
527 if (self.got_index_free_list.popOrNull()) |i| {
527 if (self.got_index_free_list.pop()) |i| {
528528 return i;
529529 } else {
530530 self.got_len += 1;
src/link/table_section.zig+1-1
......@@ -13,7 +13,7 @@ pub fn TableSection(comptime Entry: type) type {
1313 pub fn allocateEntry(self: *Self, allocator: Allocator, entry: Entry) Allocator.Error!Index {
1414 try self.entries.ensureUnusedCapacity(allocator, 1);
1515 const index = blk: {
16 if (self.free_list.popOrNull()) |index| {
16 if (self.free_list.pop()) |index| {
1717 log.debug(" (reusing entry index {d})", .{index});
1818 break :blk index;
1919 } else {
tools/process_headers.zig+3-3
......@@ -192,7 +192,7 @@ pub fn main() !void {
192192 var dir_stack = std.ArrayList([]const u8).init(allocator);
193193 try dir_stack.append(target_include_dir);
194194
195 while (dir_stack.popOrNull()) |full_dir_name| {
195 while (dir_stack.pop()) |full_dir_name| {
196196 var dir = std.fs.cwd().openDir(full_dir_name, .{ .iterate = true }) catch |err| switch (err) {
197197 error.FileNotFound => continue :search,
198198 error.AccessDenied => continue :search,
......@@ -273,14 +273,14 @@ pub fn main() !void {
273273 }
274274 }
275275 std.mem.sort(*Contents, contents_list.items, {}, Contents.hitCountLessThan);
276 const best_contents = contents_list.popOrNull().?;
276 const best_contents = contents_list.pop().?;
277277 if (best_contents.hit_count > 1) {
278278 // worth it to make it generic
279279 const full_path = try std.fs.path.join(allocator, &[_][]const u8{ out_dir, generic_name, path_kv.key_ptr.* });
280280 try std.fs.cwd().makePath(std.fs.path.dirname(full_path).?);
281281 try std.fs.cwd().writeFile(.{ .sub_path = full_path, .data = best_contents.bytes });
282282 best_contents.is_generic = true;
283 while (contents_list.popOrNull()) |contender| {
283 while (contents_list.pop()) |contender| {
284284 if (contender.hit_count > 1) {
285285 const this_missed_bytes = contender.hit_count * contender.bytes.len;
286286 missed_opportunity_bytes += this_missed_bytes;
tools/update-linux-headers.zig+3-3
......@@ -189,7 +189,7 @@ pub fn main() !void {
189189 var dir_stack = std.ArrayList([]const u8).init(arena);
190190 try dir_stack.append(target_include_dir);
191191
192 while (dir_stack.popOrNull()) |full_dir_name| {
192 while (dir_stack.pop()) |full_dir_name| {
193193 var dir = std.fs.cwd().openDir(full_dir_name, .{ .iterate = true }) catch |err| switch (err) {
194194 error.FileNotFound => continue :search,
195195 error.AccessDenied => continue :search,
......@@ -270,14 +270,14 @@ pub fn main() !void {
270270 }
271271 }
272272 std.mem.sort(*Contents, contents_list.items, {}, Contents.hitCountLessThan);
273 const best_contents = contents_list.popOrNull().?;
273 const best_contents = contents_list.pop().?;
274274 if (best_contents.hit_count > 1) {
275275 // worth it to make it generic
276276 const full_path = try std.fs.path.join(arena, &[_][]const u8{ out_dir, generic_name, path_kv.key_ptr.* });
277277 try std.fs.cwd().makePath(std.fs.path.dirname(full_path).?);
278278 try std.fs.cwd().writeFile(.{ .sub_path = full_path, .data = best_contents.bytes });
279279 best_contents.is_generic = true;
280 while (contents_list.popOrNull()) |contender| {
280 while (contents_list.pop()) |contender| {
281281 if (contender.hit_count > 1) {
282282 const this_missed_bytes = contender.hit_count * contender.bytes.len;
283283 missed_opportunity_bytes += this_missed_bytes;