update std lib and compiler sources to new for loop syntax

This commit is contained in:
Andrew Kelley
2023-02-18 09:02:57 -07:00
parent f0530385b5
commit aeaef8c0ff
216 changed files with 938 additions and 938 deletions

View File

@@ -341,7 +341,7 @@ test "Condition - wait and signal" {
};
var multi_wait = MultiWait{};
for (multi_wait.threads) |*t| {
for (&multi_wait.threads) |*t| {
t.* = try std.Thread.spawn(.{}, MultiWait.run, .{&multi_wait});
}
@@ -389,7 +389,7 @@ test "Condition - signal" {
};
var signal_test = SignalTest{};
for (signal_test.threads) |*t| {
for (&signal_test.threads) |*t| {
t.* = try std.Thread.spawn(.{}, SignalTest.run, .{&signal_test});
}
@@ -457,7 +457,7 @@ test "Condition - multi signal" {
var threads = [_]std.Thread{undefined} ** num_threads;
// Create a circle of paddles which hit each other
for (threads) |*t, i| {
for (&threads, 0..) |*t, i| {
const paddle = &paddles[i];
const hit_to = &paddles[(i + 1) % paddles.len];
t.* = try std.Thread.spawn(.{}, Paddle.run, .{ paddle, hit_to });
@@ -468,7 +468,7 @@ test "Condition - multi signal" {
for (threads) |t| t.join();
// The first paddle will be hit one last time by the last paddle.
for (paddles) |p, i| {
for (paddles, 0..) |p, i| {
const expected = @as(u32, num_iterations) + @boolToInt(i == 0);
try testing.expectEqual(p.value, expected);
}
@@ -513,7 +513,7 @@ test "Condition - broadcasting" {
};
var broadcast_test = BroadcastTest{};
for (broadcast_test.threads) |*t| {
for (&broadcast_test.threads) |*t| {
t.* = try std.Thread.spawn(.{}, BroadcastTest.run, .{&broadcast_test});
}
@@ -584,7 +584,7 @@ test "Condition - broadcasting - wake all threads" {
var broadcast_test = BroadcastTest{};
var thread_id: usize = 1;
for (broadcast_test.threads) |*t| {
for (&broadcast_test.threads) |*t| {
t.* = try std.Thread.spawn(.{}, BroadcastTest.run, .{ &broadcast_test, thread_id });
thread_id += 1;
}