Commit 51595d6b75

mlugg <mlugg@mlugg.co.uk>
2023-11-10 06:27:17
lib: correct unnecessary uses of 'var'
1 parent baabc60
Changed files (174)
lib
compiler_rt
std
atomic
Build
compress
crypto
dwarf
event
fmt
parse_float
fs
hash
heap
http
io
json
math
meta
net
os
rand
sort
Thread
zig
lib/compiler_rt/absvdi2_test.zig
@@ -3,7 +3,7 @@ const testing = @import("std").testing;
 const __absvdi2 = @import("absvdi2.zig").__absvdi2;
 
 fn test__absvdi2(a: i64, expected: i64) !void {
-    var result = __absvdi2(a);
+    const result = __absvdi2(a);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/absvsi2_test.zig
@@ -3,7 +3,7 @@ const testing = @import("std").testing;
 const __absvsi2 = @import("absvsi2.zig").__absvsi2;
 
 fn test__absvsi2(a: i32, expected: i32) !void {
-    var result = __absvsi2(a);
+    const result = __absvsi2(a);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/absvti2_test.zig
@@ -3,7 +3,7 @@ const testing = @import("std").testing;
 const __absvti2 = @import("absvti2.zig").__absvti2;
 
 fn test__absvti2(a: i128, expected: i128) !void {
-    var result = __absvti2(a);
+    const result = __absvti2(a);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/addo.zig
@@ -18,7 +18,7 @@ comptime {
 inline fn addoXi4_generic(comptime ST: type, a: ST, b: ST, overflow: *c_int) ST {
     @setRuntimeSafety(builtin.is_test);
     overflow.* = 0;
-    var sum: ST = a +% b;
+    const sum: ST = a +% b;
     // Hackers Delight: section Overflow Detection, subsection Signed Add/Subtract
     // Let sum = a +% b == a + b + carry == wraparound addition.
     // Overflow in a+b+carry occurs, iff a and b have opposite signs
lib/compiler_rt/addodi4_test.zig
@@ -6,8 +6,8 @@ const math = std.math;
 fn test__addodi4(a: i64, b: i64) !void {
     var result_ov: c_int = undefined;
     var expected_ov: c_int = undefined;
-    var result = addv.__addodi4(a, b, &result_ov);
-    var expected: i64 = simple_addodi4(a, b, &expected_ov);
+    const result = addv.__addodi4(a, b, &result_ov);
+    const expected: i64 = simple_addodi4(a, b, &expected_ov);
     try testing.expectEqual(expected, result);
     try testing.expectEqual(expected_ov, result_ov);
 }
lib/compiler_rt/addosi4_test.zig
@@ -4,8 +4,8 @@ const testing = @import("std").testing;
 fn test__addosi4(a: i32, b: i32) !void {
     var result_ov: c_int = undefined;
     var expected_ov: c_int = undefined;
-    var result = addv.__addosi4(a, b, &result_ov);
-    var expected: i32 = simple_addosi4(a, b, &expected_ov);
+    const result = addv.__addosi4(a, b, &result_ov);
+    const expected: i32 = simple_addosi4(a, b, &expected_ov);
     try testing.expectEqual(expected, result);
     try testing.expectEqual(expected_ov, result_ov);
 }
lib/compiler_rt/addoti4_test.zig
@@ -6,8 +6,8 @@ const math = std.math;
 fn test__addoti4(a: i128, b: i128) !void {
     var result_ov: c_int = undefined;
     var expected_ov: c_int = undefined;
-    var result = addv.__addoti4(a, b, &result_ov);
-    var expected: i128 = simple_addoti4(a, b, &expected_ov);
+    const result = addv.__addoti4(a, b, &result_ov);
+    const expected: i128 = simple_addoti4(a, b, &expected_ov);
     try testing.expectEqual(expected, result);
     try testing.expectEqual(expected_ov, result_ov);
 }
lib/compiler_rt/bswapdi2_test.zig
@@ -2,7 +2,7 @@ const bswap = @import("bswap.zig");
 const testing = @import("std").testing;
 
 fn test__bswapdi2(a: u64, expected: u64) !void {
-    var result = bswap.__bswapdi2(a);
+    const result = bswap.__bswapdi2(a);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/bswapsi2_test.zig
@@ -2,7 +2,7 @@ const bswap = @import("bswap.zig");
 const testing = @import("std").testing;
 
 fn test__bswapsi2(a: u32, expected: u32) !void {
-    var result = bswap.__bswapsi2(a);
+    const result = bswap.__bswapsi2(a);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/bswapti2_test.zig
@@ -2,7 +2,7 @@ const bswap = @import("bswap.zig");
 const testing = @import("std").testing;
 
 fn test__bswapti2(a: u128, expected: u128) !void {
-    var result = bswap.__bswapti2(a);
+    const result = bswap.__bswapti2(a);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/ceil.zig
@@ -32,7 +32,7 @@ pub fn __ceilh(x: f16) callconv(.C) f16 {
 
 pub fn ceilf(x: f32) callconv(.C) f32 {
     var u: u32 = @bitCast(x);
-    var e = @as(i32, @intCast((u >> 23) & 0xFF)) - 0x7F;
+    const e = @as(i32, @intCast((u >> 23) & 0xFF)) - 0x7F;
     var m: u32 = undefined;
 
     // TODO: Shouldn't need this explicit check.
lib/compiler_rt/clzdi2_test.zig
@@ -2,8 +2,8 @@ const clz = @import("count0bits.zig");
 const testing = @import("std").testing;
 
 fn test__clzdi2(a: u64, expected: i64) !void {
-    var x: i64 = @bitCast(a);
-    var result = clz.__clzdi2(x);
+    const x: i64 = @bitCast(a);
+    const result = clz.__clzdi2(x);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/clzti2_test.zig
@@ -2,8 +2,8 @@ const clz = @import("count0bits.zig");
 const testing = @import("std").testing;
 
 fn test__clzti2(a: u128, expected: i64) !void {
-    var x: i128 = @bitCast(a);
-    var result = clz.__clzti2(x);
+    const x: i128 = @bitCast(a);
+    const result = clz.__clzti2(x);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/cmpdi2_test.zig
@@ -2,7 +2,7 @@ const cmp = @import("cmp.zig");
 const testing = @import("std").testing;
 
 fn test__cmpdi2(a: i64, b: i64, expected: i64) !void {
-    var result = cmp.__cmpdi2(a, b);
+    const result = cmp.__cmpdi2(a, b);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/cmpsi2_test.zig
@@ -2,7 +2,7 @@ const cmp = @import("cmp.zig");
 const testing = @import("std").testing;
 
 fn test__cmpsi2(a: i32, b: i32, expected: i32) !void {
-    var result = cmp.__cmpsi2(a, b);
+    const result = cmp.__cmpsi2(a, b);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/cmpti2_test.zig
@@ -2,7 +2,7 @@ const cmp = @import("cmp.zig");
 const testing = @import("std").testing;
 
 fn test__cmpti2(a: i128, b: i128, expected: i128) !void {
-    var result = cmp.__cmpti2(a, b);
+    const result = cmp.__cmpti2(a, b);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/ctzdi2_test.zig
@@ -2,8 +2,8 @@ const ctz = @import("count0bits.zig");
 const testing = @import("std").testing;
 
 fn test__ctzdi2(a: u64, expected: i32) !void {
-    var x: i64 = @bitCast(a);
-    var result = ctz.__ctzdi2(x);
+    const x: i64 = @bitCast(a);
+    const result = ctz.__ctzdi2(x);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/ctzsi2_test.zig
@@ -2,8 +2,8 @@ const ctz = @import("count0bits.zig");
 const testing = @import("std").testing;
 
 fn test__ctzsi2(a: u32, expected: i32) !void {
-    var x: i32 = @bitCast(a);
-    var result = ctz.__ctzsi2(x);
+    const x: i32 = @bitCast(a);
+    const result = ctz.__ctzsi2(x);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/ctzti2_test.zig
@@ -2,8 +2,8 @@ const ctz = @import("count0bits.zig");
 const testing = @import("std").testing;
 
 fn test__ctzti2(a: u128, expected: i32) !void {
-    var x: i128 = @bitCast(a);
-    var result = ctz.__ctzti2(x);
+    const x: i128 = @bitCast(a);
+    const result = ctz.__ctzti2(x);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/divc3_test.zig
@@ -19,20 +19,20 @@ test {
 
 fn testDiv(comptime T: type, comptime f: fn (T, T, T, T) callconv(.C) Complex(T)) !void {
     {
-        var a: T = 1.0;
-        var b: T = 0.0;
-        var c: T = -1.0;
-        var d: T = 0.0;
+        const a: T = 1.0;
+        const b: T = 0.0;
+        const c: T = -1.0;
+        const d: T = 0.0;
 
         const result = f(a, b, c, d);
         try expect(result.real == -1.0);
         try expect(result.imag == 0.0);
     }
     {
-        var a: T = 1.0;
-        var b: T = 0.0;
-        var c: T = -4.0;
-        var d: T = 0.0;
+        const a: T = 1.0;
+        const b: T = 0.0;
+        const c: T = -4.0;
+        const d: T = 0.0;
 
         const result = f(a, b, c, d);
         try expect(result.real == -0.25);
@@ -41,10 +41,10 @@ fn testDiv(comptime T: type, comptime f: fn (T, T, T, T) callconv(.C) Complex(T)
     {
         // if the first operand is an infinity and the second operand is a finite number, then the
         // result of the / operator is an infinity;
-        var a: T = -math.inf(T);
-        var b: T = 0.0;
-        var c: T = -4.0;
-        var d: T = 1.0;
+        const a: T = -math.inf(T);
+        const b: T = 0.0;
+        const c: T = -4.0;
+        const d: T = 1.0;
 
         const result = f(a, b, c, d);
         try expect(result.real == math.inf(T));
@@ -53,10 +53,10 @@ fn testDiv(comptime T: type, comptime f: fn (T, T, T, T) callconv(.C) Complex(T)
     {
         // if the first operand is a finite number and the second operand is an infinity, then the
         // result of the / operator is a zero;
-        var a: T = 17.2;
-        var b: T = 0.0;
-        var c: T = -math.inf(T);
-        var d: T = 0.0;
+        const a: T = 17.2;
+        const b: T = 0.0;
+        const c: T = -math.inf(T);
+        const d: T = 0.0;
 
         const result = f(a, b, c, d);
         try expect(result.real == -0.0);
@@ -65,10 +65,10 @@ fn testDiv(comptime T: type, comptime f: fn (T, T, T, T) callconv(.C) Complex(T)
     {
         // if the first operand is a nonzero finite number or an infinity and the second operand is
         // a zero, then the result of the / operator is an infinity
-        var a: T = 1.1;
-        var b: T = 0.1;
-        var c: T = 0.0;
-        var d: T = 0.0;
+        const a: T = 1.1;
+        const b: T = 0.1;
+        const c: T = 0.0;
+        const d: T = 0.0;
 
         const result = f(a, b, c, d);
         try expect(result.real == math.inf(T));
lib/compiler_rt/divxf3.zig
@@ -162,7 +162,7 @@ pub fn __divxf3(a: f80, b: f80) callconv(.C) f80 {
     // Two cases: quotient is in [0.5, 1.0) or quotient is in [1.0, 2.0).
     // Right shift the quotient if it falls in the [1,2) range and adjust the
     // exponent accordingly.
-    var quotient: u64 = if (quotient128 < (integerBit << 1)) b: {
+    const quotient: u64 = if (quotient128 < (integerBit << 1)) b: {
         quotientExponent -= 1;
         break :b @intCast(quotient128);
     } else @intCast(quotient128 >> 1);
@@ -177,7 +177,7 @@ pub fn __divxf3(a: f80, b: f80) callconv(.C) f80 {
     //
     // If r is greater than 1/2 ulp(q)*b, then q rounds up.  Otherwise, we
     // already have the correct result.  The exact halfway case cannot occur.
-    var residual: u64 = -%(quotient *% q63b);
+    const residual: u64 = -%(quotient *% q63b);
 
     const writtenExponent = quotientExponent + exponentBias;
     if (writtenExponent >= maxExponent) {
lib/compiler_rt/emutls.zig
@@ -57,8 +57,8 @@ const simple_allocator = struct {
 
     /// Resize a slice.
     pub fn reallocSlice(comptime T: type, slice: []T, len: usize) []T {
-        var c_ptr: *anyopaque = @ptrCast(slice.ptr);
-        var new_array: [*]T = @ptrCast(@alignCast(std.c.realloc(c_ptr, @sizeOf(T) * len) orelse abort()));
+        const c_ptr: *anyopaque = @ptrCast(slice.ptr);
+        const new_array: [*]T = @ptrCast(@alignCast(std.c.realloc(c_ptr, @sizeOf(T) * len) orelse abort()));
         return new_array[0..len];
     }
 
@@ -78,7 +78,7 @@ const ObjectArray = struct {
 
     /// create a new ObjectArray with n slots. must call deinit() to deallocate.
     pub fn init(n: usize) *ObjectArray {
-        var array = simple_allocator.alloc(ObjectArray);
+        const array = simple_allocator.alloc(ObjectArray);
 
         array.* = ObjectArray{
             .slots = simple_allocator.allocSlice(?ObjectPointer, n),
@@ -166,7 +166,7 @@ const current_thread_storage = struct {
         const size = @max(16, index);
 
         // create a new array and store it.
-        var array: *ObjectArray = ObjectArray.init(size);
+        const array: *ObjectArray = ObjectArray.init(size);
         current_thread_storage.setspecific(array);
         return array;
     }
@@ -304,13 +304,13 @@ const emutls_control = extern struct {
 test "simple_allocator" {
     if (!builtin.link_libc or builtin.os.tag != .openbsd) return error.SkipZigTest;
 
-    var data1: *[64]u8 = simple_allocator.alloc([64]u8);
+    const data1: *[64]u8 = simple_allocator.alloc([64]u8);
     defer simple_allocator.free(data1);
     for (data1) |*c| {
         c.* = 0xff;
     }
 
-    var data2: [*]u8 = simple_allocator.advancedAlloc(@alignOf(u8), 64);
+    const data2: [*]u8 = simple_allocator.advancedAlloc(@alignOf(u8), 64);
     defer simple_allocator.free(data2);
     for (data2[0..63]) |*c| {
         c.* = 0xff;
@@ -324,7 +324,7 @@ test "__emutls_get_address zeroed" {
     try expect(ctl.object.index == 0);
 
     // retrieve a variable from ctl
-    var x: *usize = @ptrCast(@alignCast(__emutls_get_address(&ctl)));
+    const x: *usize = @ptrCast(@alignCast(__emutls_get_address(&ctl)));
     try expect(ctl.object.index != 0); // index has been allocated for this ctl
     try expect(x.* == 0); // storage has been zeroed
 
@@ -332,7 +332,7 @@ test "__emutls_get_address zeroed" {
     x.* = 1234;
 
     // retrieve a variable from ctl (same ctl)
-    var y: *usize = @ptrCast(@alignCast(__emutls_get_address(&ctl)));
+    const y: *usize = @ptrCast(@alignCast(__emutls_get_address(&ctl)));
 
     try expect(y.* == 1234); // same content that x.*
     try expect(x == y); // same pointer
@@ -345,7 +345,7 @@ test "__emutls_get_address with default_value" {
     var ctl = emutls_control.init(usize, &value);
     try expect(ctl.object.index == 0);
 
-    var x: *usize = @ptrCast(@alignCast(__emutls_get_address(&ctl)));
+    const x: *usize = @ptrCast(@alignCast(__emutls_get_address(&ctl)));
     try expect(ctl.object.index != 0);
     try expect(x.* == 5678); // storage initialized with default value
 
@@ -354,7 +354,7 @@ test "__emutls_get_address with default_value" {
 
     try expect(value == 5678); // the default value didn't change
 
-    var y: *usize = @ptrCast(@alignCast(__emutls_get_address(&ctl)));
+    const y: *usize = @ptrCast(@alignCast(__emutls_get_address(&ctl)));
     try expect(y.* == 9012); // the modified storage persists
 }
 
@@ -364,7 +364,7 @@ test "test default_value with differents sizes" {
     const testType = struct {
         fn _testType(comptime T: type, value: T) !void {
             var ctl = emutls_control.init(T, &value);
-            var x = ctl.get_typed_pointer(T);
+            const x = ctl.get_typed_pointer(T);
             try expect(x.* == value);
         }
     }._testType;
lib/compiler_rt/exp.zig
@@ -117,7 +117,7 @@ pub fn exp(x_: f64) callconv(.C) f64 {
     const P5: f64 = 4.13813679705723846039e-08;
 
     var x = x_;
-    var ux: u64 = @bitCast(x);
+    const ux: u64 = @bitCast(x);
     var hx = ux >> 32;
     const sign: i32 = @intCast(hx >> 31);
     hx &= 0x7FFFFFFF;
lib/compiler_rt/exp2.zig
@@ -38,7 +38,7 @@ pub fn exp2f(x: f32) callconv(.C) f32 {
     const P3: f32 = 0x1.c6b348p-5;
     const P4: f32 = 0x1.3b2c9cp-7;
 
-    var u: u32 = @bitCast(x);
+    const u: u32 = @bitCast(x);
     const ix = u & 0x7FFFFFFF;
 
     // |x| > 126
lib/compiler_rt/ffsdi2_test.zig
@@ -2,8 +2,8 @@ const ffs = @import("count0bits.zig");
 const testing = @import("std").testing;
 
 fn test__ffsdi2(a: u64, expected: i32) !void {
-    var x = @as(i64, @bitCast(a));
-    var result = ffs.__ffsdi2(x);
+    const x = @as(i64, @bitCast(a));
+    const result = ffs.__ffsdi2(x);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/ffssi2_test.zig
@@ -2,8 +2,8 @@ const ffs = @import("count0bits.zig");
 const testing = @import("std").testing;
 
 fn test__ffssi2(a: u32, expected: i32) !void {
-    var x = @as(i32, @bitCast(a));
-    var result = ffs.__ffssi2(x);
+    const x = @as(i32, @bitCast(a));
+    const result = ffs.__ffssi2(x);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/ffsti2_test.zig
@@ -2,8 +2,8 @@ const ffs = @import("count0bits.zig");
 const testing = @import("std").testing;
 
 fn test__ffsti2(a: u128, expected: i32) !void {
-    var x = @as(i128, @bitCast(a));
-    var result = ffs.__ffsti2(x);
+    const x = @as(i128, @bitCast(a));
+    const result = ffs.__ffsti2(x);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/float_from_int.zig
@@ -18,12 +18,12 @@ pub fn floatFromInt(comptime T: type, x: anytype) T {
     const max_exp = exp_bias;
 
     // Sign
-    var abs_val = if (@TypeOf(x) == comptime_int or @typeInfo(@TypeOf(x)).Int.signedness == .signed) @abs(x) else x;
+    const abs_val = if (@TypeOf(x) == comptime_int or @typeInfo(@TypeOf(x)).Int.signedness == .signed) @abs(x) else x;
     const sign_bit = if (x < 0) @as(uT, 1) << (float_bits - 1) else 0;
     var result: uT = sign_bit;
 
     // Compute significand
-    var exp = int_bits - @clz(abs_val) - 1;
+    const exp = int_bits - @clz(abs_val) - 1;
     if (int_bits <= fractional_bits or exp <= fractional_bits) {
         const shift_amt = fractional_bits - @as(math.Log2Int(uT), @intCast(exp));
 
@@ -31,7 +31,7 @@ pub fn floatFromInt(comptime T: type, x: anytype) T {
         result = @as(uT, @intCast(abs_val)) << shift_amt;
         result ^= implicit_bit; // Remove implicit integer bit
     } else {
-        var shift_amt: math.Log2Int(Z) = @intCast(exp - fractional_bits);
+        const shift_amt: math.Log2Int(Z) = @intCast(exp - fractional_bits);
         const exact_tie: bool = @ctz(abs_val) == shift_amt - 1;
 
         // Shift down result and remove implicit integer bit
lib/compiler_rt/fma.zig
@@ -59,13 +59,13 @@ pub fn fma(x: f64, y: f64, z: f64) callconv(.C) f64 {
     }
 
     const x1 = math.frexp(x);
-    var ex = x1.exponent;
-    var xs = x1.significand;
+    const ex = x1.exponent;
+    const xs = x1.significand;
     const x2 = math.frexp(y);
-    var ey = x2.exponent;
-    var ys = x2.significand;
+    const ey = x2.exponent;
+    const ys = x2.significand;
     const x3 = math.frexp(z);
-    var ez = x3.exponent;
+    const ez = x3.exponent;
     var zs = x3.significand;
 
     var spread = ex + ey - ez;
@@ -118,13 +118,13 @@ pub fn fmaq(x: f128, y: f128, z: f128) callconv(.C) f128 {
     }
 
     const x1 = math.frexp(x);
-    var ex = x1.exponent;
-    var xs = x1.significand;
+    const ex = x1.exponent;
+    const xs = x1.significand;
     const x2 = math.frexp(y);
-    var ey = x2.exponent;
-    var ys = x2.significand;
+    const ey = x2.exponent;
+    const ys = x2.significand;
     const x3 = math.frexp(z);
-    var ez = x3.exponent;
+    const ez = x3.exponent;
     var zs = x3.significand;
 
     var spread = ex + ey - ez;
@@ -181,15 +181,15 @@ fn dd_mul(a: f64, b: f64) dd {
     var p = a * split;
     var ha = a - p;
     ha += p;
-    var la = a - ha;
+    const la = a - ha;
 
     p = b * split;
     var hb = b - p;
     hb += p;
-    var lb = b - hb;
+    const lb = b - hb;
 
     p = ha * hb;
-    var q = ha * lb + la * hb;
+    const q = ha * lb + la * hb;
 
     ret.hi = p + q;
     ret.lo = p - ret.hi + q + la * lb;
@@ -301,15 +301,15 @@ fn dd_mul128(a: f128, b: f128) dd128 {
     var p = a * split;
     var ha = a - p;
     ha += p;
-    var la = a - ha;
+    const la = a - ha;
 
     p = b * split;
     var hb = b - p;
     hb += p;
-    var lb = b - hb;
+    const lb = b - hb;
 
     p = ha * hb;
-    var q = ha * lb + la * hb;
+    const q = ha * lb + la * hb;
 
     ret.hi = p + q;
     ret.lo = p - ret.hi + q + la * lb;
lib/compiler_rt/fmod.zig
@@ -81,13 +81,13 @@ pub fn __fmodx(a: f80, b: f80) callconv(.C) f80 {
     if (expB == 0) expB = normalize(f80, &bRep);
 
     var highA: u64 = 0;
-    var highB: u64 = 0;
+    const highB: u64 = 0;
     var lowA: u64 = @truncate(aRep);
-    var lowB: u64 = @truncate(bRep);
+    const lowB: u64 = @truncate(bRep);
 
     while (expA > expB) : (expA -= 1) {
         var high = highA -% highB;
-        var low = lowA -% lowB;
+        const low = lowA -% lowB;
         if (lowA < lowB) {
             high -%= 1;
         }
@@ -104,7 +104,7 @@ pub fn __fmodx(a: f80, b: f80) callconv(.C) f80 {
     }
 
     var high = highA -% highB;
-    var low = lowA -% lowB;
+    const low = lowA -% lowB;
     if (lowA < lowB) {
         high -%= 1;
     }
@@ -194,13 +194,13 @@ pub fn fmodq(a: f128, b: f128) callconv(.C) f128 {
 
     // OR in extra non-stored mantissa digit
     var highA: u64 = (aPtr_u64[high_index] & (std.math.maxInt(u64) >> 16)) | 1 << 48;
-    var highB: u64 = (bPtr_u64[high_index] & (std.math.maxInt(u64) >> 16)) | 1 << 48;
+    const highB: u64 = (bPtr_u64[high_index] & (std.math.maxInt(u64) >> 16)) | 1 << 48;
     var lowA: u64 = aPtr_u64[low_index];
-    var lowB: u64 = bPtr_u64[low_index];
+    const lowB: u64 = bPtr_u64[low_index];
 
     while (expA > expB) : (expA -= 1) {
         var high = highA -% highB;
-        var low = lowA -% lowB;
+        const low = lowA -% lowB;
         if (lowA < lowB) {
             high -%= 1;
         }
@@ -217,7 +217,7 @@ pub fn fmodq(a: f128, b: f128) callconv(.C) f128 {
     }
 
     var high = highA -% highB;
-    var low = lowA -% lowB;
+    const low = lowA -% lowB;
     if (lowA < lowB) {
         high -= 1;
     }
lib/compiler_rt/mulc3.zig
@@ -25,7 +25,7 @@ pub inline fn mulc3(comptime T: type, a_in: T, b_in: T, c_in: T, d_in: T) Comple
     const zero: T = 0.0;
     const one: T = 1.0;
 
-    var z = Complex(T){
+    const z: Complex(T) = .{
         .real = ac - bd,
         .imag = ad + bc,
     };
lib/compiler_rt/mulc3_test.zig
@@ -19,20 +19,20 @@ test {
 
 fn testMul(comptime T: type, comptime f: fn (T, T, T, T) callconv(.C) Complex(T)) !void {
     {
-        var a: T = 1.0;
-        var b: T = 0.0;
-        var c: T = -1.0;
-        var d: T = 0.0;
+        const a: T = 1.0;
+        const b: T = 0.0;
+        const c: T = -1.0;
+        const d: T = 0.0;
 
         const result = f(a, b, c, d);
         try expect(result.real == -1.0);
         try expect(result.imag == 0.0);
     }
     {
-        var a: T = 1.0;
-        var b: T = 0.0;
-        var c: T = -4.0;
-        var d: T = 0.0;
+        const a: T = 1.0;
+        const b: T = 0.0;
+        const c: T = -4.0;
+        const d: T = 0.0;
 
         const result = f(a, b, c, d);
         try expect(result.real == -4.0);
@@ -41,10 +41,10 @@ fn testMul(comptime T: type, comptime f: fn (T, T, T, T) callconv(.C) Complex(T)
     {
         // if one operand is an infinity and the other operand is a nonzero finite number or an infinity,
         // then the result of the * operator is an infinity;
-        var a: T = math.inf(T);
-        var b: T = -math.inf(T);
-        var c: T = 1.0;
-        var d: T = 0.0;
+        const a: T = math.inf(T);
+        const b: T = -math.inf(T);
+        const c: T = 1.0;
+        const d: T = 0.0;
 
         const result = f(a, b, c, d);
         try expect(result.real == math.inf(T));
@@ -53,10 +53,10 @@ fn testMul(comptime T: type, comptime f: fn (T, T, T, T) callconv(.C) Complex(T)
     {
         // if one operand is an infinity and the other operand is a nonzero finite number or an infinity,
         // then the result of the * operator is an infinity;
-        var a: T = math.inf(T);
-        var b: T = -1.0;
-        var c: T = 1.0;
-        var d: T = math.inf(T);
+        const a: T = math.inf(T);
+        const b: T = -1.0;
+        const c: T = 1.0;
+        const d: T = math.inf(T);
 
         const result = f(a, b, c, d);
         try expect(result.real == math.inf(T));
lib/compiler_rt/mulo.zig
@@ -20,7 +20,7 @@ comptime {
 inline fn muloXi4_genericSmall(comptime ST: type, a: ST, b: ST, overflow: *c_int) ST {
     overflow.* = 0;
     const min = math.minInt(ST);
-    var res: ST = a *% b;
+    const res: ST = a *% b;
     // Hacker's Delight section Overflow subsection Multiplication
     // case a=-2^{31}, b=-1 problem, because
     // on some machines a*b = -2^{31} with overflow
@@ -41,7 +41,7 @@ inline fn muloXi4_genericFast(comptime ST: type, a: ST, b: ST, overflow: *c_int)
     };
     const min = math.minInt(ST);
     const max = math.maxInt(ST);
-    var res: EST = @as(EST, a) * @as(EST, b);
+    const res: EST = @as(EST, a) * @as(EST, b);
     //invariant: -2^{bitwidth(EST)} < res < 2^{bitwidth(EST)-1}
     if (res < min or max < res)
         overflow.* = 1;
lib/compiler_rt/negdi2_test.zig
@@ -2,7 +2,7 @@ const neg = @import("negXi2.zig");
 const testing = @import("std").testing;
 
 fn test__negdi2(a: i64, expected: i64) !void {
-    var result = neg.__negdi2(a);
+    const result = neg.__negdi2(a);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/negsi2_test.zig
@@ -5,7 +5,7 @@ const testing = std.testing;
 const print = std.debug.print;
 
 fn test__negsi2(a: i32, expected: i32) !void {
-    var result = neg.__negsi2(a);
+    const result = neg.__negsi2(a);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/negti2_test.zig
@@ -2,7 +2,7 @@ const neg = @import("negXi2.zig");
 const testing = @import("std").testing;
 
 fn test__negti2(a: i128, expected: i128) !void {
-    var result = neg.__negti2(a);
+    const result = neg.__negti2(a);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/negvdi2_test.zig
@@ -2,7 +2,7 @@ const negv = @import("negv.zig");
 const testing = @import("std").testing;
 
 fn test__negvdi2(a: i64, expected: i64) !void {
-    var result = negv.__negvdi2(a);
+    const result = negv.__negvdi2(a);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/negvsi2_test.zig
@@ -2,7 +2,7 @@ const negv = @import("negv.zig");
 const testing = @import("std").testing;
 
 fn test__negvsi2(a: i32, expected: i32) !void {
-    var result = negv.__negvsi2(a);
+    const result = negv.__negvsi2(a);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/negvti2_test.zig
@@ -2,7 +2,7 @@ const negv = @import("negv.zig");
 const testing = @import("std").testing;
 
 fn test__negvti2(a: i128, expected: i128) !void {
-    var result = negv.__negvti2(a);
+    const result = negv.__negvti2(a);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/paritydi2_test.zig
@@ -13,8 +13,8 @@ fn paritydi2Naive(a: i64) i32 {
 }
 
 fn test__paritydi2(a: i64) !void {
-    var x = parity.__paritydi2(a);
-    var expected: i64 = paritydi2Naive(a);
+    const x = parity.__paritydi2(a);
+    const expected: i64 = paritydi2Naive(a);
     try testing.expectEqual(expected, x);
 }
 
@@ -30,7 +30,7 @@ test "paritydi2" {
     var rnd = RndGen.init(42);
     var i: u32 = 0;
     while (i < 10_000) : (i += 1) {
-        var rand_num = rnd.random().int(i64);
+        const rand_num = rnd.random().int(i64);
         try test__paritydi2(rand_num);
     }
 }
lib/compiler_rt/paritysi2_test.zig
@@ -13,8 +13,8 @@ fn paritysi2Naive(a: i32) i32 {
 }
 
 fn test__paritysi2(a: i32) !void {
-    var x = parity.__paritysi2(a);
-    var expected: i32 = paritysi2Naive(a);
+    const x = parity.__paritysi2(a);
+    const expected: i32 = paritysi2Naive(a);
     try testing.expectEqual(expected, x);
 }
 
@@ -30,7 +30,7 @@ test "paritysi2" {
     var rnd = RndGen.init(42);
     var i: u32 = 0;
     while (i < 10_000) : (i += 1) {
-        var rand_num = rnd.random().int(i32);
+        const rand_num = rnd.random().int(i32);
         try test__paritysi2(rand_num);
     }
 }
lib/compiler_rt/parityti2_test.zig
@@ -13,8 +13,8 @@ fn parityti2Naive(a: i128) i32 {
 }
 
 fn test__parityti2(a: i128) !void {
-    var x = parity.__parityti2(a);
-    var expected: i128 = parityti2Naive(a);
+    const x = parity.__parityti2(a);
+    const expected: i128 = parityti2Naive(a);
     try testing.expectEqual(expected, x);
 }
 
@@ -30,7 +30,7 @@ test "parityti2" {
     var rnd = RndGen.init(42);
     var i: u32 = 0;
     while (i < 10_000) : (i += 1) {
-        var rand_num = rnd.random().int(i128);
+        const rand_num = rnd.random().int(i128);
         try test__parityti2(rand_num);
     }
 }
lib/compiler_rt/popcountdi2_test.zig
@@ -29,7 +29,7 @@ test "popcountdi2" {
     var rnd = RndGen.init(42);
     var i: u32 = 0;
     while (i < 10_000) : (i += 1) {
-        var rand_num = rnd.random().int(i64);
+        const rand_num = rnd.random().int(i64);
         try test__popcountdi2(rand_num);
     }
 }
lib/compiler_rt/popcountsi2_test.zig
@@ -29,7 +29,7 @@ test "popcountsi2" {
     var rnd = RndGen.init(42);
     var i: u32 = 0;
     while (i < 10_000) : (i += 1) {
-        var rand_num = rnd.random().int(i32);
+        const rand_num = rnd.random().int(i32);
         try test__popcountsi2(rand_num);
     }
 }
lib/compiler_rt/popcountti2_test.zig
@@ -29,7 +29,7 @@ test "popcountti2" {
     var rnd = RndGen.init(42);
     var i: u32 = 0;
     while (i < 10_000) : (i += 1) {
-        var rand_num = rnd.random().int(i128);
+        const rand_num = rnd.random().int(i128);
         try test__popcountti2(rand_num);
     }
 }
lib/compiler_rt/powiXf2_test.zig
@@ -9,27 +9,27 @@ const testing = std.testing;
 const math = std.math;
 
 fn test__powihf2(a: f16, b: i32, expected: f16) !void {
-    var result = powiXf2.__powihf2(a, b);
+    const result = powiXf2.__powihf2(a, b);
     try testing.expectEqual(expected, result);
 }
 
 fn test__powisf2(a: f32, b: i32, expected: f32) !void {
-    var result = powiXf2.__powisf2(a, b);
+    const result = powiXf2.__powisf2(a, b);
     try testing.expectEqual(expected, result);
 }
 
 fn test__powidf2(a: f64, b: i32, expected: f64) !void {
-    var result = powiXf2.__powidf2(a, b);
+    const result = powiXf2.__powidf2(a, b);
     try testing.expectEqual(expected, result);
 }
 
 fn test__powitf2(a: f128, b: i32, expected: f128) !void {
-    var result = powiXf2.__powitf2(a, b);
+    const result = powiXf2.__powitf2(a, b);
     try testing.expectEqual(expected, result);
 }
 
 fn test__powixf2(a: f80, b: i32, expected: f80) !void {
-    var result = powiXf2.__powixf2(a, b);
+    const result = powiXf2.__powixf2(a, b);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/subo.zig
@@ -27,7 +27,7 @@ pub fn __suboti4(a: i128, b: i128, overflow: *c_int) callconv(.C) i128 {
 
 inline fn suboXi4_generic(comptime ST: type, a: ST, b: ST, overflow: *c_int) ST {
     overflow.* = 0;
-    var sum: ST = a -% b;
+    const sum: ST = a -% b;
     // Hackers Delight: section Overflow Detection, subsection Signed Add/Subtract
     // Let sum = a -% b == a - b - carry == wraparound subtraction.
     // Overflow in a-b-carry occurs, iff a and b have opposite signs
lib/compiler_rt/subodi4_test.zig
@@ -6,8 +6,8 @@ const math = std.math;
 fn test__subodi4(a: i64, b: i64) !void {
     var result_ov: c_int = undefined;
     var expected_ov: c_int = undefined;
-    var result = subo.__subodi4(a, b, &result_ov);
-    var expected: i64 = simple_subodi4(a, b, &expected_ov);
+    const result = subo.__subodi4(a, b, &result_ov);
+    const expected: i64 = simple_subodi4(a, b, &expected_ov);
     try testing.expectEqual(expected, result);
     try testing.expectEqual(expected_ov, result_ov);
 }
lib/compiler_rt/subosi4_test.zig
@@ -4,8 +4,8 @@ const testing = @import("std").testing;
 fn test__subosi4(a: i32, b: i32) !void {
     var result_ov: c_int = undefined;
     var expected_ov: c_int = undefined;
-    var result = subo.__subosi4(a, b, &result_ov);
-    var expected: i32 = simple_subosi4(a, b, &expected_ov);
+    const result = subo.__subosi4(a, b, &result_ov);
+    const expected: i32 = simple_subosi4(a, b, &expected_ov);
     try testing.expectEqual(expected, result);
     try testing.expectEqual(expected_ov, result_ov);
 }
lib/compiler_rt/suboti4_test.zig
@@ -6,8 +6,8 @@ const math = std.math;
 fn test__suboti4(a: i128, b: i128) !void {
     var result_ov: c_int = undefined;
     var expected_ov: c_int = undefined;
-    var result = subo.__suboti4(a, b, &result_ov);
-    var expected: i128 = simple_suboti4(a, b, &expected_ov);
+    const result = subo.__suboti4(a, b, &result_ov);
+    const expected: i128 = simple_suboti4(a, b, &expected_ov);
     try testing.expectEqual(expected, result);
     try testing.expectEqual(expected_ov, result_ov);
 }
lib/compiler_rt/ucmpdi2_test.zig
@@ -2,7 +2,7 @@ const cmp = @import("cmp.zig");
 const testing = @import("std").testing;
 
 fn test__ucmpdi2(a: u64, b: u64, expected: i32) !void {
-    var result = cmp.__ucmpdi2(a, b);
+    const result = cmp.__ucmpdi2(a, b);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/ucmpsi2_test.zig
@@ -2,7 +2,7 @@ const cmp = @import("cmp.zig");
 const testing = @import("std").testing;
 
 fn test__ucmpsi2(a: u32, b: u32, expected: i32) !void {
-    var result = cmp.__ucmpsi2(a, b);
+    const result = cmp.__ucmpsi2(a, b);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/ucmpti2_test.zig
@@ -2,7 +2,7 @@ const cmp = @import("cmp.zig");
 const testing = @import("std").testing;
 
 fn test__ucmpti2(a: u128, b: u128, expected: i32) !void {
-    var result = cmp.__ucmpti2(a, b);
+    const result = cmp.__ucmpti2(a, b);
     try testing.expectEqual(expected, result);
 }
 
lib/compiler_rt/udivmod.zig
@@ -52,7 +52,7 @@ fn divwide_generic(comptime T: type, _u1: T, _u0: T, v_: T, r: *T) T {
         if (rhat >= b) break;
     }
 
-    var un21 = un64 *% b +% un1 -% q1 *% v;
+    const un21 = un64 *% b +% un1 -% q1 *% v;
 
     // Compute the second quotient digit
     var q0 = un21 / vn1;
@@ -101,8 +101,8 @@ pub fn udivmod(comptime T: type, a_: T, b_: T, maybe_rem: ?*T) T {
         return 0;
     }
 
-    var a: [2]HalfT = @bitCast(a_);
-    var b: [2]HalfT = @bitCast(b_);
+    const a: [2]HalfT = @bitCast(a_);
+    const b: [2]HalfT = @bitCast(b_);
     var q: [2]HalfT = undefined;
     var r: [2]HalfT = undefined;
 
@@ -125,7 +125,7 @@ pub fn udivmod(comptime T: type, a_: T, b_: T, maybe_rem: ?*T) T {
     }
 
     // 0 <= shift <= 63
-    var shift: Log2Int(T) = @clz(b[hi]) - @clz(a[hi]);
+    const shift: Log2Int(T) = @clz(b[hi]) - @clz(a[hi]);
     var af: T = @bitCast(a);
     var bf = @as(T, @bitCast(b)) << shift;
     q = @bitCast(@as(T, 0));
lib/compiler_rt/udivmodei4.zig
@@ -116,7 +116,7 @@ pub fn __udivei4(r_q: [*]u32, u_p: [*]const u32, v_p: [*]const u32, bits: usize)
     @setRuntimeSafety(builtin.is_test);
     const u = u_p[0 .. bits / 32];
     const v = v_p[0 .. bits / 32];
-    var q = r_q[0 .. bits / 32];
+    const q = r_q[0 .. bits / 32];
     @call(.always_inline, divmod, .{ q, null, u, v }) catch unreachable;
 }
 
@@ -124,7 +124,7 @@ pub fn __umodei4(r_p: [*]u32, u_p: [*]const u32, v_p: [*]const u32, bits: usize)
     @setRuntimeSafety(builtin.is_test);
     const u = u_p[0 .. bits / 32];
     const v = v_p[0 .. bits / 32];
-    var r = r_p[0 .. bits / 32];
+    const r = r_p[0 .. bits / 32];
     @call(.always_inline, divmod, .{ null, r, u, v }) catch unreachable;
 }
 
lib/std/atomic/Atomic.zig
@@ -125,7 +125,7 @@ pub fn Atomic(comptime T: type) type {
                 @compileError(@tagName(Ordering.Unordered) ++ " is only allowed on atomic loads and stores");
             }
 
-            comptime var success_is_stronger = switch (failure) {
+            const success_is_stronger = switch (failure) {
                 .SeqCst => success == .SeqCst,
                 .AcqRel => @compileError(@tagName(failure) ++ " implies " ++ @tagName(Ordering.Release) ++ " which is only allowed on success"),
                 .Acquire => success == .SeqCst or success == .AcqRel or success == .Acquire,
lib/std/atomic/queue.zig
@@ -175,11 +175,11 @@ const puts_per_thread = 500;
 const put_thread_count = 3;
 
 test "std.atomic.Queue" {
-    var plenty_of_memory = try std.heap.page_allocator.alloc(u8, 300 * 1024);
+    const plenty_of_memory = try std.heap.page_allocator.alloc(u8, 300 * 1024);
     defer std.heap.page_allocator.free(plenty_of_memory);
 
     var fixed_buffer_allocator = std.heap.FixedBufferAllocator.init(plenty_of_memory);
-    var a = fixed_buffer_allocator.threadSafeAllocator();
+    const a = fixed_buffer_allocator.threadSafeAllocator();
 
     var queue = Queue(i32).init();
     var context = Context{
lib/std/atomic/stack.zig
@@ -85,11 +85,11 @@ const puts_per_thread = 500;
 const put_thread_count = 3;
 
 test "std.atomic.stack" {
-    var plenty_of_memory = try std.heap.page_allocator.alloc(u8, 300 * 1024);
+    const plenty_of_memory = try std.heap.page_allocator.alloc(u8, 300 * 1024);
     defer std.heap.page_allocator.free(plenty_of_memory);
 
     var fixed_buffer_allocator = std.heap.FixedBufferAllocator.init(plenty_of_memory);
-    var a = fixed_buffer_allocator.threadSafeAllocator();
+    const a = fixed_buffer_allocator.threadSafeAllocator();
 
     var stack = Stack(i32).init();
     var context = Context{
lib/std/Build/Cache/DepTokenizer.zig
@@ -950,7 +950,7 @@ fn printSection(out: anytype, label: []const u8, bytes: []const u8) !void {
 
 fn printLabel(out: anytype, label: []const u8, bytes: []const u8) !void {
     var buf: [80]u8 = undefined;
-    var text = try std.fmt.bufPrint(buf[0..], "{s} {d} bytes ", .{ label, bytes.len });
+    const text = try std.fmt.bufPrint(buf[0..], "{s} {d} bytes ", .{ label, bytes.len });
     try out.writeAll(text);
     var i: usize = text.len;
     const end = 79;
@@ -983,12 +983,12 @@ fn hexDump(out: anytype, bytes: []const u8) !void {
         try printDecValue(out, offset, 8);
         try out.writeAll(":");
         try out.writeAll(" ");
-        var end1 = @min(offset + n, offset + 8);
+        const end1 = @min(offset + n, offset + 8);
         for (bytes[offset..end1]) |b| {
             try out.writeAll(" ");
             try printHexValue(out, b, 2);
         }
-        var end2 = offset + n;
+        const end2 = offset + n;
         if (end2 > end1) {
             try out.writeAll(" ");
             for (bytes[end1..end2]) |b| {
lib/std/Build/Step/CheckObject.zig
@@ -293,7 +293,7 @@ const Check = struct {
 
 /// Creates a new empty sequence of actions.
 pub fn checkStart(self: *CheckObject) void {
-    var new_check = Check.create(self.step.owner.allocator);
+    const new_check = Check.create(self.step.owner.allocator);
     self.checks.append(new_check) catch @panic("OOM");
 }
 
lib/std/Build/Step/ConfigHeader.zig
@@ -307,8 +307,8 @@ fn render_cmake(
     values: std.StringArrayHashMap(Value),
     src_path: []const u8,
 ) !void {
-    var build = step.owner;
-    var allocator = build.allocator;
+    const build = step.owner;
+    const allocator = build.allocator;
 
     var values_copy = try values.clone();
     defer values_copy.deinit();
lib/std/Build/Step/Run.zig
@@ -301,7 +301,7 @@ pub fn addPathDir(self: *Run, search_path: []const u8) void {
     const env_map = getEnvMapInternal(self);
 
     const key = "PATH";
-    var prev_path = env_map.get(key);
+    const prev_path = env_map.get(key);
 
     if (prev_path) |pp| {
         const new_path = b.fmt("{s}" ++ [1]u8{fs.path.delimiter} ++ "{s}", .{ pp, search_path });
lib/std/Build/Cache.zig
@@ -141,7 +141,7 @@ fn findPrefixResolved(cache: *const Cache, resolved_path: []u8) !PrefixedPath {
     var i: u8 = 1; // Start at 1 to skip over checking the null prefix.
     while (i < prefixes_slice.len) : (i += 1) {
         const p = prefixes_slice[i].path.?;
-        var sub_path = getPrefixSubpath(gpa, p, resolved_path) catch |err| switch (err) {
+        const sub_path = getPrefixSubpath(gpa, p, resolved_path) catch |err| switch (err) {
             error.NotASubPath => continue,
             else => |e| return e,
         };
lib/std/compress/deflate/bits_utils.zig
@@ -15,7 +15,7 @@ test "bitReverse" {
         out: u16,
     };
 
-    var reverse_bits_tests = [_]ReverseBitsTest{
+    const reverse_bits_tests = [_]ReverseBitsTest{
         .{ .in = 1, .bit_count = 1, .out = 1 },
         .{ .in = 1, .bit_count = 2, .out = 2 },
         .{ .in = 1, .bit_count = 3, .out = 4 },
@@ -27,7 +27,7 @@ test "bitReverse" {
     };
 
     for (reverse_bits_tests) |h| {
-        var v = bitReverse(u16, h.in, h.bit_count);
+        const v = bitReverse(u16, h.in, h.bit_count);
         try std.testing.expectEqual(h.out, v);
     }
 }
lib/std/compress/deflate/compressor.zig
@@ -156,8 +156,8 @@ fn levels(compression: Compression) CompressionLevel {
 // up to length 'max'. Both slices must be at least 'max'
 // bytes in size.
 fn matchLen(a: []u8, b: []u8, max: u32) u32 {
-    var bounded_a = a[0..max];
-    var bounded_b = b[0..max];
+    const bounded_a = a[0..max];
+    const bounded_b = b[0..max];
     for (bounded_a, 0..) |av, i| {
         if (bounded_b[i] != av) {
             return @as(u32, @intCast(i));
@@ -191,7 +191,7 @@ fn bulkHash4(b: []u8, dst: []u32) u32 {
         @as(u32, b[0]) << 24;
 
     dst[0] = (hb *% hash_mul) >> (32 - hash_bits);
-    var end = b.len - min_match_length + 1;
+    const end = b.len - min_match_length + 1;
     var i: u32 = 1;
     while (i < end) : (i += 1) {
         hb = (hb << 8) | @as(u32, b[i + 3]);
@@ -305,7 +305,7 @@ pub fn Compressor(comptime WriterType: anytype) type {
                 }
                 self.hash_offset += window_size;
                 if (self.hash_offset > max_hash_offset) {
-                    var delta = self.hash_offset - 1;
+                    const delta = self.hash_offset - 1;
                     self.hash_offset -= delta;
                     self.chain_head -|= delta;
 
@@ -369,31 +369,31 @@ pub fn Compressor(comptime WriterType: anytype) type {
             }
             // Add all to window.
             @memcpy(self.window[0..b.len], b);
-            var n = b.len;
+            const n = b.len;
 
             // Calculate 256 hashes at the time (more L1 cache hits)
-            var loops = (n + 256 - min_match_length) / 256;
+            const loops = (n + 256 - min_match_length) / 256;
             var j: usize = 0;
             while (j < loops) : (j += 1) {
-                var index = j * 256;
+                const index = j * 256;
                 var end = index + 256 + min_match_length - 1;
                 if (end > n) {
                     end = n;
                 }
-                var to_check = self.window[index..end];
-                var dst_size = to_check.len - min_match_length + 1;
+                const to_check = self.window[index..end];
+                const dst_size = to_check.len - min_match_length + 1;
 
                 if (dst_size <= 0) {
                     continue;
                 }
 
-                var dst = self.hash_match[0..dst_size];
+                const dst = self.hash_match[0..dst_size];
                 _ = self.bulk_hasher(to_check, dst);
                 var new_h: u32 = 0;
                 for (dst, 0..) |val, i| {
-                    var di = i + index;
+                    const di = i + index;
                     new_h = val;
-                    var hh = &self.hash_head[new_h & hash_mask];
+                    const hh = &self.hash_head[new_h & hash_mask];
                     // Get previous value with the same hash.
                     // Our chain should point to the previous value.
                     self.hash_prev[di & window_mask] = hh.*;
@@ -447,13 +447,13 @@ pub fn Compressor(comptime WriterType: anytype) type {
             }
 
             var w_end = win[pos + length];
-            var w_pos = win[pos..];
-            var min_index = pos -| window_size;
+            const w_pos = win[pos..];
+            const min_index = pos -| window_size;
 
             var i = prev_head;
             while (tries > 0) : (tries -= 1) {
                 if (w_end == win[i + length]) {
-                    var n = matchLen(win[i..], w_pos, min_match_look);
+                    const n = matchLen(win[i..], w_pos, min_match_look);
 
                     if (n > length and (n > min_match_length or pos - i <= 4096)) {
                         length = n;
@@ -565,7 +565,7 @@ pub fn Compressor(comptime WriterType: anytype) type {
             while (true) {
                 assert(self.index <= self.window_end);
 
-                var lookahead = self.window_end -| self.index;
+                const lookahead = self.window_end -| self.index;
                 if (lookahead < min_match_length + max_match_length) {
                     if (!self.sync) {
                         break;
@@ -590,16 +590,16 @@ pub fn Compressor(comptime WriterType: anytype) type {
                 if (self.index < self.max_insert_index) {
                     // Update the hash
                     self.hash = hash4(self.window[self.index .. self.index + min_match_length]);
-                    var hh = &self.hash_head[self.hash & hash_mask];
+                    const hh = &self.hash_head[self.hash & hash_mask];
                     self.chain_head = @as(u32, @intCast(hh.*));
                     self.hash_prev[self.index & window_mask] = @as(u32, @intCast(self.chain_head));
                     hh.* = @as(u32, @intCast(self.index + self.hash_offset));
                 }
-                var prev_length = self.length;
-                var prev_offset = self.offset;
+                const prev_length = self.length;
+                const prev_offset = self.offset;
                 self.length = min_match_length - 1;
                 self.offset = 0;
-                var min_index = self.index -| window_size;
+                const min_index = self.index -| window_size;
 
                 if (self.hash_offset <= self.chain_head and
                     self.chain_head - self.hash_offset >= min_index and
@@ -610,7 +610,7 @@ pub fn Compressor(comptime WriterType: anytype) type {
                     prev_length < self.compression_level.lazy))
                 {
                     {
-                        var fmatch = self.findMatch(
+                        const fmatch = self.findMatch(
                             self.index,
                             self.chain_head -| self.hash_offset,
                             min_match_length - 1,
@@ -658,7 +658,7 @@ pub fn Compressor(comptime WriterType: anytype) type {
                                 self.hash = hash4(self.window[index .. index + min_match_length]);
                                 // Get previous value with the same hash.
                                 // Our chain should point to the previous value.
-                                var hh = &self.hash_head[self.hash & hash_mask];
+                                const hh = &self.hash_head[self.hash & hash_mask];
                                 self.hash_prev[index & window_mask] = hh.*;
                                 // Set the head of the hash chain to us.
                                 hh.* = @as(u32, @intCast(index + self.hash_offset));
@@ -740,7 +740,7 @@ pub fn Compressor(comptime WriterType: anytype) type {
             // compressed form of data to its underlying writer.
             while (buf.len > 0) {
                 try self.step();
-                var filled = self.fill(buf);
+                const filled = self.fill(buf);
                 buf = buf[filled..];
             }
 
@@ -1097,12 +1097,12 @@ test "bulkHash4" {
         while (j < out.len) : (j += 1) {
             var y = out[0..j];
 
-            var dst = try testing.allocator.alloc(u32, y.len - min_match_length + 1);
+            const dst = try testing.allocator.alloc(u32, y.len - min_match_length + 1);
             defer testing.allocator.free(dst);
 
             _ = bulkHash4(y, dst);
             for (dst, 0..) |got, i| {
-                var want = hash4(y[i..]);
+                const want = hash4(y[i..]);
                 try testing.expectEqual(want, got);
             }
         }
lib/std/compress/deflate/compressor_test.zig
@@ -27,7 +27,7 @@ fn testSync(level: deflate.Compression, input: []const u8) !void {
     var whole_buf = std.ArrayList(u8).init(testing.allocator);
     defer whole_buf.deinit();
 
-    var multi_writer = io.multiWriter(.{
+    const multi_writer = io.multiWriter(.{
         divided_buf.writer(),
         whole_buf.writer(),
     }).writer();
@@ -48,7 +48,7 @@ fn testSync(level: deflate.Compression, input: []const u8) !void {
         defer decomp.deinit();
 
         // Write first half of the input and flush()
-        var half: usize = (input.len + 1) / 2;
+        const half: usize = (input.len + 1) / 2;
         var half_len: usize = half - 0;
         {
             _ = try comp.writer().writeAll(input[0..half]);
@@ -57,10 +57,10 @@ fn testSync(level: deflate.Compression, input: []const u8) !void {
             try comp.flush();
 
             // Read back
-            var decompressed = try testing.allocator.alloc(u8, half_len);
+            const decompressed = try testing.allocator.alloc(u8, half_len);
             defer testing.allocator.free(decompressed);
 
-            var read = try decomp.reader().readAll(decompressed); // read at least half
+            const read = try decomp.reader().readAll(decompressed); // read at least half
             try testing.expectEqual(half_len, read);
             try testing.expectEqualSlices(u8, input[0..half], decompressed);
         }
@@ -74,7 +74,7 @@ fn testSync(level: deflate.Compression, input: []const u8) !void {
             try comp.close();
 
             // Read back
-            var decompressed = try testing.allocator.alloc(u8, half_len);
+            const decompressed = try testing.allocator.alloc(u8, half_len);
             defer testing.allocator.free(decompressed);
 
             var read = try decomp.reader().readAll(decompressed);
@@ -94,11 +94,11 @@ fn testSync(level: deflate.Compression, input: []const u8) !void {
     try comp.close();
 
     // stream should work for ordinary reader too (reading whole_buf in one go)
-    var whole_buf_reader = io.fixedBufferStream(whole_buf.items).reader();
+    const whole_buf_reader = io.fixedBufferStream(whole_buf.items).reader();
     var decomp = try decompressor(testing.allocator, whole_buf_reader, null);
     defer decomp.deinit();
 
-    var decompressed = try testing.allocator.alloc(u8, input.len);
+    const decompressed = try testing.allocator.alloc(u8, input.len);
     defer testing.allocator.free(decompressed);
 
     _ = try decomp.reader().readAll(decompressed);
@@ -125,10 +125,10 @@ fn testToFromWithLevelAndLimit(level: deflate.Compression, input: []const u8, li
     var decomp = try decompressor(testing.allocator, fib.reader(), null);
     defer decomp.deinit();
 
-    var decompressed = try testing.allocator.alloc(u8, input.len);
+    const decompressed = try testing.allocator.alloc(u8, input.len);
     defer testing.allocator.free(decompressed);
 
-    var read: usize = try decomp.reader().readAll(decompressed);
+    const read: usize = try decomp.reader().readAll(decompressed);
     try testing.expectEqual(input.len, read);
     try testing.expectEqualSlices(u8, input, decompressed);
 
@@ -153,7 +153,7 @@ fn testToFromWithLimit(input: []const u8, limit: [11]u32) !void {
 }
 
 test "deflate/inflate" {
-    var limits = [_]u32{0} ** 11;
+    const limits = [_]u32{0} ** 11;
 
     var test0 = [_]u8{};
     var test1 = [_]u8{0x11};
@@ -313,7 +313,7 @@ test "decompressor dictionary" {
     try comp.writer().writeAll(text);
     try comp.close();
 
-    var decompressed = try testing.allocator.alloc(u8, text.len);
+    const decompressed = try testing.allocator.alloc(u8, text.len);
     defer testing.allocator.free(decompressed);
 
     var decomp = try decompressor(
@@ -432,7 +432,7 @@ test "deflate/inflate string" {
     };
 
     inline for (deflate_inflate_string_tests) |t| {
-        var golden = @embedFile("testdata/" ++ t.filename);
+        const golden = @embedFile("testdata/" ++ t.filename);
         try testToFromWithLimit(golden, t.limit);
     }
 }
@@ -466,14 +466,14 @@ test "inflate reset" {
     var decomp = try decompressor(testing.allocator, fib.reader(), null);
     defer decomp.deinit();
 
-    var decompressed_0: []u8 = try decomp.reader()
+    const decompressed_0: []u8 = try decomp.reader()
         .readAllAlloc(testing.allocator, math.maxInt(usize));
     defer testing.allocator.free(decompressed_0);
 
     fib = io.fixedBufferStream(compressed_strings[1].items);
     try decomp.reset(fib.reader(), null);
 
-    var decompressed_1: []u8 = try decomp.reader()
+    const decompressed_1: []u8 = try decomp.reader()
         .readAllAlloc(testing.allocator, math.maxInt(usize));
     defer testing.allocator.free(decompressed_1);
 
@@ -513,14 +513,14 @@ test "inflate reset dictionary" {
     var decomp = try decompressor(testing.allocator, fib.reader(), dict);
     defer decomp.deinit();
 
-    var decompressed_0: []u8 = try decomp.reader()
+    const decompressed_0: []u8 = try decomp.reader()
         .readAllAlloc(testing.allocator, math.maxInt(usize));
     defer testing.allocator.free(decompressed_0);
 
     fib = io.fixedBufferStream(compressed_strings[1].items);
     try decomp.reset(fib.reader(), dict);
 
-    var decompressed_1: []u8 = try decomp.reader()
+    const decompressed_1: []u8 = try decomp.reader()
         .readAllAlloc(testing.allocator, math.maxInt(usize));
     defer testing.allocator.free(decompressed_1);
 
lib/std/compress/deflate/decompressor.zig
@@ -136,11 +136,11 @@ const HuffmanDecoder = struct {
 
         self.min = min;
         if (max > huffman_chunk_bits) {
-            var num_links = @as(u32, 1) << @as(u5, @intCast(max - huffman_chunk_bits));
+            const num_links = @as(u32, 1) << @as(u5, @intCast(max - huffman_chunk_bits));
             self.link_mask = @as(u32, @intCast(num_links - 1));
 
             // create link tables
-            var link = next_code[huffman_chunk_bits + 1] >> 1;
+            const link = next_code[huffman_chunk_bits + 1] >> 1;
             self.links = try self.allocator.alloc([]u16, huffman_num_chunks - link);
             self.sub_chunks = ArrayList(u32).init(self.allocator);
             self.initialized = true;
@@ -148,7 +148,7 @@ const HuffmanDecoder = struct {
             while (j < huffman_num_chunks) : (j += 1) {
                 var reverse = @as(u32, @intCast(bu.bitReverse(u16, @as(u16, @intCast(j)), 16)));
                 reverse >>= @as(u32, @intCast(16 - huffman_chunk_bits));
-                var off = j - @as(u32, @intCast(link));
+                const off = j - @as(u32, @intCast(link));
                 if (sanity) {
                     // check we are not overwriting an existing chunk
                     assert(self.chunks[reverse] == 0);
@@ -168,9 +168,9 @@ const HuffmanDecoder = struct {
             if (n == 0) {
                 continue;
             }
-            var ncode = next_code[n];
+            const ncode = next_code[n];
             next_code[n] += 1;
-            var chunk = @as(u16, @intCast((li << huffman_value_shift) | n));
+            const chunk = @as(u16, @intCast((li << huffman_value_shift) | n));
             var reverse = @as(u16, @intCast(bu.bitReverse(u16, @as(u16, @intCast(ncode)), 16)));
             reverse >>= @as(u4, @intCast(16 - n));
             if (n <= huffman_chunk_bits) {
@@ -187,14 +187,14 @@ const HuffmanDecoder = struct {
                     self.chunks[off] = chunk;
                 }
             } else {
-                var j = reverse & (huffman_num_chunks - 1);
+                const j = reverse & (huffman_num_chunks - 1);
                 if (sanity) {
                     // Expect an indirect chunk
                     assert(self.chunks[j] & huffman_count_mask == huffman_chunk_bits + 1);
                     // Longer codes should have been
                     // associated with a link table above.
                 }
-                var value = self.chunks[j] >> huffman_value_shift;
+                const value = self.chunks[j] >> huffman_value_shift;
                 var link_tab = self.links[value];
                 reverse >>= huffman_chunk_bits;
                 var off = reverse;
@@ -354,8 +354,8 @@ pub fn Decompressor(comptime ReaderType: type) type {
         fn init(allocator: Allocator, in_reader: ReaderType, dict: ?[]const u8) !Self {
             fixed_huffman_decoder = try fixedHuffmanDecoderInit(allocator);
 
-            var bits = try allocator.create([max_num_lit + max_num_dist]u32);
-            var codebits = try allocator.create([num_codes]u32);
+            const bits = try allocator.create([max_num_lit + max_num_dist]u32);
+            const codebits = try allocator.create([num_codes]u32);
 
             var dd = ddec.DictDecoder{};
             try dd.init(allocator, max_match_offset, dict);
@@ -416,7 +416,7 @@ pub fn Decompressor(comptime ReaderType: type) type {
             }
             self.final = self.b & 1 == 1;
             self.b >>= 1;
-            var typ = self.b & 3;
+            const typ = self.b & 3;
             self.b >>= 2;
             self.nb -= 1 + 2;
             switch (typ) {
@@ -494,21 +494,21 @@ pub fn Decompressor(comptime ReaderType: type) type {
             while (self.nb < 5 + 5 + 4) {
                 try self.moreBits();
             }
-            var nlit = @as(u32, @intCast(self.b & 0x1F)) + 257;
+            const nlit = @as(u32, @intCast(self.b & 0x1F)) + 257;
             if (nlit > max_num_lit) {
                 corrupt_input_error_offset = self.roffset;
                 self.err = InflateError.CorruptInput;
                 return InflateError.CorruptInput;
             }
             self.b >>= 5;
-            var ndist = @as(u32, @intCast(self.b & 0x1F)) + 1;
+            const ndist = @as(u32, @intCast(self.b & 0x1F)) + 1;
             if (ndist > max_num_dist) {
                 corrupt_input_error_offset = self.roffset;
                 self.err = InflateError.CorruptInput;
                 return InflateError.CorruptInput;
             }
             self.b >>= 5;
-            var nclen = @as(u32, @intCast(self.b & 0xF)) + 4;
+            const nclen = @as(u32, @intCast(self.b & 0xF)) + 4;
             // num_codes is 19, so nclen is always valid.
             self.b >>= 4;
             self.nb -= 5 + 5 + 4;
@@ -536,9 +536,9 @@ pub fn Decompressor(comptime ReaderType: type) type {
             // HLIT + 257 code lengths, HDIST + 1 code lengths,
             // using the code length Huffman code.
             i = 0;
-            var n = nlit + ndist;
+            const n = nlit + ndist;
             while (i < n) {
-                var x = try self.huffSym(&self.hd1);
+                const x = try self.huffSym(&self.hd1);
                 if (x < 16) {
                     // Actual length.
                     self.bits[i] = x;
@@ -618,7 +618,7 @@ pub fn Decompressor(comptime ReaderType: type) type {
                 switch (self.step_state) {
                     .init => {
                         // Read literal and/or (length, distance) according to RFC section 3.2.3.
-                        var v = try self.huffSym(self.hl.?);
+                        const v = try self.huffSym(self.hl.?);
                         var n: u32 = 0; // number of bits extra
                         var length: u32 = 0;
                         switch (v) {
@@ -699,7 +699,7 @@ pub fn Decompressor(comptime ReaderType: type) type {
                         switch (dist) {
                             0...3 => dist += 1,
                             4...max_num_dist - 1 => { // 4...29
-                                var nb = @as(u32, @intCast(dist - 2)) >> 1;
+                                const nb = @as(u32, @intCast(dist - 2)) >> 1;
                                 // have 1 bit in bottom of dist, need nb more.
                                 var extra = (dist & 1) << @as(u5, @intCast(nb));
                                 while (self.nb < nb) {
@@ -757,14 +757,14 @@ pub fn Decompressor(comptime ReaderType: type) type {
             self.b = 0;
 
             // Length then ones-complement of length.
-            var nr: u32 = 4;
+            const nr: u32 = 4;
             self.inner_reader.readNoEof(self.buf[0..nr]) catch {
                 self.err = InflateError.UnexpectedEndOfStream;
                 return InflateError.UnexpectedEndOfStream;
             };
             self.roffset += @as(u64, @intCast(nr));
-            var n = @as(u32, @intCast(self.buf[0])) | @as(u32, @intCast(self.buf[1])) << 8;
-            var nn = @as(u32, @intCast(self.buf[2])) | @as(u32, @intCast(self.buf[3])) << 8;
+            const n = @as(u32, @intCast(self.buf[0])) | @as(u32, @intCast(self.buf[1])) << 8;
+            const nn = @as(u32, @intCast(self.buf[2])) | @as(u32, @intCast(self.buf[3])) << 8;
             if (@as(u16, @intCast(nn)) != @as(u16, @truncate(~n))) {
                 corrupt_input_error_offset = self.roffset;
                 self.err = InflateError.CorruptInput;
@@ -789,7 +789,7 @@ pub fn Decompressor(comptime ReaderType: type) type {
                 buf = buf[0..self.copy_len];
             }
 
-            var cnt = try self.inner_reader.read(buf);
+            const cnt = try self.inner_reader.read(buf);
             if (cnt < buf.len) {
                 self.err = InflateError.UnexpectedEndOfStream;
             }
@@ -819,7 +819,7 @@ pub fn Decompressor(comptime ReaderType: type) type {
         }
 
         fn moreBits(self: *Self) InflateError!void {
-            var c = self.inner_reader.readByte() catch |e| {
+            const c = self.inner_reader.readByte() catch |e| {
                 if (e == error.EndOfStream) {
                     return InflateError.UnexpectedEndOfStream;
                 }
@@ -845,7 +845,7 @@ pub fn Decompressor(comptime ReaderType: type) type {
             var b = self.b;
             while (true) {
                 while (nb < n) {
-                    var c = self.inner_reader.readByte() catch |e| {
+                    const c = self.inner_reader.readByte() catch |e| {
                         self.b = b;
                         self.nb = nb;
                         if (e == error.EndOfStream) {
@@ -1053,7 +1053,7 @@ test "inflate A Tale of Two Cities (1859) intro" {
     defer decomp.deinit();
 
     var got: [700]u8 = undefined;
-    var got_len = try decomp.reader().read(&got);
+    const got_len = try decomp.reader().read(&got);
     try testing.expectEqual(@as(usize, 616), got_len);
     try testing.expectEqualSlices(u8, expected, got[0..expected.len]);
 }
@@ -1117,6 +1117,6 @@ fn decompress(input: []const u8) !void {
     const reader = fib.reader();
     var decomp = try decompressor(allocator, reader, null);
     defer decomp.deinit();
-    var output = try decomp.reader().readAllAlloc(allocator, math.maxInt(usize));
+    const output = try decomp.reader().readAllAlloc(allocator, math.maxInt(usize));
     defer std.testing.allocator.free(output);
 }
lib/std/compress/deflate/deflate_fast.zig
@@ -30,7 +30,7 @@ const table_size = 1 << table_bits; // Size of the table.
 const buffer_reset = math.maxInt(i32) - max_store_block_size * 2;
 
 fn load32(b: []u8, i: i32) u32 {
-    var s = b[@as(usize, @intCast(i)) .. @as(usize, @intCast(i)) + 4];
+    const s = b[@as(usize, @intCast(i)) .. @as(usize, @intCast(i)) + 4];
     return @as(u32, @intCast(s[0])) |
         @as(u32, @intCast(s[1])) << 8 |
         @as(u32, @intCast(s[2])) << 16 |
@@ -38,7 +38,7 @@ fn load32(b: []u8, i: i32) u32 {
 }
 
 fn load64(b: []u8, i: i32) u64 {
-    var s = b[@as(usize, @intCast(i))..@as(usize, @intCast(i + 8))];
+    const s = b[@as(usize, @intCast(i))..@as(usize, @intCast(i + 8))];
     return @as(u64, @intCast(s[0])) |
         @as(u64, @intCast(s[1])) << 8 |
         @as(u64, @intCast(s[2])) << 16 |
@@ -117,7 +117,7 @@ pub const DeflateFast = struct {
         // s_limit is when to stop looking for offset/length copies. The input_margin
         // lets us use a fast path for emitLiteral in the main loop, while we are
         // looking for copies.
-        var s_limit = @as(i32, @intCast(src.len - input_margin));
+        const s_limit = @as(i32, @intCast(src.len - input_margin));
 
         // next_emit is where in src the next emitLiteral should start from.
         var next_emit: i32 = 0;
@@ -147,18 +147,18 @@ pub const DeflateFast = struct {
             var candidate: TableEntry = undefined;
             while (true) {
                 s = next_s;
-                var bytes_between_hash_lookups = skip >> 5;
+                const bytes_between_hash_lookups = skip >> 5;
                 next_s = s + bytes_between_hash_lookups;
                 skip += bytes_between_hash_lookups;
                 if (next_s > s_limit) {
                     break :outer;
                 }
                 candidate = self.table[next_hash & table_mask];
-                var now = load32(src, next_s);
+                const now = load32(src, next_s);
                 self.table[next_hash & table_mask] = .{ .offset = s + self.cur, .val = cv };
                 next_hash = hash(now);
 
-                var offset = s - (candidate.offset - self.cur);
+                const offset = s - (candidate.offset - self.cur);
                 if (offset > max_match_offset or cv != candidate.val) {
                     // Out of range or not matched.
                     cv = now;
@@ -187,8 +187,8 @@ pub const DeflateFast = struct {
                 // Extend the 4-byte match as long as possible.
                 //
                 s += 4;
-                var t = candidate.offset - self.cur + 4;
-                var l = self.matchLen(s, t, src);
+                const t = candidate.offset - self.cur + 4;
+                const l = self.matchLen(s, t, src);
 
                 // matchToken is flate's equivalent of Snappy's emitCopy. (length,offset)
                 dst[tokens_count.*] = token.matchToken(
@@ -209,20 +209,20 @@ pub const DeflateFast = struct {
                 // are faster as one load64 call (with some shifts) instead of
                 // three load32 calls.
                 var x = load64(src, s - 1);
-                var prev_hash = hash(@as(u32, @truncate(x)));
+                const prev_hash = hash(@as(u32, @truncate(x)));
                 self.table[prev_hash & table_mask] = TableEntry{
                     .offset = self.cur + s - 1,
                     .val = @as(u32, @truncate(x)),
                 };
                 x >>= 8;
-                var curr_hash = hash(@as(u32, @truncate(x)));
+                const curr_hash = hash(@as(u32, @truncate(x)));
                 candidate = self.table[curr_hash & table_mask];
                 self.table[curr_hash & table_mask] = TableEntry{
                     .offset = self.cur + s,
                     .val = @as(u32, @truncate(x)),
                 };
 
-                var offset = s - (candidate.offset - self.cur);
+                const offset = s - (candidate.offset - self.cur);
                 if (offset > max_match_offset or @as(u32, @truncate(x)) != candidate.val) {
                     cv = @as(u32, @truncate(x >> 8));
                     next_hash = hash(cv);
@@ -261,7 +261,7 @@ pub const DeflateFast = struct {
         // If we are inside the current block
         if (t >= 0) {
             var b = src[@as(usize, @intCast(t))..];
-            var a = src[@as(usize, @intCast(s))..@as(usize, @intCast(s1))];
+            const a = src[@as(usize, @intCast(s))..@as(usize, @intCast(s1))];
             b = b[0..a.len];
             // Extend the match to be as long as possible.
             for (a, 0..) |_, i| {
@@ -273,7 +273,7 @@ pub const DeflateFast = struct {
         }
 
         // We found a match in the previous block.
-        var tp = @as(i32, @intCast(self.prev_len)) + t;
+        const tp = @as(i32, @intCast(self.prev_len)) + t;
         if (tp < 0) {
             return 0;
         }
@@ -293,7 +293,7 @@ pub const DeflateFast = struct {
 
         // If we reached our limit, we matched everything we are
         // allowed to in the previous block and we return.
-        var n = @as(i32, @intCast(b.len));
+        const n = @as(i32, @intCast(b.len));
         if (@as(u32, @intCast(s + n)) == s1) {
             return n;
         }
@@ -366,7 +366,7 @@ test "best speed match 1/3" {
             .cur = 0,
         };
         var current = [_]u8{ 3, 4, 5, 0, 1, 2, 3, 4, 5 };
-        var got: i32 = e.matchLen(3, -3, &current);
+        const got: i32 = e.matchLen(3, -3, &current);
         try expectEqual(@as(i32, 6), got);
     }
     {
@@ -379,7 +379,7 @@ test "best speed match 1/3" {
             .cur = 0,
         };
         var current = [_]u8{ 2, 4, 5, 0, 1, 2, 3, 4, 5 };
-        var got: i32 = e.matchLen(3, -3, &current);
+        const got: i32 = e.matchLen(3, -3, &current);
         try expectEqual(@as(i32, 3), got);
     }
     {
@@ -392,7 +392,7 @@ test "best speed match 1/3" {
             .cur = 0,
         };
         var current = [_]u8{ 3, 4, 5, 0, 1, 2, 3, 4, 5 };
-        var got: i32 = e.matchLen(3, -3, &current);
+        const got: i32 = e.matchLen(3, -3, &current);
         try expectEqual(@as(i32, 2), got);
     }
     {
@@ -405,7 +405,7 @@ test "best speed match 1/3" {
             .cur = 0,
         };
         var current = [_]u8{ 2, 2, 2, 2, 1, 2, 3, 4, 5 };
-        var got: i32 = e.matchLen(0, -1, &current);
+        const got: i32 = e.matchLen(0, -1, &current);
         try expectEqual(@as(i32, 4), got);
     }
     {
@@ -418,7 +418,7 @@ test "best speed match 1/3" {
             .cur = 0,
         };
         var current = [_]u8{ 2, 2, 2, 2, 1, 2, 3, 4, 5 };
-        var got: i32 = e.matchLen(4, -7, &current);
+        const got: i32 = e.matchLen(4, -7, &current);
         try expectEqual(@as(i32, 5), got);
     }
     {
@@ -431,7 +431,7 @@ test "best speed match 1/3" {
             .cur = 0,
         };
         var current = [_]u8{ 2, 2, 2, 2, 1, 2, 3, 4, 5 };
-        var got: i32 = e.matchLen(0, -1, &current);
+        const got: i32 = e.matchLen(0, -1, &current);
         try expectEqual(@as(i32, 0), got);
     }
     {
@@ -444,7 +444,7 @@ test "best speed match 1/3" {
             .cur = 0,
         };
         var current = [_]u8{ 9, 2, 2, 2, 1, 2, 3, 4, 5 };
-        var got: i32 = e.matchLen(1, 0, &current);
+        const got: i32 = e.matchLen(1, 0, &current);
         try expectEqual(@as(i32, 0), got);
     }
 }
@@ -462,7 +462,7 @@ test "best speed match 2/3" {
             .cur = 0,
         };
         var current = [_]u8{ 9, 2, 2, 2, 1, 2, 3, 4, 5 };
-        var got: i32 = e.matchLen(1, -5, &current);
+        const got: i32 = e.matchLen(1, -5, &current);
         try expectEqual(@as(i32, 0), got);
     }
     {
@@ -475,7 +475,7 @@ test "best speed match 2/3" {
             .cur = 0,
         };
         var current = [_]u8{ 9, 2, 2, 2, 1, 2, 3, 4, 5 };
-        var got: i32 = e.matchLen(1, -1, &current);
+        const got: i32 = e.matchLen(1, -1, &current);
         try expectEqual(@as(i32, 0), got);
     }
     {
@@ -488,7 +488,7 @@ test "best speed match 2/3" {
             .cur = 0,
         };
         var current = [_]u8{ 2, 2, 2, 2, 1, 2, 3, 4, 5 };
-        var got: i32 = e.matchLen(1, 0, &current);
+        const got: i32 = e.matchLen(1, 0, &current);
         try expectEqual(@as(i32, 3), got);
     }
     {
@@ -501,7 +501,7 @@ test "best speed match 2/3" {
             .cur = 0,
         };
         var current = [_]u8{ 3, 4, 5 };
-        var got: i32 = e.matchLen(0, -3, &current);
+        const got: i32 = e.matchLen(0, -3, &current);
         try expectEqual(@as(i32, 3), got);
     }
 }
@@ -564,11 +564,11 @@ test "best speed match 2/2" {
     };
 
     for (cases) |c| {
-        var previous = try testing.allocator.alloc(u8, c.previous);
+        const previous = try testing.allocator.alloc(u8, c.previous);
         defer testing.allocator.free(previous);
         @memset(previous, 0);
 
-        var current = try testing.allocator.alloc(u8, c.current);
+        const current = try testing.allocator.alloc(u8, c.current);
         defer testing.allocator.free(current);
         @memset(current, 0);
 
@@ -579,7 +579,7 @@ test "best speed match 2/2" {
             .allocator = undefined,
             .cur = 0,
         };
-        var got: i32 = e.matchLen(c.s, c.t, current);
+        const got: i32 = e.matchLen(c.s, c.t, current);
         try expectEqual(@as(i32, c.expected), got);
     }
 }
@@ -609,10 +609,10 @@ test "best speed shift offsets" {
     // Second part should pick up matches from the first block.
     tokens_count = 0;
     enc.encode(&tokens, &tokens_count, &test_data);
-    var want_first_tokens = tokens_count;
+    const want_first_tokens = tokens_count;
     tokens_count = 0;
     enc.encode(&tokens, &tokens_count, &test_data);
-    var want_second_tokens = tokens_count;
+    const want_second_tokens = tokens_count;
 
     try expect(want_first_tokens > want_second_tokens);
 
@@ -657,7 +657,7 @@ test "best speed reset" {
     const ArrayList = std.ArrayList;
 
     const input_size = 65536;
-    var input = try testing.allocator.alloc(u8, input_size);
+    const input = try testing.allocator.alloc(u8, input_size);
     defer testing.allocator.free(input);
 
     var i: usize = 0;
@@ -699,7 +699,7 @@ test "best speed reset" {
         // Reset until we are right before the wraparound.
         // Each reset adds max_match_offset to the offset.
         i = 0;
-        var limit = (buffer_reset - input.len - o - max_match_offset) / max_match_offset;
+        const limit = (buffer_reset - input.len - o - max_match_offset) / max_match_offset;
         while (i < limit) : (i += 1) {
             // skip ahead to where we are close to wrap around...
             comp.reset(discard.writer());
lib/std/compress/deflate/deflate_fast_test.zig
@@ -39,18 +39,18 @@ test "best speed" {
     var tc_15 = [_]u32{ 65536, 129 };
     var tc_16 = [_]u32{ 65536, 65536, 256 };
     var tc_17 = [_]u32{ 65536, 65536, 65536 };
-    var test_cases = [_][]u32{
+    const test_cases = [_][]u32{
         &tc_01, &tc_02, &tc_03, &tc_04, &tc_05, &tc_06, &tc_07, &tc_08, &tc_09, &tc_10,
         &tc_11, &tc_12, &tc_13, &tc_14, &tc_15, &tc_16, &tc_17,
     };
 
     for (test_cases) |tc| {
-        var firsts = [_]u32{ 1, 65534, 65535, 65536, 65537, 131072 };
+        const firsts = [_]u32{ 1, 65534, 65535, 65536, 65537, 131072 };
 
         for (firsts) |first_n| {
             tc[0] = first_n;
 
-            var to_flush = [_]bool{ false, true };
+            const to_flush = [_]bool{ false, true };
             for (to_flush) |flush| {
                 var compressed = ArrayList(u8).init(testing.allocator);
                 defer compressed.deinit();
@@ -75,14 +75,14 @@ test "best speed" {
 
                 try comp.close();
 
-                var decompressed = try testing.allocator.alloc(u8, want.items.len);
+                const decompressed = try testing.allocator.alloc(u8, want.items.len);
                 defer testing.allocator.free(decompressed);
 
                 var fib = io.fixedBufferStream(compressed.items);
                 var decomp = try inflate.decompressor(testing.allocator, fib.reader(), null);
                 defer decomp.deinit();
 
-                var read = try decomp.reader().readAll(decompressed);
+                const read = try decomp.reader().readAll(decompressed);
                 _ = decomp.close();
 
                 try testing.expectEqual(want.items.len, read);
@@ -109,7 +109,7 @@ test "best speed max match offset" {
         for (extras) |extra| {
             var offset_adj: i32 = -5;
             while (offset_adj <= 5) : (offset_adj += 1) {
-                var offset = deflate_const.max_match_offset + offset_adj;
+                const offset = deflate_const.max_match_offset + offset_adj;
 
                 // Make src to be a []u8 of the form
                 //	fmt("{s}{s}{s}{s}{s}", .{abc, zeros0, xyzMaybe, abc, zeros1})
@@ -119,7 +119,7 @@ test "best speed max match offset" {
                 //	zeros1 is between 0 and 30 zeros.
                 // The difference between the two abc's will be offset, which
                 // is max_match_offset plus or minus a small adjustment.
-                var src_len: usize = @as(usize, @intCast(offset + @as(i32, abc.len) + @as(i32, @intCast(extra))));
+                const src_len: usize = @as(usize, @intCast(offset + @as(i32, abc.len) + @as(i32, @intCast(extra))));
                 var src = try testing.allocator.alloc(u8, src_len);
                 defer testing.allocator.free(src);
 
@@ -143,13 +143,13 @@ test "best speed max match offset" {
                 try comp.writer().writeAll(src);
                 _ = try comp.close();
 
-                var decompressed = try testing.allocator.alloc(u8, src.len);
+                const decompressed = try testing.allocator.alloc(u8, src.len);
                 defer testing.allocator.free(decompressed);
 
                 var fib = io.fixedBufferStream(compressed.items);
                 var decomp = try inflate.decompressor(testing.allocator, fib.reader(), null);
                 defer decomp.deinit();
-                var read = try decomp.reader().readAll(decompressed);
+                const read = try decomp.reader().readAll(decompressed);
                 _ = decomp.close();
 
                 try testing.expectEqual(src.len, read);
lib/std/compress/deflate/dict_decoder.zig
@@ -123,7 +123,7 @@ pub const DictDecoder = struct {
     // This invariant must be kept: 0 < dist <= histSize()
     pub fn writeCopy(self: *Self, dist: u32, length: u32) u32 {
         assert(0 < dist and dist <= self.histSize());
-        var dst_base = self.wr_pos;
+        const dst_base = self.wr_pos;
         var dst_pos = dst_base;
         var src_pos: i32 = @as(i32, @intCast(dst_pos)) - @as(i32, @intCast(dist));
         var end_pos = dst_pos + length;
@@ -175,12 +175,12 @@ pub const DictDecoder = struct {
     // This invariant must be kept: 0 < dist <= histSize()
     pub fn tryWriteCopy(self: *Self, dist: u32, length: u32) u32 {
         var dst_pos = self.wr_pos;
-        var end_pos = dst_pos + length;
+        const end_pos = dst_pos + length;
         if (dst_pos < dist or end_pos > self.hist.len) {
             return 0;
         }
-        var dst_base = dst_pos;
-        var src_pos = dst_pos - dist;
+        const dst_base = dst_pos;
+        const src_pos = dst_pos - dist;
 
         // Copy possibly overlapping section before destination position.
         while (dst_pos < end_pos) {
@@ -195,7 +195,7 @@ pub const DictDecoder = struct {
     // emitted to the user. The data returned by readFlush must be fully consumed
     // before calling any other DictDecoder methods.
     pub fn readFlush(self: *Self) []u8 {
-        var to_read = self.hist[self.rd_pos..self.wr_pos];
+        const to_read = self.hist[self.rd_pos..self.wr_pos];
         self.rd_pos = self.wr_pos;
         if (self.wr_pos == self.hist.len) {
             self.wr_pos = 0;
@@ -279,7 +279,7 @@ test "dictionary decoder" {
         length: u32, // Length of copy or insertion
     };
 
-    var poem_refs = [_]PoemRefs{
+    const poem_refs = [_]PoemRefs{
         .{ .dist = 0, .length = 38 },  .{ .dist = 33, .length = 3 },   .{ .dist = 0, .length = 48 },
         .{ .dist = 79, .length = 3 },  .{ .dist = 0, .length = 11 },   .{ .dist = 34, .length = 5 },
         .{ .dist = 0, .length = 6 },   .{ .dist = 23, .length = 7 },   .{ .dist = 0, .length = 8 },
@@ -368,7 +368,7 @@ test "dictionary decoder" {
         fn writeString(dst_dd: *DictDecoder, dst: anytype, str: []const u8) !void {
             var string = str;
             while (string.len > 0) {
-                var cnt = DictDecoder.copy(dst_dd.writeSlice(), string);
+                const cnt = DictDecoder.copy(dst_dd.writeSlice(), string);
                 dst_dd.writeMark(cnt);
                 string = string[cnt..];
                 if (dst_dd.availWrite() == 0) {
lib/std/compress/deflate/huffman_bit_writer.zig
@@ -134,7 +134,7 @@ pub fn HuffmanBitWriter(comptime WriterType: type) type {
             self.bits |= @as(u64, @intCast(b)) << @as(u6, @intCast(self.nbits));
             self.nbits += nb;
             if (self.nbits >= 48) {
-                var bits = self.bits;
+                const bits = self.bits;
                 self.bits >>= 48;
                 self.nbits -= 48;
                 var n = self.nbytes;
@@ -224,7 +224,7 @@ pub fn HuffmanBitWriter(comptime WriterType: type) type {
             while (size != bad_code) : (in_index += 1) {
                 // INVARIANT: We have seen "count" copies of size that have not yet
                 // had output generated for them.
-                var next_size = codegen[in_index];
+                const next_size = codegen[in_index];
                 if (next_size == size) {
                     count += 1;
                     continue;
@@ -295,12 +295,12 @@ pub fn HuffmanBitWriter(comptime WriterType: type) type {
             while (num_codegens > 4 and self.codegen_freq[codegen_order[num_codegens - 1]] == 0) {
                 num_codegens -= 1;
             }
-            var header = 3 + 5 + 5 + 4 + (3 * num_codegens) +
+            const header = 3 + 5 + 5 + 4 + (3 * num_codegens) +
                 self.codegen_encoding.bitLength(self.codegen_freq[0..]) +
                 self.codegen_freq[16] * 2 +
                 self.codegen_freq[17] * 3 +
                 self.codegen_freq[18] * 7;
-            var size = header +
+            const size = header +
                 lit_enc.bitLength(self.literal_freq) +
                 off_enc.bitLength(self.offset_freq) +
                 extra_bits;
@@ -339,7 +339,7 @@ pub fn HuffmanBitWriter(comptime WriterType: type) type {
             self.bits |= @as(u64, @intCast(c.code)) << @as(u6, @intCast(self.nbits));
             self.nbits += @as(u32, @intCast(c.len));
             if (self.nbits >= 48) {
-                var bits = self.bits;
+                const bits = self.bits;
                 self.bits >>= 48;
                 self.nbits -= 48;
                 var n = self.nbytes;
@@ -386,13 +386,13 @@ pub fn HuffmanBitWriter(comptime WriterType: type) type {
 
             var i: u32 = 0;
             while (i < num_codegens) : (i += 1) {
-                var value = @as(u32, @intCast(self.codegen_encoding.codes[codegen_order[i]].len));
+                const value = @as(u32, @intCast(self.codegen_encoding.codes[codegen_order[i]].len));
                 try self.writeBits(@as(u32, @intCast(value)), 3);
             }
 
             i = 0;
             while (true) {
-                var code_word: u32 = @as(u32, @intCast(self.codegen[i]));
+                const code_word: u32 = @as(u32, @intCast(self.codegen[i]));
                 i += 1;
                 if (code_word == bad_code) {
                     break;
@@ -458,14 +458,14 @@ pub fn HuffmanBitWriter(comptime WriterType: type) type {
                 return;
             }
 
-            var lit_and_off = self.indexTokens(tokens);
-            var num_literals = lit_and_off.num_literals;
-            var num_offsets = lit_and_off.num_offsets;
+            const lit_and_off = self.indexTokens(tokens);
+            const num_literals = lit_and_off.num_literals;
+            const num_offsets = lit_and_off.num_offsets;
 
             var extra_bits: u32 = 0;
-            var ret = storedSizeFits(input);
-            var stored_size = ret.size;
-            var storable = ret.storable;
+            const ret = storedSizeFits(input);
+            const stored_size = ret.size;
+            const storable = ret.storable;
 
             if (storable) {
                 // We only bother calculating the costs of the extra bits required by
@@ -504,12 +504,12 @@ pub fn HuffmanBitWriter(comptime WriterType: type) type {
                 &self.offset_encoding,
             );
             self.codegen_encoding.generate(self.codegen_freq[0..], 7);
-            var dynamic_size = self.dynamicSize(
+            const dynamic_size = self.dynamicSize(
                 &self.literal_encoding,
                 &self.offset_encoding,
                 extra_bits,
             );
-            var dyn_size = dynamic_size.size;
+            const dyn_size = dynamic_size.size;
             num_codegens = dynamic_size.num_codegens;
 
             if (dyn_size < size) {
@@ -551,9 +551,9 @@ pub fn HuffmanBitWriter(comptime WriterType: type) type {
                 return;
             }
 
-            var total_tokens = self.indexTokens(tokens);
-            var num_literals = total_tokens.num_literals;
-            var num_offsets = total_tokens.num_offsets;
+            const total_tokens = self.indexTokens(tokens);
+            const num_literals = total_tokens.num_literals;
+            const num_offsets = total_tokens.num_offsets;
 
             // Generate codegen and codegenFrequencies, which indicates how to encode
             // the literal_encoding and the offset_encoding.
@@ -564,15 +564,15 @@ pub fn HuffmanBitWriter(comptime WriterType: type) type {
                 &self.offset_encoding,
             );
             self.codegen_encoding.generate(self.codegen_freq[0..], 7);
-            var dynamic_size = self.dynamicSize(&self.literal_encoding, &self.offset_encoding, 0);
-            var size = dynamic_size.size;
-            var num_codegens = dynamic_size.num_codegens;
+            const dynamic_size = self.dynamicSize(&self.literal_encoding, &self.offset_encoding, 0);
+            const size = dynamic_size.size;
+            const num_codegens = dynamic_size.num_codegens;
 
             // Store bytes, if we don't get a reasonable improvement.
 
-            var stored_size = storedSizeFits(input);
-            var ssize = stored_size.size;
-            var storable = stored_size.storable;
+            const stored_size = storedSizeFits(input);
+            const ssize = stored_size.size;
+            const storable = stored_size.storable;
             if (storable and ssize < (size + (size >> 4))) {
                 try self.writeStoredHeader(input.?.len, eof);
                 try self.writeBytes(input.?);
@@ -611,8 +611,8 @@ pub fn HuffmanBitWriter(comptime WriterType: type) type {
                     self.literal_freq[token.literal(t)] += 1;
                     continue;
                 }
-                var length = token.length(t);
-                var offset = token.offset(t);
+                const length = token.length(t);
+                const offset = token.offset(t);
                 self.literal_freq[length_codes_start + token.lengthCode(length)] += 1;
                 self.offset_freq[token.offsetCode(offset)] += 1;
             }
@@ -660,21 +660,21 @@ pub fn HuffmanBitWriter(comptime WriterType: type) type {
                     continue;
                 }
                 // Write the length
-                var length = token.length(t);
-                var length_code = token.lengthCode(length);
+                const length = token.length(t);
+                const length_code = token.lengthCode(length);
                 try self.writeCode(le_codes[length_code + length_codes_start]);
-                var extra_length_bits = @as(u32, @intCast(length_extra_bits[length_code]));
+                const extra_length_bits = @as(u32, @intCast(length_extra_bits[length_code]));
                 if (extra_length_bits > 0) {
-                    var extra_length = @as(u32, @intCast(length - length_base[length_code]));
+                    const extra_length = @as(u32, @intCast(length - length_base[length_code]));
                     try self.writeBits(extra_length, extra_length_bits);
                 }
                 // Write the offset
-                var offset = token.offset(t);
-                var offset_code = token.offsetCode(offset);
+                const offset = token.offset(t);
+                const offset_code = token.offsetCode(offset);
                 try self.writeCode(oe_codes[offset_code]);
-                var extra_offset_bits = @as(u32, @intCast(offset_extra_bits[offset_code]));
+                const extra_offset_bits = @as(u32, @intCast(offset_extra_bits[offset_code]));
                 if (extra_offset_bits > 0) {
-                    var extra_offset = @as(u32, @intCast(offset - offset_base[offset_code]));
+                    const extra_offset = @as(u32, @intCast(offset - offset_base[offset_code]));
                     try self.writeBits(extra_offset, extra_offset_bits);
                 }
             }
@@ -718,15 +718,15 @@ pub fn HuffmanBitWriter(comptime WriterType: type) type {
                 &self.huff_offset,
             );
             self.codegen_encoding.generate(self.codegen_freq[0..], 7);
-            var dynamic_size = self.dynamicSize(&self.literal_encoding, &self.huff_offset, 0);
-            var size = dynamic_size.size;
+            const dynamic_size = self.dynamicSize(&self.literal_encoding, &self.huff_offset, 0);
+            const size = dynamic_size.size;
             num_codegens = dynamic_size.num_codegens;
 
             // Store bytes, if we don't get a reasonable improvement.
 
-            var stored_size_ret = storedSizeFits(input);
-            var ssize = stored_size_ret.size;
-            var storable = stored_size_ret.storable;
+            const stored_size_ret = storedSizeFits(input);
+            const ssize = stored_size_ret.size;
+            const storable = stored_size_ret.storable;
 
             if (storable and ssize < (size + (size >> 4))) {
                 try self.writeStoredHeader(input.len, eof);
@@ -736,18 +736,18 @@ pub fn HuffmanBitWriter(comptime WriterType: type) type {
 
             // Huffman.
             try self.writeDynamicHeader(num_literals, num_offsets, num_codegens, eof);
-            var encoding = self.literal_encoding.codes[0..257];
+            const encoding = self.literal_encoding.codes[0..257];
             var n = self.nbytes;
             for (input) |t| {
                 // Bitwriting inlined, ~30% speedup
-                var c = encoding[t];
+                const c = encoding[t];
                 self.bits |= @as(u64, @intCast(c.code)) << @as(u6, @intCast(self.nbits));
                 self.nbits += @as(u32, @intCast(c.len));
                 if (self.nbits < 48) {
                     continue;
                 }
                 // Store 6 bytes
-                var bits = self.bits;
+                const bits = self.bits;
                 self.bits >>= 48;
                 self.nbits -= 48;
                 var bytes = self.bytes[n..][0..6];
@@ -1679,7 +1679,7 @@ fn testWriterEOF(ttype: TestType, ht_tokens: []const token.Token, input: []const
 
     try bw.flush();
 
-    var b = buf.items;
+    const b = buf.items;
     try expect(b.len > 0);
     try expect(b[0] & 1 == 1);
 }
lib/std/compress/deflate/huffman_code.zig
@@ -96,7 +96,7 @@ pub const HuffmanEncoder = struct {
         mem.sort(LiteralNode, self.lfs, {}, byFreq);
 
         // Get the number of literals for each bit count
-        var bit_count = self.bitCounts(list, max_bits);
+        const bit_count = self.bitCounts(list, max_bits);
         // And do the assignment
         self.assignEncodingAndSize(bit_count, list);
     }
@@ -128,7 +128,7 @@ pub const HuffmanEncoder = struct {
     // that should be encoded in i bits.
     fn bitCounts(self: *HuffmanEncoder, list: []LiteralNode, max_bits_to_use: usize) []u32 {
         var max_bits = max_bits_to_use;
-        var n = list.len;
+        const n = list.len;
 
         assert(max_bits < max_bits_limit);
 
@@ -184,10 +184,10 @@ pub const HuffmanEncoder = struct {
                     continue;
                 }
 
-                var prev_freq = l.last_freq;
+                const prev_freq = l.last_freq;
                 if (l.next_char_freq < l.next_pair_freq) {
                     // The next item on this row is a leaf node.
-                    var next = leaf_counts[level][level] + 1;
+                    const next = leaf_counts[level][level] + 1;
                     l.last_freq = l.next_char_freq;
                     // Lower leaf_counts are the same of the previous node.
                     leaf_counts[level][level] = next;
@@ -236,7 +236,7 @@ pub const HuffmanEncoder = struct {
 
         var bit_count = self.bit_count[0 .. max_bits + 1];
         var bits: u32 = 1;
-        var counts = &leaf_counts[max_bits];
+        const counts = &leaf_counts[max_bits];
         {
             var level = max_bits;
             while (level > 0) : (level -= 1) {
@@ -267,7 +267,7 @@ pub const HuffmanEncoder = struct {
             // are encoded using "bits" bits, and get the values
             // code, code + 1, ....  The code values are
             // assigned in literal order (not frequency order).
-            var chunk = list[list.len - @as(u32, @intCast(bits)) ..];
+            const chunk = list[list.len - @as(u32, @intCast(bits)) ..];
 
             self.lns = chunk;
             mem.sort(LiteralNode, self.lns, {}, byLiteral);
@@ -303,7 +303,7 @@ pub fn newHuffmanEncoder(allocator: Allocator, size: u32) !HuffmanEncoder {
 
 // Generates a HuffmanCode corresponding to the fixed literal table
 pub fn generateFixedLiteralEncoding(allocator: Allocator) !HuffmanEncoder {
-    var h = try newHuffmanEncoder(allocator, deflate_const.max_num_frequencies);
+    const h = try newHuffmanEncoder(allocator, deflate_const.max_num_frequencies);
     var codes = h.codes;
     var ch: u16 = 0;
 
@@ -338,7 +338,7 @@ pub fn generateFixedLiteralEncoding(allocator: Allocator) !HuffmanEncoder {
 }
 
 pub fn generateFixedOffsetEncoding(allocator: Allocator) !HuffmanEncoder {
-    var h = try newHuffmanEncoder(allocator, 30);
+    const h = try newHuffmanEncoder(allocator, 30);
     var codes = h.codes;
     for (codes, 0..) |_, ch| {
         codes[ch] = HuffCode{ .code = bu.bitReverse(u16, @as(u16, @intCast(ch)), 5), .len = 5 };
lib/std/compress/zstandard/decode/huffman.zig
@@ -54,7 +54,7 @@ fn decodeFseHuffmanTreeSlice(src: []const u8, compressed_size: usize, weights: *
 
     const start_index = std.math.cast(usize, counting_reader.bytes_read) orelse
         return error.MalformedHuffmanTree;
-    var huff_data = src[start_index..compressed_size];
+    const huff_data = src[start_index..compressed_size];
     var huff_bits: readers.ReverseBitReader = undefined;
     huff_bits.init(huff_data) catch return error.MalformedHuffmanTree;
 
lib/std/compress/zstandard/decompress.zig
@@ -304,7 +304,7 @@ pub fn decodeZstandardFrame(
 
     var frame_context = context: {
         var fbs = std.io.fixedBufferStream(src[consumed_count..]);
-        var source = fbs.reader();
+        const source = fbs.reader();
         const frame_header = try decodeZstandardHeader(source);
         consumed_count += fbs.pos;
         break :context FrameContext.init(
@@ -447,7 +447,7 @@ pub fn decodeZstandardFrameArrayList(
 
     var frame_context = context: {
         var fbs = std.io.fixedBufferStream(src[consumed_count..]);
-        var source = fbs.reader();
+        const source = fbs.reader();
         const frame_header = try decodeZstandardHeader(source);
         consumed_count += fbs.pos;
         break :context try FrameContext.init(frame_header, window_size_max, verify_checksum);
lib/std/compress/zstandard.zig
@@ -268,7 +268,7 @@ test "zstandard decompression" {
     const compressed3 = @embedFile("testdata/rfc8478.txt.zst.3");
     const compressed19 = @embedFile("testdata/rfc8478.txt.zst.19");
 
-    var buffer = try std.testing.allocator.alloc(u8, uncompressed.len);
+    const buffer = try std.testing.allocator.alloc(u8, uncompressed.len);
     defer std.testing.allocator.free(buffer);
 
     const res3 = try decompress.decode(buffer, compressed3, true);
lib/std/crypto/25519/curve25519.zig
@@ -129,7 +129,7 @@ test "non-affine edwards25519 to curve25519 projection" {
     const skh = "90e7595fc89e52fdfddce9c6a43d74dbf6047025ee0462d2d172e8b6a2841d6e";
     var sk: [32]u8 = undefined;
     _ = std.fmt.hexToBytes(&sk, skh) catch unreachable;
-    var edp = try crypto.ecc.Edwards25519.basePoint.mul(sk);
+    const edp = try crypto.ecc.Edwards25519.basePoint.mul(sk);
     const xp = try Curve25519.fromEdwards25519(edp);
     const expected_hex = "cc4f2cdb695dd766f34118eb67b98652fed1d8bc49c330b119bbfa8a64989378";
     var expected: [32]u8 = undefined;
lib/std/crypto/25519/field.zig
@@ -416,7 +416,7 @@ pub const Fe = struct {
 
     /// Compute the square root of `x2`, returning `error.NotSquare` if `x2` was not a square
     pub fn sqrt(x2: Fe) NotSquareError!Fe {
-        var x2_copy = x2;
+        const x2_copy = x2;
         const x = x2.uncheckedSqrt();
         const check = x.sq().sub(x2_copy);
         if (check.isZero()) {
lib/std/crypto/pcurves/common.zig
@@ -71,7 +71,7 @@ pub fn Field(comptime params: FieldParams) type {
 
         /// Unpack a field element.
         pub fn fromBytes(s_: [encoded_length]u8, endian: std.builtin.Endian) NonCanonicalError!Fe {
-            var s = if (endian == .little) s_ else orderSwap(s_);
+            const s = if (endian == .little) s_ else orderSwap(s_);
             try rejectNonCanonical(s, .little);
             var limbs_z: NonMontgomeryDomainFieldElement = undefined;
             fiat.fromBytes(&limbs_z, s);
lib/std/crypto/tls/Client.zig
@@ -491,7 +491,7 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In
                                 try all_extd.ensure(4);
                                 const et = all_extd.decode(tls.ExtensionType);
                                 const ext_size = all_extd.decode(u16);
-                                var extd = try all_extd.sub(ext_size);
+                                const extd = try all_extd.sub(ext_size);
                                 _ = extd;
                                 switch (et) {
                                     .server_name => {},
@@ -516,7 +516,7 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In
                             while (!certs_decoder.eof()) {
                                 try certs_decoder.ensure(3);
                                 const cert_size = certs_decoder.decode(u24);
-                                var certd = try certs_decoder.sub(cert_size);
+                                const certd = try certs_decoder.sub(cert_size);
 
                                 const subject_cert: Certificate = .{
                                     .buffer = certd.buf,
@@ -552,7 +552,7 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In
 
                                 try certs_decoder.ensure(2);
                                 const total_ext_size = certs_decoder.decode(u16);
-                                var all_extd = try certs_decoder.sub(total_ext_size);
+                                const all_extd = try certs_decoder.sub(total_ext_size);
                                 _ = all_extd;
                             }
                         },
lib/std/crypto/aes.zig
@@ -47,7 +47,7 @@ test "ctr" {
     };
 
     var out: [exp_out.len]u8 = undefined;
-    var ctx = Aes128.initEnc(key);
+    const ctx = Aes128.initEnc(key);
     ctr(AesEncryptCtx(Aes128), ctx, out[0..], in[0..], iv, std.builtin.Endian.big);
     try testing.expectEqualSlices(u8, exp_out[0..], out[0..]);
 }
lib/std/crypto/aes_ocb.zig
@@ -95,7 +95,7 @@ fn AesOcb(comptime Aes: anytype) type {
             var ktop_: Block = undefined;
             aes_enc_ctx.encrypt(&ktop_, &nx);
             const ktop = mem.readInt(u128, &ktop_, .big);
-            var stretch = (@as(u192, ktop) << 64) | @as(u192, @as(u64, @truncate(ktop >> 64)) ^ @as(u64, @truncate(ktop >> 56)));
+            const stretch = (@as(u192, ktop) << 64) | @as(u192, @as(u64, @truncate(ktop >> 64)) ^ @as(u64, @truncate(ktop >> 56)));
             var offset: Block = undefined;
             mem.writeInt(u128, &offset, @as(u128, @truncate(stretch >> (64 - @as(u7, bottom)))), .big);
             return offset;
lib/std/crypto/argon2.zig
@@ -565,7 +565,7 @@ const PhcFormatHasher = struct {
         const expected_hash = hash_result.hash.constSlice();
         var hash_buf: [max_hash_len]u8 = undefined;
         if (expected_hash.len > hash_buf.len) return HasherError.InvalidEncoding;
-        var hash = hash_buf[0..expected_hash.len];
+        const hash = hash_buf[0..expected_hash.len];
 
         try kdf(allocator, hash, password, hash_result.salt.constSlice(), params, mode);
         if (!mem.eql(u8, hash, expected_hash)) return HasherError.PasswordVerificationFailed;
lib/std/crypto/ascon.zig
@@ -42,8 +42,7 @@ pub fn State(comptime endian: std.builtin.Endian) type {
 
         /// Initialize the state from u64 words in native endianness.
         pub fn initFromWords(initial_state: [5]u64) Self {
-            var state = Self{ .st = initial_state };
-            return state;
+            return .{ .st = initial_state };
         }
 
         /// Initialize the state for Ascon XOF
lib/std/crypto/bcrypt.zig
@@ -431,7 +431,7 @@ pub fn bcrypt(
     const trimmed_len = @min(password.len, password_buf.len - 1);
     @memcpy(password_buf[0..trimmed_len], password[0..trimmed_len]);
     password_buf[trimmed_len] = 0;
-    var passwordZ = password_buf[0 .. trimmed_len + 1];
+    const passwordZ = password_buf[0 .. trimmed_len + 1];
     state.expand(salt[0..], passwordZ);
 
     const rounds: u64 = @as(u64, 1) << params.rounds_log;
lib/std/crypto/blake3.zig
@@ -241,7 +241,7 @@ const Output = struct {
         var out_block_it = ChunkIterator.init(output, 2 * OUT_LEN);
         var output_block_counter: usize = 0;
         while (out_block_it.next()) |out_block| {
-            var words = compress(
+            const words = compress(
                 self.input_chaining_value,
                 self.block_words,
                 self.block_len,
lib/std/crypto/Certificate.zig
@@ -982,7 +982,7 @@ pub const rsa = struct {
             if (mgf_len > mgf_out_buf.len) { // Modulus > 4096 bits
                 return error.InvalidSignature;
             }
-            var mgf_out = mgf_out_buf[0 .. ((mgf_len - 1) / Hash.digest_length + 1) * Hash.digest_length];
+            const mgf_out = mgf_out_buf[0 .. ((mgf_len - 1) / Hash.digest_length + 1) * Hash.digest_length];
             var dbMask = try MGF1(Hash, mgf_out, h, mgf_len);
 
             // 8.   Let DB = maskedDB \xor dbMask.
lib/std/crypto/ecdsa.zig
@@ -201,7 +201,7 @@ pub fn Ecdsa(comptime Curve: type, comptime Hash: type) type {
                 const scalar_encoded_length = Curve.scalar.encoded_length;
                 const h_len = @max(Hash.digest_length, scalar_encoded_length);
                 var h: [h_len]u8 = [_]u8{0} ** h_len;
-                var h_slice = h[h_len - Hash.digest_length .. h_len];
+                const h_slice = h[h_len - Hash.digest_length .. h_len];
                 self.h.final(h_slice);
 
                 std.debug.assert(h.len >= scalar_encoded_length);
lib/std/crypto/pbkdf2.zig
@@ -255,10 +255,8 @@ test "Very large dk_len" {
     const c = 1;
     const dk_len = 1 << 33;
 
-    var dk = try std.testing.allocator.alloc(u8, dk_len);
-    defer {
-        std.testing.allocator.free(dk);
-    }
+    const dk = try std.testing.allocator.alloc(u8, dk_len);
+    defer std.testing.allocator.free(dk);
 
     // Just verify this doesn't crash with an overflow
     try pbkdf2(dk, p, s, c, HmacSha1);
lib/std/crypto/poly1305.zig
@@ -90,8 +90,8 @@ pub const Poly1305 = struct {
             h2 = t2 & 3;
 
             // Add c*(4+1)
-            var cclo = t2 & ~@as(u64, 3);
-            var cchi = t3;
+            const cclo = t2 & ~@as(u64, 3);
+            const cchi = t3;
             v = @addWithOverflow(h0, cclo);
             h0 = v[0];
             v = add(h1, cchi, v[1]);
@@ -163,7 +163,7 @@ pub const Poly1305 = struct {
 
         var h0 = st.h[0];
         var h1 = st.h[1];
-        var h2 = st.h[2];
+        const h2 = st.h[2];
 
         // H - (2^130 - 5)
         var v = @subWithOverflow(h0, 0xfffffffffffffffb);
lib/std/crypto/salsa20.zig
@@ -605,8 +605,8 @@ test "xsalsa20poly1305 box" {
     crypto.random.bytes(&msg);
     crypto.random.bytes(&nonce);
 
-    var kp1 = try Box.KeyPair.create(null);
-    var kp2 = try Box.KeyPair.create(null);
+    const kp1 = try Box.KeyPair.create(null);
+    const kp2 = try Box.KeyPair.create(null);
     try Box.seal(boxed[0..], msg[0..], nonce, kp1.public_key, kp2.secret_key);
     try Box.open(msg2[0..], boxed[0..], nonce, kp2.public_key, kp1.secret_key);
 }
@@ -617,7 +617,7 @@ test "xsalsa20poly1305 sealedbox" {
     var boxed: [msg.len + SealedBox.seal_length]u8 = undefined;
     crypto.random.bytes(&msg);
 
-    var kp = try Box.KeyPair.create(null);
+    const kp = try Box.KeyPair.create(null);
     try SealedBox.seal(boxed[0..], msg[0..], kp.public_key);
     try SealedBox.open(msg2[0..], boxed[0..], kp);
 }
lib/std/crypto/scrypt.zig
@@ -87,8 +87,8 @@ fn integerify(b: []align(16) const u32, r: u30) u64 {
 }
 
 fn smix(b: []align(16) u8, r: u30, n: usize, v: []align(16) u32, xy: []align(16) u32) void {
-    var x: []align(16) u32 = @alignCast(xy[0 .. 32 * r]);
-    var y: []align(16) u32 = @alignCast(xy[32 * r ..]);
+    const x: []align(16) u32 = @alignCast(xy[0 .. 32 * r]);
+    const y: []align(16) u32 = @alignCast(xy[32 * r ..]);
 
     for (x, 0..) |*v1, j| {
         v1.* = mem.readInt(u32, b[4 * j ..][0..4], .little);
@@ -191,9 +191,9 @@ pub fn kdf(
         params.r > max_int / 256 or
         n > max_int / 128 / @as(u64, params.r)) return KdfError.WeakParameters;
 
-    var xy = try allocator.alignedAlloc(u32, 16, 64 * params.r);
+    const xy = try allocator.alignedAlloc(u32, 16, 64 * params.r);
     defer allocator.free(xy);
-    var v = try allocator.alignedAlloc(u32, 16, 32 * n * params.r);
+    const v = try allocator.alignedAlloc(u32, 16, 32 * n * params.r);
     defer allocator.free(v);
     var dk = try allocator.alignedAlloc(u8, 16, params.p * 128 * params.r);
     defer allocator.free(dk);
@@ -263,7 +263,7 @@ const crypt_format = struct {
                 const value = self.constSlice();
                 const len = Codec.encodedLen(value.len);
                 if (len > buf.len) return EncodingError.NoSpaceLeft;
-                var encoded = buf[0..len];
+                const encoded = buf[0..len];
                 Codec.encode(encoded, value);
                 return encoded;
             }
@@ -439,7 +439,7 @@ const PhcFormatHasher = struct {
         const expected_hash = hash_result.hash.constSlice();
         var hash_buf: [max_hash_len]u8 = undefined;
         if (expected_hash.len > hash_buf.len) return HasherError.InvalidEncoding;
-        var hash = hash_buf[0..expected_hash.len];
+        const hash = hash_buf[0..expected_hash.len];
         try kdf(allocator, hash, password, hash_result.salt.constSlice(), params);
         if (!mem.eql(u8, hash, expected_hash)) return HasherError.PasswordVerificationFailed;
     }
@@ -487,7 +487,7 @@ const CryptFormatHasher = struct {
         const expected_hash = hash_result.hash.constSlice();
         var hash_buf: [max_hash_len]u8 = undefined;
         if (expected_hash.len > hash_buf.len) return HasherError.InvalidEncoding;
-        var hash = hash_buf[0..expected_hash.len];
+        const hash = hash_buf[0..expected_hash.len];
         try kdf(allocator, hash, password, hash_result.salt, params);
         if (!mem.eql(u8, hash, expected_hash)) return HasherError.PasswordVerificationFailed;
     }
lib/std/dwarf/expressions.zig
@@ -443,7 +443,7 @@ pub fn StackMachine(comptime options: ExpressionOptions) type {
                 OP.xderef_type,
                 => {
                     if (self.stack.items.len == 0) return error.InvalidExpression;
-                    var addr = try self.stack.items[self.stack.items.len - 1].asIntegral();
+                    const addr = try self.stack.items[self.stack.items.len - 1].asIntegral();
                     const addr_space_identifier: ?usize = switch (opcode) {
                         OP.xderef,
                         OP.xderef_size,
@@ -1350,7 +1350,7 @@ test "DWARF expressions" {
 
     // Arithmetic and Logical Operations
     {
-        var context = ExpressionContext{};
+        const context = ExpressionContext{};
 
         stack_machine.reset();
         program.clearRetainingCapacity();
@@ -1474,7 +1474,7 @@ test "DWARF expressions" {
 
     // Control Flow Operations
     {
-        var context = ExpressionContext{};
+        const context = ExpressionContext{};
         const expected = .{
             .{ OP.le, 1, 1, 0 },
             .{ OP.ge, 1, 0, 1 },
@@ -1531,7 +1531,7 @@ test "DWARF expressions" {
 
     // Type conversions
     {
-        var context = ExpressionContext{};
+        const context = ExpressionContext{};
         stack_machine.reset();
         program.clearRetainingCapacity();
 
lib/std/event/group.zig
@@ -66,7 +66,7 @@ pub fn Group(comptime ReturnType: type) type {
         /// `func` must be async and have return type `ReturnType`.
         /// Thread-safe.
         pub fn call(self: *Self, comptime func: anytype, args: anytype) error{OutOfMemory}!void {
-            var frame = try self.allocator.create(@TypeOf(@call(.{ .modifier = .async_kw }, func, args)));
+            const frame = try self.allocator.create(@TypeOf(@call(.{ .modifier = .async_kw }, func, args)));
             errdefer self.allocator.destroy(frame);
             const node = try self.allocator.create(AllocStack.Node);
             errdefer self.allocator.destroy(node);
lib/std/event/loop.zig
@@ -753,7 +753,7 @@ pub const Loop = struct {
             }
         };
 
-        var run_frame = try alloc.create(@Frame(Wrapper.run));
+        const run_frame = try alloc.create(@Frame(Wrapper.run));
         run_frame.* = async Wrapper.run(args, self, alloc);
     }
 
lib/std/event/rwlock.zig
@@ -228,7 +228,7 @@ test "std.event.RwLock" {
 }
 fn testLock(allocator: Allocator, lock: *RwLock) callconv(.Async) void {
     var read_nodes: [100]Loop.NextTickNode = undefined;
-    for (read_nodes) |*read_node| {
+    for (&read_nodes) |*read_node| {
         const frame = allocator.create(@Frame(readRunner)) catch @panic("memory");
         read_node.data = frame;
         frame.* = async readRunner(lock);
@@ -236,19 +236,19 @@ fn testLock(allocator: Allocator, lock: *RwLock) callconv(.Async) void {
     }
 
     var write_nodes: [shared_it_count]Loop.NextTickNode = undefined;
-    for (write_nodes) |*write_node| {
+    for (&write_nodes) |*write_node| {
         const frame = allocator.create(@Frame(writeRunner)) catch @panic("memory");
         write_node.data = frame;
         frame.* = async writeRunner(lock);
         Loop.instance.?.onNextTick(write_node);
     }
 
-    for (write_nodes) |*write_node| {
+    for (&write_nodes) |*write_node| {
         const casted = @as(*const @Frame(writeRunner), @ptrCast(write_node.data));
         await casted;
         allocator.destroy(casted);
     }
-    for (read_nodes) |*read_node| {
+    for (&read_nodes) |*read_node| {
         const casted = @as(*const @Frame(readRunner), @ptrCast(read_node.data));
         await casted;
         allocator.destroy(casted);
lib/std/fmt/parse_float/parse.zig
@@ -105,7 +105,7 @@ fn parsePartialNumberBase(comptime T: type, stream: *FloatStream, negative: bool
     // parse initial digits before dot
     var mantissa: MantissaT = 0;
     tryParseDigits(MantissaT, stream, &mantissa, info.base);
-    var int_end = stream.offsetTrue();
+    const int_end = stream.offsetTrue();
     var n_digits = @as(isize, @intCast(stream.offsetTrue()));
     // the base being 16 implies a 0x prefix, which shouldn't be included in the digit count
     if (info.base == 16) n_digits -= 2;
@@ -188,7 +188,7 @@ fn parsePartialNumberBase(comptime T: type, stream: *FloatStream, negative: bool
                 // than 19 digits. That means we must have a decimal
                 // point, and at least 1 fractional digit.
                 stream.advance(1);
-                var marker = stream.offsetTrue();
+                const marker = stream.offsetTrue();
                 tryParseNDigits(MantissaT, stream, &mantissa, info.base, info.max_mantissa_digits);
                 break :blk @as(i64, @intCast(marker)) - @as(i64, @intCast(stream.offsetTrue()));
             }
lib/std/fmt/errol.zig
@@ -367,8 +367,8 @@ fn errolFixed(val: f64, buffer: []u8) FloatDecimal {
     var lo = ((fpprev(val) - n) + mid) / 2.0;
     var hi = ((fpnext(val) - n) + mid) / 2.0;
 
-    var buf_index = u64toa(u, buffer);
-    var exp = @as(i32, @intCast(buf_index));
+    const buf_index = u64toa(u, buffer);
+    const exp: i32 = @intCast(buf_index);
     var j = buf_index;
     buffer[j] = 0;
 
lib/std/fs/get_app_data_dir.zig
@@ -57,6 +57,10 @@ pub fn getAppDataDir(allocator: mem.Allocator, appname: []const u8) GetAppDataDi
         },
         .haiku => {
             var dir_path_ptr: [*:0]u8 = undefined;
+            if (true) {
+                _ = &dir_path_ptr;
+                @compileError("TODO: init dir_path_ptr");
+            }
             // TODO look into directory_which
             const be_user_settings = 0xbbe;
             const rc = os.system.find_directory(be_user_settings, -1, true, dir_path_ptr, 1);
lib/std/fs/test.zig
@@ -80,7 +80,7 @@ const TestContext = struct {
     transform_fn: *const PathType.TransformFn,
 
     pub fn init(path_type: PathType, allocator: mem.Allocator, transform_fn: *const PathType.TransformFn) TestContext {
-        var tmp = tmpIterableDir(.{});
+        const tmp = tmpIterableDir(.{});
         return .{
             .path_type = path_type,
             .arena = ArenaAllocator.init(allocator),
lib/std/fs/watch.zig
@@ -116,7 +116,7 @@ pub fn Watch(comptime V: type) type {
                         },
                     };
 
-                    var buf = try allocator.alloc(Event.Error!Event, event_buf_count);
+                    const buf = try allocator.alloc(Event.Error!Event, event_buf_count);
                     self.channel.init(buf);
                     self.os_data.putter_frame = async self.linuxEventPutter();
                     return self;
@@ -132,7 +132,7 @@ pub fn Watch(comptime V: type) type {
                         },
                     };
 
-                    var buf = try allocator.alloc(Event.Error!Event, event_buf_count);
+                    const buf = try allocator.alloc(Event.Error!Event, event_buf_count);
                     self.channel.init(buf);
                     return self;
                 },
@@ -147,7 +147,7 @@ pub fn Watch(comptime V: type) type {
                         },
                     };
 
-                    var buf = try allocator.alloc(Event.Error!Event, event_buf_count);
+                    const buf = try allocator.alloc(Event.Error!Event, event_buf_count);
                     self.channel.init(buf);
                     return self;
                 },
lib/std/hash/auto_hash.zig
@@ -280,6 +280,7 @@ test "hash slice shallow" {
     const array2 = [_]u32{ 1, 2, 3, 4, 5, 6 };
     // TODO audit deep/shallow - maybe it has the wrong behavior with respect to array pointers and slices
     var runtime_zero: usize = 0;
+    _ = &runtime_zero;
     const a = array1[runtime_zero..];
     const b = array2[runtime_zero..];
     const c = array1[runtime_zero..3];
lib/std/hash/cityhash.zig
@@ -271,7 +271,7 @@ pub const CityHash64 = struct {
         var b1: u64 = b;
         a1 +%= w;
         b1 = rotr64(b1 +% a1 +% z, 21);
-        var c: u64 = a1;
+        const c: u64 = a1;
         a1 +%= x;
         a1 +%= y;
         b1 +%= rotr64(a1, 44);
lib/std/hash/murmur.zig
@@ -134,7 +134,7 @@ pub const Murmur2_64 = struct {
         const m: u64 = 0xc6a4a7935bd1e995;
         const len: u64 = 4;
         var h1: u64 = seed ^ (len *% m);
-        var k1: u64 = v;
+        const k1: u64 = v;
         h1 ^= k1;
         h1 *%= m;
         h1 ^= h1 >> 47;
@@ -282,16 +282,14 @@ pub const Murmur3_32 = struct {
 const verify = @import("verify.zig");
 
 test "murmur2_32" {
-    var v0: u32 = 0x12345678;
-    var v1: u64 = 0x1234567812345678;
-    var v0le: u32 = v0;
-    var v1le: u64 = v1;
-    if (native_endian == .big) {
-        v0le = @byteSwap(v0le);
-        v1le = @byteSwap(v1le);
-    }
-    try testing.expectEqual(Murmur2_32.hash(@as([*]u8, @ptrCast(&v0le))[0..4]), Murmur2_32.hashUint32(v0));
-    try testing.expectEqual(Murmur2_32.hash(@as([*]u8, @ptrCast(&v1le))[0..8]), Murmur2_32.hashUint64(v1));
+    const v0: u32 = 0x12345678;
+    const v1: u64 = 0x1234567812345678;
+    const v0le: u32, const v1le: u64 = switch (native_endian) {
+        .little => .{ v0, v1 },
+        .big => .{ @byteSwap(v0), @byteSwap(v1) },
+    };
+    try testing.expectEqual(Murmur2_32.hash(@as([*]const u8, @ptrCast(&v0le))[0..4]), Murmur2_32.hashUint32(v0));
+    try testing.expectEqual(Murmur2_32.hash(@as([*]const u8, @ptrCast(&v1le))[0..8]), Murmur2_32.hashUint64(v1));
 }
 
 test "murmur2_32 smhasher" {
@@ -306,16 +304,14 @@ test "murmur2_32 smhasher" {
 }
 
 test "murmur2_64" {
-    var v0: u32 = 0x12345678;
-    var v1: u64 = 0x1234567812345678;
-    var v0le: u32 = v0;
-    var v1le: u64 = v1;
-    if (native_endian == .big) {
-        v0le = @byteSwap(v0le);
-        v1le = @byteSwap(v1le);
-    }
-    try testing.expectEqual(Murmur2_64.hash(@as([*]u8, @ptrCast(&v0le))[0..4]), Murmur2_64.hashUint32(v0));
-    try testing.expectEqual(Murmur2_64.hash(@as([*]u8, @ptrCast(&v1le))[0..8]), Murmur2_64.hashUint64(v1));
+    const v0: u32 = 0x12345678;
+    const v1: u64 = 0x1234567812345678;
+    const v0le: u32, const v1le: u64 = switch (native_endian) {
+        .little => .{ v0, v1 },
+        .big => .{ @byteSwap(v0), @byteSwap(v1) },
+    };
+    try testing.expectEqual(Murmur2_64.hash(@as([*]const u8, @ptrCast(&v0le))[0..4]), Murmur2_64.hashUint32(v0));
+    try testing.expectEqual(Murmur2_64.hash(@as([*]const u8, @ptrCast(&v1le))[0..8]), Murmur2_64.hashUint64(v1));
 }
 
 test "mumur2_64 smhasher" {
@@ -330,16 +326,14 @@ test "mumur2_64 smhasher" {
 }
 
 test "murmur3_32" {
-    var v0: u32 = 0x12345678;
-    var v1: u64 = 0x1234567812345678;
-    var v0le: u32 = v0;
-    var v1le: u64 = v1;
-    if (native_endian == .big) {
-        v0le = @byteSwap(v0le);
-        v1le = @byteSwap(v1le);
-    }
-    try testing.expectEqual(Murmur3_32.hash(@as([*]u8, @ptrCast(&v0le))[0..4]), Murmur3_32.hashUint32(v0));
-    try testing.expectEqual(Murmur3_32.hash(@as([*]u8, @ptrCast(&v1le))[0..8]), Murmur3_32.hashUint64(v1));
+    const v0: u32 = 0x12345678;
+    const v1: u64 = 0x1234567812345678;
+    const v0le: u32, const v1le: u64 = switch (native_endian) {
+        .little => .{ v0, v1 },
+        .big => .{ @byteSwap(v0), @byteSwap(v1) },
+    };
+    try testing.expectEqual(Murmur3_32.hash(@as([*]const u8, @ptrCast(&v0le))[0..4]), Murmur3_32.hashUint32(v0));
+    try testing.expectEqual(Murmur3_32.hash(@as([*]const u8, @ptrCast(&v1le))[0..8]), Murmur3_32.hashUint64(v1));
 }
 
 test "mumur3_32 smhasher" {
lib/std/heap/arena_allocator.zig
@@ -257,7 +257,7 @@ test "ArenaAllocator (reset with preheating)" {
         rounds -= 1;
         _ = arena_allocator.reset(.retain_capacity);
         var alloced_bytes: usize = 0;
-        var total_size: usize = random.intRangeAtMost(usize, 256, 16384);
+        const total_size: usize = random.intRangeAtMost(usize, 256, 16384);
         while (alloced_bytes < total_size) {
             const size = random.intRangeAtMost(usize, 16, 256);
             const alignment = 32;
lib/std/heap/general_purpose_allocator.zig
@@ -512,7 +512,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type {
             var buckets = &self.buckets[bucket_index];
             const slot_count = @divExact(page_size, size_class);
             if (self.cur_buckets[bucket_index] == null or self.cur_buckets[bucket_index].?.alloc_cursor == slot_count) {
-                var new_bucket = try self.createBucket(size_class);
+                const new_bucket = try self.createBucket(size_class);
                 errdefer self.freeBucket(new_bucket, size_class);
                 const node = try self.bucket_node_pool.create();
                 node.key = new_bucket;
@@ -526,7 +526,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type {
             const slot_index = bucket.alloc_cursor;
             bucket.alloc_cursor += 1;
 
-            var used_bits_byte = bucket.usedBits(slot_index / 8);
+            const used_bits_byte = bucket.usedBits(slot_index / 8);
             const used_bit_index: u3 = @as(u3, @intCast(slot_index % 8)); // TODO cast should be unnecessary
             used_bits_byte.* |= (@as(u8, 1) << used_bit_index);
             bucket.used_count += 1;
@@ -915,7 +915,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type {
             if (bucket.used_count == 0) {
                 var entry = self.buckets[bucket_index].getEntryFor(bucket);
                 // save the node for destruction/insertion into in empty_buckets
-                var node = entry.node.?;
+                const node = entry.node.?;
                 entry.set(null);
                 if (self.cur_buckets[bucket_index] == bucket) {
                     self.cur_buckets[bucket_index] = null;
lib/std/heap/memory_pool.zig
@@ -172,7 +172,7 @@ test "memory pool: preheating (success)" {
 }
 
 test "memory pool: preheating (failure)" {
-    var failer = std.testing.failing_allocator;
+    const failer = std.testing.failing_allocator;
     try std.testing.expectError(error.OutOfMemory, MemoryPool(u32).initPreheated(failer, 5));
 }
 
lib/std/http/Client.zig
@@ -144,7 +144,7 @@ pub const ConnectionPool = struct {
         pool.mutex.lock();
         defer pool.mutex.unlock();
 
-        var next = pool.free.first;
+        const next = pool.free.first;
         _ = next;
         while (pool.free_len > new_size) {
             const popped = pool.free.popFirst() orelse unreachable;
lib/std/http/protocol.zig
@@ -765,10 +765,9 @@ test "HeadersParser.read length" {
     var r = HeadersParser.initDynamic(256);
     defer r.header_bytes.deinit(std.testing.allocator);
     const data = "GET / HTTP/1.1\r\nHost: localhost\r\nContent-Length: 5\r\n\r\nHello";
-    var fbs = std.io.fixedBufferStream(data);
 
-    var conn = MockBufferedConnection{
-        .conn = fbs,
+    var conn: MockBufferedConnection = .{
+        .conn = std.io.fixedBufferStream(data),
     };
 
     while (true) { // read headers
@@ -796,10 +795,9 @@ test "HeadersParser.read chunked" {
     var r = HeadersParser.initDynamic(256);
     defer r.header_bytes.deinit(std.testing.allocator);
     const data = "GET / HTTP/1.1\r\nHost: localhost\r\n\r\n2\r\nHe\r\n2\r\nll\r\n1\r\no\r\n0\r\n\r\n";
-    var fbs = std.io.fixedBufferStream(data);
 
-    var conn = MockBufferedConnection{
-        .conn = fbs,
+    var conn: MockBufferedConnection = .{
+        .conn = std.io.fixedBufferStream(data),
     };
 
     while (true) { // read headers
@@ -826,10 +824,9 @@ test "HeadersParser.read chunked trailer" {
     var r = HeadersParser.initDynamic(256);
     defer r.header_bytes.deinit(std.testing.allocator);
     const data = "GET / HTTP/1.1\r\nHost: localhost\r\n\r\n2\r\nHe\r\n2\r\nll\r\n1\r\no\r\n0\r\nContent-Type: text/plain\r\n\r\n";
-    var fbs = std.io.fixedBufferStream(data);
 
-    var conn = MockBufferedConnection{
-        .conn = fbs,
+    var conn: MockBufferedConnection = .{
+        .conn = std.io.fixedBufferStream(data),
     };
 
     while (true) { // read headers
lib/std/io/Reader/test.zig
@@ -91,13 +91,13 @@ test "Reader.readUntilDelimiterAlloc returns ArrayLists with bytes read until th
     const reader = fis.reader();
 
     {
-        var result = try reader.readUntilDelimiterAlloc(a, '\n', 5);
+        const result = try reader.readUntilDelimiterAlloc(a, '\n', 5);
         defer a.free(result);
         try std.testing.expectEqualStrings("0000", result);
     }
 
     {
-        var result = try reader.readUntilDelimiterAlloc(a, '\n', 5);
+        const result = try reader.readUntilDelimiterAlloc(a, '\n', 5);
         defer a.free(result);
         try std.testing.expectEqualStrings("1234", result);
     }
@@ -112,7 +112,7 @@ test "Reader.readUntilDelimiterAlloc returns an empty ArrayList" {
     const reader = fis.reader();
 
     {
-        var result = try reader.readUntilDelimiterAlloc(a, '\n', 5);
+        const result = try reader.readUntilDelimiterAlloc(a, '\n', 5);
         defer a.free(result);
         try std.testing.expectEqualStrings("", result);
     }
@@ -126,7 +126,7 @@ test "Reader.readUntilDelimiterAlloc returns StreamTooLong, then an ArrayList wi
 
     try std.testing.expectError(error.StreamTooLong, reader.readUntilDelimiterAlloc(a, '\n', 5));
 
-    var result = try reader.readUntilDelimiterAlloc(a, '\n', 5);
+    const result = try reader.readUntilDelimiterAlloc(a, '\n', 5);
     defer a.free(result);
     try std.testing.expectEqualStrings("67", result);
 }
@@ -219,13 +219,13 @@ test "Reader.readUntilDelimiterOrEofAlloc returns ArrayLists with bytes read unt
     const reader = fis.reader();
 
     {
-        var result = (try reader.readUntilDelimiterOrEofAlloc(a, '\n', 5)).?;
+        const result = (try reader.readUntilDelimiterOrEofAlloc(a, '\n', 5)).?;
         defer a.free(result);
         try std.testing.expectEqualStrings("0000", result);
     }
 
     {
-        var result = (try reader.readUntilDelimiterOrEofAlloc(a, '\n', 5)).?;
+        const result = (try reader.readUntilDelimiterOrEofAlloc(a, '\n', 5)).?;
         defer a.free(result);
         try std.testing.expectEqualStrings("1234", result);
     }
@@ -240,7 +240,7 @@ test "Reader.readUntilDelimiterOrEofAlloc returns an empty ArrayList" {
     const reader = fis.reader();
 
     {
-        var result = (try reader.readUntilDelimiterOrEofAlloc(a, '\n', 5)).?;
+        const result = (try reader.readUntilDelimiterOrEofAlloc(a, '\n', 5)).?;
         defer a.free(result);
         try std.testing.expectEqualStrings("", result);
     }
@@ -254,7 +254,7 @@ test "Reader.readUntilDelimiterOrEofAlloc returns StreamTooLong, then an ArrayLi
 
     try std.testing.expectError(error.StreamTooLong, reader.readUntilDelimiterOrEofAlloc(a, '\n', 5));
 
-    var result = (try reader.readUntilDelimiterOrEofAlloc(a, '\n', 5)).?;
+    const result = (try reader.readUntilDelimiterOrEofAlloc(a, '\n', 5)).?;
     defer a.free(result);
     try std.testing.expectEqualStrings("67", result);
 }
lib/std/io/buffered_reader.zig
@@ -131,8 +131,9 @@ test "io.BufferedReader Block" {
 
     // len out == block
     {
-        var block_reader = BlockReader.init(block, 2);
-        var test_buf_reader = BufferedReader(4, BlockReader){ .unbuffered_reader = block_reader };
+        var test_buf_reader: BufferedReader(4, BlockReader) = .{
+            .unbuffered_reader = BlockReader.init(block, 2),
+        };
         var out_buf: [4]u8 = undefined;
         _ = try test_buf_reader.read(&out_buf);
         try testing.expectEqualSlices(u8, &out_buf, block);
@@ -143,8 +144,9 @@ test "io.BufferedReader Block" {
 
     // len out < block
     {
-        var block_reader = BlockReader.init(block, 2);
-        var test_buf_reader = BufferedReader(4, BlockReader){ .unbuffered_reader = block_reader };
+        var test_buf_reader: BufferedReader(4, BlockReader) = .{
+            .unbuffered_reader = BlockReader.init(block, 2),
+        };
         var out_buf: [3]u8 = undefined;
         _ = try test_buf_reader.read(&out_buf);
         try testing.expectEqualSlices(u8, &out_buf, "012");
@@ -157,8 +159,9 @@ test "io.BufferedReader Block" {
 
     // len out > block
     {
-        var block_reader = BlockReader.init(block, 2);
-        var test_buf_reader = BufferedReader(4, BlockReader){ .unbuffered_reader = block_reader };
+        var test_buf_reader: BufferedReader(4, BlockReader) = .{
+            .unbuffered_reader = BlockReader.init(block, 2),
+        };
         var out_buf: [5]u8 = undefined;
         _ = try test_buf_reader.read(&out_buf);
         try testing.expectEqualSlices(u8, &out_buf, "01230");
@@ -169,8 +172,9 @@ test "io.BufferedReader Block" {
 
     // len out == 0
     {
-        var block_reader = BlockReader.init(block, 2);
-        var test_buf_reader = BufferedReader(4, BlockReader){ .unbuffered_reader = block_reader };
+        var test_buf_reader: BufferedReader(4, BlockReader) = .{
+            .unbuffered_reader = BlockReader.init(block, 2),
+        };
         var out_buf: [0]u8 = undefined;
         _ = try test_buf_reader.read(&out_buf);
         try testing.expectEqualSlices(u8, &out_buf, "");
@@ -178,8 +182,9 @@ test "io.BufferedReader Block" {
 
     // len bufreader buf > block
     {
-        var block_reader = BlockReader.init(block, 2);
-        var test_buf_reader = BufferedReader(5, BlockReader){ .unbuffered_reader = block_reader };
+        var test_buf_reader: BufferedReader(5, BlockReader) = .{
+            .unbuffered_reader = BlockReader.init(block, 2),
+        };
         var out_buf: [4]u8 = undefined;
         _ = try test_buf_reader.read(&out_buf);
         try testing.expectEqualSlices(u8, &out_buf, block);
lib/std/io/test.zig
@@ -167,13 +167,13 @@ test "updateTimes" {
         file.close();
         tmp.dir.deleteFile(tmp_file_name) catch {};
     }
-    var stat_old = try file.stat();
+    const stat_old = try file.stat();
     // Set atime and mtime to 5s before
     try file.updateTimes(
         stat_old.atime - 5 * std.time.ns_per_s,
         stat_old.mtime - 5 * std.time.ns_per_s,
     );
-    var stat_new = try file.stat();
+    const stat_new = try file.stat();
     try expect(stat_new.atime < stat_old.atime);
     try expect(stat_new.mtime < stat_old.mtime);
 }
lib/std/json/dynamic_test.zig
@@ -190,15 +190,15 @@ test "Value.jsonStringify" {
     var obj = ObjectMap.init(testing.allocator);
     defer obj.deinit();
     try obj.putNoClobber("a", .{ .string = "b" });
-    var array = [_]Value{
-        Value.null,
-        Value{ .bool = true },
-        Value{ .integer = 42 },
-        Value{ .number_string = "43" },
-        Value{ .float = 42 },
-        Value{ .string = "weeee" },
-        Value{ .array = Array.fromOwnedSlice(undefined, &vals) },
-        Value{ .object = obj },
+    const array = [_]Value{
+        .null,
+        .{ .bool = true },
+        .{ .integer = 42 },
+        .{ .number_string = "43" },
+        .{ .float = 42 },
+        .{ .string = "weeee" },
+        .{ .array = Array.fromOwnedSlice(undefined, &vals) },
+        .{ .object = obj },
     };
     var buffer: [0x1000]u8 = undefined;
     var fbs = std.io.fixedBufferStream(&buffer);
lib/std/json/static_test.zig
@@ -533,7 +533,7 @@ test "parse into struct with misc fields" {
             string: []const u8,
         };
     };
-    var document_str =
+    const document_str =
         \\{
         \\  "int": 420,
         \\  "float": 3.14,
@@ -588,7 +588,7 @@ test "parse into struct with strings and arrays with sentinels" {
         data: [:99]const i32,
         simple_data: []const i32,
     };
-    var document_str =
+    const document_str =
         \\{
         \\  "language": "zig",
         \\  "language_without_sentinel": "zig again!",
@@ -634,7 +634,7 @@ test "parse into struct ignoring unknown fields" {
         language: []const u8,
     };
 
-    var str =
+    const str =
         \\{
         \\  "int": 420,
         \\  "float": 3.14,
@@ -685,7 +685,7 @@ test "parse into tuple" {
         std.meta.Tuple(&.{ u8, []const u8, u8 }),
         Union,
     });
-    var str =
+    const str =
         \\[
         \\  420,
         \\  3.14,
@@ -789,7 +789,7 @@ test "parse into vector" {
         vec_i32: @Vector(4, i32),
         vec_f32: @Vector(2, f32),
     };
-    var s =
+    const s =
         \\{
         \\  "vec_f32": [1.5, 2.5],
         \\  "vec_i32": [4, 5, 6, 7]
@@ -821,7 +821,7 @@ test "json parse partial" {
         num: u32,
         yes: bool,
     };
-    var str =
+    const str =
         \\{
         \\  "outer": {
         \\    "key1": {
@@ -835,7 +835,7 @@ test "json parse partial" {
         \\  }
         \\}
     ;
-    var allocator = testing.allocator;
+    const allocator = testing.allocator;
     var scanner = JsonScanner.initCompleteInput(allocator, str);
     defer scanner.deinit();
 
@@ -876,13 +876,13 @@ test "json parse allocate when streaming" {
         not_const: []u8,
         is_const: []const u8,
     };
-    var str =
+    const str =
         \\{
         \\  "not_const": "non const string",
         \\  "is_const": "const string"
         \\}
     ;
-    var allocator = testing.allocator;
+    const allocator = testing.allocator;
     var arena = ArenaAllocator.init(allocator);
     defer arena.deinit();
 
lib/std/math/big/int.zig
@@ -797,7 +797,7 @@ pub const Mutable = struct {
         // 0b0..01..1000 with @log2(@sizeOf(Limb)) consecutive ones
         const endian_mask: usize = (@sizeOf(Limb) - 1) << 3;
 
-        var bytes = std.mem.sliceAsBytes(r.limbs);
+        const bytes = std.mem.sliceAsBytes(r.limbs);
         var bits = std.packed_int_array.PackedIntSliceEndian(u1, .little).init(bytes, limbs_required * @bitSizeOf(Limb));
 
         var k: usize = 0;
@@ -1407,7 +1407,7 @@ pub const Mutable = struct {
             }
 
             // Avoid copying u to s by swapping u and s
-            var tmp_s = s;
+            const tmp_s = s;
             s = u;
             u = tmp_s;
         }
@@ -1911,7 +1911,7 @@ pub const Mutable = struct {
         var positive = true;
         if (signedness == .signed) {
             const total_bits = bit_offset + bit_count;
-            var last_byte = switch (endian) {
+            const last_byte = switch (endian) {
                 .little => ((total_bits + 7) / 8) - 1,
                 .big => buffer.len - ((total_bits + 7) / 8),
             };
@@ -3161,7 +3161,7 @@ pub const Managed = struct {
 
     /// r = a ^ b
     pub fn bitXor(r: *Managed, a: *const Managed, b: *const Managed) !void {
-        var cap = @max(a.len(), b.len()) + @intFromBool(a.isPositive() != b.isPositive());
+        const cap = @max(a.len(), b.len()) + @intFromBool(a.isPositive() != b.isPositive());
         try r.ensureCapacity(cap);
 
         var m = r.toMutable();
@@ -4178,7 +4178,7 @@ fn llpow(r: []Limb, a: []const Limb, b: u32, tmp_limbs: []Limb) void {
     // most significant bit set.
     // Square the result if the current bit is zero, square and multiply by a if
     // it is one.
-    var exp_bits = 32 - 1 - b_leading_zeros;
+    const exp_bits = 32 - 1 - b_leading_zeros;
     var exp = b << @as(u5, @intCast(1 + b_leading_zeros));
 
     var i: usize = 0;
lib/std/math/big/int_test.zig
@@ -300,20 +300,18 @@ test "big.int twos complement limit set" {
     };
 
     inline for (test_types) |T| {
-        // To work around 'control flow attempts to use compile-time variable at runtime'
-        const U = T;
-        const int_info = @typeInfo(U).Int;
+        const int_info = @typeInfo(T).Int;
 
         var a = try Managed.init(testing.allocator);
         defer a.deinit();
 
         try a.setTwosCompIntLimit(.max, int_info.signedness, int_info.bits);
-        var max: U = maxInt(U);
-        try testing.expect(max == try a.to(U));
+        const max: T = maxInt(T);
+        try testing.expect(max == try a.to(T));
 
         try a.setTwosCompIntLimit(.min, int_info.signedness, int_info.bits);
-        var min: U = minInt(U);
-        try testing.expect(min == try a.to(U));
+        const min: T = minInt(T);
+        try testing.expect(min == try a.to(T));
     }
 }
 
@@ -519,6 +517,9 @@ test "big.int add multi-single" {
 test "big.int add multi-multi" {
     var op1: u128 = 0xefefefef7f7f7f7f;
     var op2: u128 = 0xfefefefe9f9f9f9f;
+    // These must be runtime-known to prevent this comparison being tautological, as the
+    // compiler uses `std.math.big.int` internally to add these values at comptime.
+    _ = .{ &op1, &op2 };
     var a = try Managed.initSet(testing.allocator, op1);
     defer a.deinit();
     var b = try Managed.initSet(testing.allocator, op2);
@@ -833,6 +834,7 @@ test "big.int sub multi-single" {
 test "big.int sub multi-multi" {
     var op1: u128 = 0xefefefefefefefefefefefef;
     var op2: u128 = 0xabababababababababababab;
+    _ = .{ &op1, &op2 };
 
     var a = try Managed.initSet(testing.allocator, op1);
     defer a.deinit();
@@ -920,6 +922,8 @@ test "big.int mul multi-multi" {
 
     var op1: u256 = 0x998888efefefefefefefef;
     var op2: u256 = 0x333000abababababababab;
+    _ = .{ &op1, &op2 };
+
     var a = try Managed.initSet(testing.allocator, op1);
     defer a.deinit();
     var b = try Managed.initSet(testing.allocator, op2);
@@ -1042,6 +1046,8 @@ test "big.int mulWrap multi-multi unsigned" {
 
     var op1: u256 = 0x998888efefefefefefefef;
     var op2: u256 = 0x333000abababababababab;
+    _ = .{ &op1, &op2 };
+
     var a = try Managed.initSet(testing.allocator, op1);
     defer a.deinit();
     var b = try Managed.initSet(testing.allocator, op2);
@@ -1164,6 +1170,7 @@ test "big.int div single-single with rem" {
 test "big.int div multi-single no rem" {
     var op1: u128 = 0xffffeeeeddddcccc;
     var op2: u128 = 34;
+    _ = .{ &op1, &op2 };
 
     var a = try Managed.initSet(testing.allocator, op1);
     defer a.deinit();
@@ -1183,6 +1190,7 @@ test "big.int div multi-single no rem" {
 test "big.int div multi-single with rem" {
     var op1: u128 = 0xffffeeeeddddcccf;
     var op2: u128 = 34;
+    _ = .{ &op1, &op2 };
 
     var a = try Managed.initSet(testing.allocator, op1);
     defer a.deinit();
@@ -1202,6 +1210,7 @@ test "big.int div multi-single with rem" {
 test "big.int div multi>2-single" {
     var op1: u128 = 0xfefefefefefefefefefefefefefefefe;
     var op2: u128 = 0xefab8;
+    _ = .{ &op1, &op2 };
 
     var a = try Managed.initSet(testing.allocator, op1);
     defer a.deinit();
@@ -2106,6 +2115,8 @@ test "big.int sat shift-left signed multi positive" {
     if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
 
     var x: SignedDoubleLimb = 1;
+    _ = &x;
+
     const shift = @bitSizeOf(SignedDoubleLimb) - 1;
 
     var a = try Managed.initSet(testing.allocator, x);
@@ -2119,6 +2130,8 @@ test "big.int sat shift-left signed multi negative" {
     if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
 
     var x: SignedDoubleLimb = -1;
+    _ = &x;
+
     const shift = @bitSizeOf(SignedDoubleLimb) - 1;
 
     var a = try Managed.initSet(testing.allocator, x);
@@ -2130,6 +2143,8 @@ test "big.int sat shift-left signed multi negative" {
 
 test "big.int bitNotWrap unsigned simple" {
     var x: u10 = 123;
+    _ = &x;
+
     var a = try Managed.initSet(testing.allocator, x);
     defer a.deinit();
 
@@ -2149,6 +2164,8 @@ test "big.int bitNotWrap unsigned multi" {
 
 test "big.int bitNotWrap signed simple" {
     var x: i11 = -456;
+    _ = &x;
+
     var a = try Managed.initSet(testing.allocator, -456);
     defer a.deinit();
 
@@ -2306,6 +2323,8 @@ test "big.int bitwise xor simple" {
 test "big.int bitwise xor multi-limb" {
     var x: DoubleLimb = maxInt(Limb) + 1;
     var y: DoubleLimb = maxInt(Limb);
+    _ = .{ &x, &y };
+
     var a = try Managed.initSet(testing.allocator, x);
     defer a.deinit();
     var b = try Managed.initSet(testing.allocator, y);
@@ -2548,7 +2567,7 @@ test "big.int gcd one large" {
 
 test "big.int mutable to managed" {
     const allocator = testing.allocator;
-    var limbs_buf = try allocator.alloc(Limb, 8);
+    const limbs_buf = try allocator.alloc(Limb, 8);
     defer allocator.free(limbs_buf);
 
     var a = Mutable.init(limbs_buf, 0xdeadbeef);
@@ -2965,7 +2984,7 @@ test "big int conversion write twos complement zero" {
     // (2) should correctly interpret bytes based on the provided endianness
     // (3) should ignore any bits from bit_count to 8 * abi_size
 
-    var bit_count: usize = 12 * 8 + 1;
+    const bit_count: usize = 12 * 8 + 1;
     var buffer: []const u8 = undefined;
 
     buffer = &([_]u8{0} ** 13);
lib/std/math/complex/atan.zig
@@ -55,7 +55,7 @@ fn atan32(z: Complex(f32)) Complex(f32) {
     }
 
     var t = 0.5 * math.atan2(f32, 2.0 * x, a);
-    var w = redupif32(t);
+    const w = redupif32(t);
 
     t = y - 1.0;
     a = x2 + t * t;
@@ -104,7 +104,7 @@ fn atan64(z: Complex(f64)) Complex(f64) {
     }
 
     var t = 0.5 * math.atan2(f64, 2.0 * x, a);
-    var w = redupif64(t);
+    const w = redupif64(t);
 
     t = y - 1.0;
     a = x2 + t * t;
lib/std/math/atan.zig
@@ -143,8 +143,8 @@ fn atan64(x_: f64) f64 {
     };
 
     var x = x_;
-    var ux = @as(u64, @bitCast(x));
-    var ix = @as(u32, @intCast(ux >> 32));
+    const ux: u64 = @bitCast(x);
+    var ix: u32 = @intCast(ux >> 32);
     const sign = ix >> 31;
     ix &= 0x7FFFFFFF;
 
lib/std/math/atan2.zig
@@ -104,7 +104,7 @@ fn atan2_32(y: f32, x: f32) f32 {
     }
 
     // z = atan(|y / x|) with correct underflow
-    var z = z: {
+    const z = z: {
         if ((m & 2) != 0 and iy + (26 << 23) < ix) {
             break :z 0.0;
         } else {
@@ -129,13 +129,13 @@ fn atan2_64(y: f64, x: f64) f64 {
         return x + y;
     }
 
-    var ux = @as(u64, @bitCast(x));
-    var ix = @as(u32, @intCast(ux >> 32));
-    var lx = @as(u32, @intCast(ux & 0xFFFFFFFF));
+    const ux: u64 = @bitCast(x);
+    var ix: u32 = @intCast(ux >> 32);
+    const lx: u32 = @intCast(ux & 0xFFFFFFFF);
 
-    var uy = @as(u64, @bitCast(y));
-    var iy = @as(u32, @intCast(uy >> 32));
-    var ly = @as(u32, @intCast(uy & 0xFFFFFFFF));
+    const uy: u64 = @bitCast(y);
+    var iy: u32 = @intCast(uy >> 32);
+    const ly: u32 = @intCast(uy & 0xFFFFFFFF);
 
     // x = 1.0
     if ((ix -% 0x3FF00000) | lx == 0) {
@@ -194,7 +194,7 @@ fn atan2_64(y: f64, x: f64) f64 {
     }
 
     // z = atan(|y / x|) with correct underflow
-    var z = z: {
+    const z = z: {
         if ((m & 2) != 0 and iy +% (64 << 20) < ix) {
             break :z 0.0;
         } else {
lib/std/math/cbrt.zig
@@ -102,7 +102,7 @@ fn cbrt64(x: f64) f64 {
 
     // cbrt to 23 bits
     // cbrt(x) = t * cbrt(x / t^3) ~= t * P(t^3 / x)
-    var r = (t * t) * (t / x);
+    const r = (t * t) * (t / x);
     t = t * ((P0 + r * (P1 + r * P2)) + ((r * r) * r) * (P3 + r * P4));
 
     // Round t away from 0 to 23 bits
@@ -113,7 +113,7 @@ fn cbrt64(x: f64) f64 {
     // one step newton to 53 bits
     const s = t * t;
     var q = x / s;
-    var w = t + t;
+    const w = t + t;
     q = (q - t) / (w + q);
 
     return t + t * q;
lib/std/math/ilogb.zig
@@ -38,8 +38,8 @@ fn ilogbX(comptime T: type, x: T) i32 {
 
     const absMask = signBit - 1;
 
-    var u = @as(Z, @bitCast(x)) & absMask;
-    var e = @as(i32, @intCast(u >> significandBits));
+    const u = @as(Z, @bitCast(x)) & absMask;
+    const e: i32 = @intCast(u >> significandBits);
 
     if (e == 0) {
         if (u == 0) {
lib/std/math/log1p.zig
@@ -33,8 +33,8 @@ fn log1p_32(x: f32) f32 {
     const Lg3: f32 = 0x91e9ee.0p-25;
     const Lg4: f32 = 0xf89e26.0p-26;
 
-    const u = @as(u32, @bitCast(x));
-    var ix = u;
+    const u: u32 = @bitCast(x);
+    const ix = u;
     var k: i32 = 1;
     var f: f32 = undefined;
     var c: f32 = undefined;
@@ -112,8 +112,8 @@ fn log1p_64(x: f64) f64 {
     const Lg6: f64 = 1.531383769920937332e-01;
     const Lg7: f64 = 1.479819860511658591e-01;
 
-    var ix = @as(u64, @bitCast(x));
-    var hx = @as(u32, @intCast(ix >> 32));
+    const ix: u64 = @bitCast(x);
+    const hx: u32 = @intCast(ix >> 32);
     var k: i32 = 1;
     var c: f64 = undefined;
     var f: f64 = undefined;
lib/std/math/sqrt.zig
@@ -50,7 +50,7 @@ fn sqrt_int(comptime T: type, value: T) Sqrt(T) {
         }
 
         while (one != 0) {
-            var c = op >= res + one;
+            const c = op >= res + one;
             if (c) op -= res + one;
             res >>= 1;
             if (c) res += one;
lib/std/meta/trait.zig
@@ -225,6 +225,7 @@ test "isSingleItemPtr" {
     try comptime testing.expect(isSingleItemPtr(@TypeOf(&array[0])));
     try comptime testing.expect(!isSingleItemPtr(@TypeOf(array)));
     var runtime_zero: usize = 0;
+    _ = &runtime_zero;
     try testing.expect(!isSingleItemPtr(@TypeOf(array[runtime_zero..1])));
 }
 
@@ -253,6 +254,7 @@ pub fn isSlice(comptime T: type) bool {
 test "isSlice" {
     const array = [_]u8{0} ** 10;
     var runtime_zero: usize = 0;
+    _ = &runtime_zero;
     try testing.expect(isSlice(@TypeOf(array[runtime_zero..])));
     try testing.expect(!isSlice(@TypeOf(array)));
     try testing.expect(!isSlice(@TypeOf(&array[0])));
@@ -341,8 +343,9 @@ pub fn isConstPtr(comptime T: type) bool {
 }
 
 test "isConstPtr" {
-    var t = @as(u8, 0);
-    const c = @as(u8, 0);
+    var t: u8 = 0;
+    t = t;
+    const c: u8 = 0;
     try testing.expect(isConstPtr(*const @TypeOf(t)));
     try testing.expect(isConstPtr(@TypeOf(&c)));
     try testing.expect(!isConstPtr(*@TypeOf(t)));
lib/std/net/test.zig
@@ -33,12 +33,12 @@ test "parse and render IPv6 addresses" {
         "::ffff:123.5.123.5",
     };
     for (ips, 0..) |ip, i| {
-        var addr = net.Address.parseIp6(ip, 0) catch unreachable;
+        const addr = net.Address.parseIp6(ip, 0) catch unreachable;
         var newIp = std.fmt.bufPrint(buffer[0..], "{}", .{addr}) catch unreachable;
         try std.testing.expect(std.mem.eql(u8, printed[i], newIp[1 .. newIp.len - 3]));
 
         if (builtin.os.tag == .linux) {
-            var addr_via_resolve = net.Address.resolveIp6(ip, 0) catch unreachable;
+            const addr_via_resolve = net.Address.resolveIp6(ip, 0) catch unreachable;
             var newResolvedIp = std.fmt.bufPrint(buffer[0..], "{}", .{addr_via_resolve}) catch unreachable;
             try std.testing.expect(std.mem.eql(u8, printed[i], newResolvedIp[1 .. newResolvedIp.len - 3]));
         }
@@ -80,7 +80,7 @@ test "parse and render IPv4 addresses" {
         "123.255.0.91",
         "127.0.0.1",
     }) |ip| {
-        var addr = net.Address.parseIp4(ip, 0) catch unreachable;
+        const addr = net.Address.parseIp4(ip, 0) catch unreachable;
         var newIp = std.fmt.bufPrint(buffer[0..], "{}", .{addr}) catch unreachable;
         try std.testing.expect(std.mem.eql(u8, ip, newIp[0 .. newIp.len - 2]));
     }
@@ -303,10 +303,10 @@ test "listen on a unix socket, send bytes, receive bytes" {
     var server = net.StreamServer.init(.{});
     defer server.deinit();
 
-    var socket_path = try generateFileName("socket.unix");
+    const socket_path = try generateFileName("socket.unix");
     defer testing.allocator.free(socket_path);
 
-    var socket_addr = try net.Address.initUnix(socket_path);
+    const socket_addr = try net.Address.initUnix(socket_path);
     defer std.fs.cwd().deleteFile(socket_path) catch {};
     try server.listen(socket_addr);
 
lib/std/os/linux/io_uring.zig
@@ -137,7 +137,7 @@ pub const IO_Uring = struct {
         // We must therefore use wrapping addition and subtraction to avoid a runtime crash.
         const next = self.sq.sqe_tail +% 1;
         if (next -% head > self.sq.sqes.len) return error.SubmissionQueueFull;
-        var sqe = &self.sq.sqes[self.sq.sqe_tail & self.sq.mask];
+        const sqe = &self.sq.sqes[self.sq.sqe_tail & self.sq.mask];
         self.sq.sqe_tail = next;
         return sqe;
     }
@@ -279,7 +279,7 @@ pub const IO_Uring = struct {
         const ready = self.cq_ready();
         const count = @min(cqes.len, ready);
         var head = self.cq.head.*;
-        var tail = head +% count;
+        const tail = head +% count;
         // TODO Optimize this by using 1 or 2 memcpy's (if the tail wraps) rather than a loop.
         var i: usize = 0;
         // Do not use "less-than" operator since head and tail may wrap:
@@ -1916,7 +1916,7 @@ test "splice/read" {
     var buffer_read = [_]u8{98} ** 20;
     _ = try file_src.write(&buffer_write);
 
-    var fds = try os.pipe();
+    const fds = try os.pipe();
     const pipe_offset: u64 = std.math.maxInt(u64);
 
     const sqe_splice_to_pipe = try ring.splice(0x11111111, fd_src, 0, fds[1], pipe_offset, buffer_write.len);
@@ -2045,6 +2045,7 @@ test "openat" {
     // Workaround for LLVM bug: https://github.com/ziglang/zig/issues/12014
     const path_addr = if (builtin.zig_backend == .stage2_llvm) p: {
         var workaround = path;
+        _ = &workaround;
         break :p @intFromPtr(workaround);
     } else @intFromPtr(path);
 
@@ -2199,7 +2200,7 @@ test "sendmsg/recvmsg" {
     var iovecs_recv = [_]os.iovec{
         os.iovec{ .iov_base = &buffer_recv, .iov_len = buffer_recv.len },
     };
-    var addr = [_]u8{0} ** 4;
+    const addr = [_]u8{0} ** 4;
     var address_recv = net.Address.initIp4(addr, 0);
     var msg_recv: os.msghdr = os.msghdr{
         .name = &address_recv.any,
@@ -2676,7 +2677,7 @@ test "shutdown" {
         var slen: os.socklen_t = address.getOsSockLen();
         try os.getsockname(server, &address.any, &slen);
 
-        var shutdown_sqe = try ring.shutdown(0x445445445, server, os.linux.SHUT.RD);
+        const shutdown_sqe = try ring.shutdown(0x445445445, server, os.linux.SHUT.RD);
         try testing.expectEqual(linux.IORING_OP.SHUTDOWN, shutdown_sqe.opcode);
         try testing.expectEqual(@as(i32, server), shutdown_sqe.fd);
 
@@ -2702,7 +2703,7 @@ test "shutdown" {
         const server = try os.socket(address.any.family, os.SOCK.STREAM | os.SOCK.CLOEXEC, 0);
         defer os.close(server);
 
-        var shutdown_sqe = ring.shutdown(0x445445445, server, os.linux.SHUT.RD) catch |err| switch (err) {
+        const shutdown_sqe = ring.shutdown(0x445445445, server, os.linux.SHUT.RD) catch |err| switch (err) {
             else => |errno| std.debug.panic("unhandled errno: {}", .{errno}),
         };
         try testing.expectEqual(linux.IORING_OP.SHUTDOWN, shutdown_sqe.opcode);
@@ -2740,7 +2741,7 @@ test "renameat" {
 
     // Submit renameat
 
-    var sqe = try ring.renameat(
+    const sqe = try ring.renameat(
         0x12121212,
         tmp.dir.fd,
         old_path,
@@ -2807,7 +2808,7 @@ test "unlinkat" {
 
     // Submit unlinkat
 
-    var sqe = try ring.unlinkat(
+    const sqe = try ring.unlinkat(
         0x12121212,
         tmp.dir.fd,
         path,
@@ -2854,7 +2855,7 @@ test "mkdirat" {
 
     // Submit mkdirat
 
-    var sqe = try ring.mkdirat(
+    const sqe = try ring.mkdirat(
         0x12121212,
         tmp.dir.fd,
         path,
@@ -2902,7 +2903,7 @@ test "symlinkat" {
 
     // Submit symlinkat
 
-    var sqe = try ring.symlinkat(
+    const sqe = try ring.symlinkat(
         0x12121212,
         path,
         tmp.dir.fd,
@@ -2953,7 +2954,7 @@ test "linkat" {
 
     // Submit linkat
 
-    var sqe = try ring.linkat(
+    const sqe = try ring.linkat(
         0x12121212,
         tmp.dir.fd,
         first_path,
@@ -3032,7 +3033,7 @@ test "provide_buffers: read" {
 
     var i: usize = 0;
     while (i < buffers.len) : (i += 1) {
-        var sqe = try ring.read(0xdededede, fd, .{ .buffer_selection = .{ .group_id = group_id, .len = buffer_len } }, 0);
+        const sqe = try ring.read(0xdededede, fd, .{ .buffer_selection = .{ .group_id = group_id, .len = buffer_len } }, 0);
         try testing.expectEqual(linux.IORING_OP.READ, sqe.opcode);
         try testing.expectEqual(@as(i32, fd), sqe.fd);
         try testing.expectEqual(@as(u64, 0), sqe.addr);
@@ -3058,7 +3059,7 @@ test "provide_buffers: read" {
     // This read should fail
 
     {
-        var sqe = try ring.read(0xdfdfdfdf, fd, .{ .buffer_selection = .{ .group_id = group_id, .len = buffer_len } }, 0);
+        const sqe = try ring.read(0xdfdfdfdf, fd, .{ .buffer_selection = .{ .group_id = group_id, .len = buffer_len } }, 0);
         try testing.expectEqual(linux.IORING_OP.READ, sqe.opcode);
         try testing.expectEqual(@as(i32, fd), sqe.fd);
         try testing.expectEqual(@as(u64, 0), sqe.addr);
@@ -3097,7 +3098,7 @@ test "provide_buffers: read" {
     // Final read which should work
 
     {
-        var sqe = try ring.read(0xdfdfdfdf, fd, .{ .buffer_selection = .{ .group_id = group_id, .len = buffer_len } }, 0);
+        const sqe = try ring.read(0xdfdfdfdf, fd, .{ .buffer_selection = .{ .group_id = group_id, .len = buffer_len } }, 0);
         try testing.expectEqual(linux.IORING_OP.READ, sqe.opcode);
         try testing.expectEqual(@as(i32, fd), sqe.fd);
         try testing.expectEqual(@as(u64, 0), sqe.addr);
@@ -3158,7 +3159,7 @@ test "remove_buffers" {
     // Remove 3 buffers
 
     {
-        var sqe = try ring.remove_buffers(0xbababababa, 3, group_id);
+        const sqe = try ring.remove_buffers(0xbababababa, 3, group_id);
         try testing.expectEqual(linux.IORING_OP.REMOVE_BUFFERS, sqe.opcode);
         try testing.expectEqual(@as(i32, 3), sqe.fd);
         try testing.expectEqual(@as(u64, 0), sqe.addr);
@@ -3270,7 +3271,7 @@ test "provide_buffers: accept/connect/send/recv" {
 
     var i: usize = 0;
     while (i < buffers.len) : (i += 1) {
-        var sqe = try ring.recv(0xdededede, socket_test_harness.client, .{ .buffer_selection = .{ .group_id = group_id, .len = buffer_len } }, 0);
+        const sqe = try ring.recv(0xdededede, socket_test_harness.client, .{ .buffer_selection = .{ .group_id = group_id, .len = buffer_len } }, 0);
         try testing.expectEqual(linux.IORING_OP.RECV, sqe.opcode);
         try testing.expectEqual(@as(i32, socket_test_harness.client), sqe.fd);
         try testing.expectEqual(@as(u64, 0), sqe.addr);
@@ -3299,7 +3300,7 @@ test "provide_buffers: accept/connect/send/recv" {
     // This recv should fail
 
     {
-        var sqe = try ring.recv(0xdfdfdfdf, socket_test_harness.client, .{ .buffer_selection = .{ .group_id = group_id, .len = buffer_len } }, 0);
+        const sqe = try ring.recv(0xdfdfdfdf, socket_test_harness.client, .{ .buffer_selection = .{ .group_id = group_id, .len = buffer_len } }, 0);
         try testing.expectEqual(linux.IORING_OP.RECV, sqe.opcode);
         try testing.expectEqual(@as(i32, socket_test_harness.client), sqe.fd);
         try testing.expectEqual(@as(u64, 0), sqe.addr);
@@ -3349,7 +3350,7 @@ test "provide_buffers: accept/connect/send/recv" {
     @memset(mem.sliceAsBytes(&buffers), 1);
 
     {
-        var sqe = try ring.recv(0xdfdfdfdf, socket_test_harness.client, .{ .buffer_selection = .{ .group_id = group_id, .len = buffer_len } }, 0);
+        const sqe = try ring.recv(0xdfdfdfdf, socket_test_harness.client, .{ .buffer_selection = .{ .group_id = group_id, .len = buffer_len } }, 0);
         try testing.expectEqual(linux.IORING_OP.RECV, sqe.opcode);
         try testing.expectEqual(@as(i32, socket_test_harness.client), sqe.fd);
         try testing.expectEqual(@as(u64, 0), sqe.addr);
@@ -3477,7 +3478,7 @@ test "accept multishot" {
     var nr: usize = 4; // number of clients to connect
     while (nr > 0) : (nr -= 1) {
         // connect client
-        var client = try os.socket(address.any.family, os.SOCK.STREAM | os.SOCK.CLOEXEC, 0);
+        const client = try os.socket(address.any.family, os.SOCK.STREAM | os.SOCK.CLOEXEC, 0);
         errdefer os.closeSocket(client);
         try os.connect(client, &address.any, address.getOsSockLen());
 
lib/std/os/uefi/protocol/device_path.zig
@@ -43,7 +43,7 @@ pub const DevicePath = extern struct {
 
     /// Creates a file device path from the existing device path and a file path.
     pub fn create_file_device_path(self: *DevicePath, allocator: Allocator, path: [:0]align(1) const u16) !*DevicePath {
-        var path_size = self.size();
+        const path_size = self.size();
 
         // 2 * (path.len + 1) for the path and its null terminator, which are u16s
         // DevicePath for the extra node before the end
@@ -82,8 +82,7 @@ pub const DevicePath = extern struct {
             // Got the associated union type for self.type, now
             // we need to initialize it and its subtype
             if (self.type == enum_value) {
-                var subtype = self.initSubtype(ufield.type);
-
+                const subtype = self.initSubtype(ufield.type);
                 if (subtype) |sb| {
                     // e.g. return .{ .Hardware = .{ .Pci = @ptrCast(...) } }
                     return @unionInit(uefi.DevicePath, ufield.name, sb);
lib/std/os/uefi/device_path.zig
@@ -213,7 +213,7 @@ pub const DevicePath = union(Type) {
             // multiple adr entries can optionally follow
             pub fn adrs(self: *const AdrDevicePath) []align(1) const u32 {
                 // self.length is a minimum of 8 with one adr which is size 4.
-                var entries = (self.length - 4) / @sizeOf(u32);
+                const entries = (self.length - 4) / @sizeOf(u32);
                 return @as([*]align(1) const u32, @ptrCast(&self.adr))[0..entries];
             }
         };
@@ -431,7 +431,7 @@ pub const DevicePath = union(Type) {
             device_product_id: u16 align(1),
 
             pub fn serial_number(self: *const UsbWwidDevicePath) []align(1) const u16 {
-                var serial_len = (self.length - @sizeOf(UsbWwidDevicePath)) / @sizeOf(u16);
+                const serial_len = (self.length - @sizeOf(UsbWwidDevicePath)) / @sizeOf(u16);
                 return @as([*]align(1) const u16, @ptrCast(@as([*]const u8, @ptrCast(self)) + @sizeOf(UsbWwidDevicePath)))[0..serial_len];
             }
         };
lib/std/os/uefi/pool_allocator.zig
@@ -34,7 +34,7 @@ const UefiPoolAllocator = struct {
         const unaligned_addr = @intFromPtr(unaligned_ptr);
         const aligned_addr = mem.alignForward(usize, unaligned_addr + @sizeOf(usize), ptr_align);
 
-        var aligned_ptr = unaligned_ptr + (aligned_addr - unaligned_addr);
+        const aligned_ptr = unaligned_ptr + (aligned_addr - unaligned_addr);
         getHeader(aligned_ptr).* = unaligned_ptr;
 
         return aligned_ptr;
lib/std/os/linux.zig
@@ -1326,6 +1326,7 @@ pub fn sendmmsg(fd: i32, msgvec: [*]mmsghdr_const, vlen: u32, flags: u32) usize
                     next_unsent = i + 1;
                     break;
                 }
+                size += iov.iov_len;
             }
         }
         if (next_unsent < kvlen or next_unsent == 0) { // want to make sure at least one syscall occurs (e.g. to trigger MSG.EOR)
lib/std/os/plan9.zig
@@ -278,7 +278,7 @@ pub fn sbrk(n: usize) usize {
         bloc = @intFromPtr(&ExecData.end);
         bloc_max = @intFromPtr(&ExecData.end);
     }
-    var bl = std.mem.alignForward(usize, bloc, std.mem.page_size);
+    const bl = std.mem.alignForward(usize, bloc, std.mem.page_size);
     const n_aligned = std.mem.alignForward(usize, n, std.mem.page_size);
     if (bl + n_aligned > bloc_max) {
         // we need to allocate
lib/std/os/test.zig
@@ -58,7 +58,7 @@ test "chdir smoke test" {
     {
         // Create a tmp directory
         var tmp_dir_buf: [fs.MAX_PATH_BYTES]u8 = undefined;
-        var tmp_dir_path = path: {
+        const tmp_dir_path = path: {
             var allocator = std.heap.FixedBufferAllocator.init(&tmp_dir_buf);
             break :path try fs.path.resolve(allocator.allocator(), &[_][]const u8{ old_cwd, "zig-test-tmp" });
         };
@@ -72,7 +72,7 @@ test "chdir smoke test" {
 
         // On Windows, fs.path.resolve returns an uppercase drive letter, but the drive letter returned by getcwd may be lowercase
         var resolved_cwd_buf: [fs.MAX_PATH_BYTES]u8 = undefined;
-        var resolved_cwd = path: {
+        const resolved_cwd = path: {
             var allocator = std.heap.FixedBufferAllocator.init(&resolved_cwd_buf);
             break :path try fs.path.resolve(allocator.allocator(), &[_][]const u8{new_cwd});
         };
@@ -523,7 +523,7 @@ test "pipe" {
     if (native_os == .windows or native_os == .wasi)
         return error.SkipZigTest;
 
-    var fds = try os.pipe();
+    const fds = try os.pipe();
     try expect((try os.write(fds[1], "hello")) == 5);
     var buf: [16]u8 = undefined;
     try expect((try os.read(fds[0], buf[0..])) == 5);
@@ -533,7 +533,7 @@ test "pipe" {
 }
 
 test "argsAlloc" {
-    var args = try std.process.argsAlloc(std.testing.allocator);
+    const args = try std.process.argsAlloc(std.testing.allocator);
     std.process.argsFree(std.testing.allocator, args);
 }
 
@@ -1087,7 +1087,7 @@ test "timerfd" {
         return error.SkipZigTest;
 
     const linux = os.linux;
-    var tfd = try os.timerfd_create(linux.CLOCK.MONOTONIC, linux.TFD.CLOEXEC);
+    const tfd = try os.timerfd_create(linux.CLOCK.MONOTONIC, linux.TFD.CLOEXEC);
     defer os.close(tfd);
 
     // Fire event 10_000_000ns = 10ms after the os.timerfd_settime call.
@@ -1097,8 +1097,8 @@ test "timerfd" {
     var fds: [1]os.pollfd = .{.{ .fd = tfd, .events = os.linux.POLL.IN, .revents = 0 }};
     try expectEqual(@as(usize, 1), try os.poll(&fds, -1)); // -1 => infinite waiting
 
-    var git = try os.timerfd_gettime(tfd);
-    var expect_disarmed_timer: linux.itimerspec = .{ .it_interval = .{ .tv_sec = 0, .tv_nsec = 0 }, .it_value = .{ .tv_sec = 0, .tv_nsec = 0 } };
+    const git = try os.timerfd_gettime(tfd);
+    const expect_disarmed_timer: linux.itimerspec = .{ .it_interval = .{ .tv_sec = 0, .tv_nsec = 0 }, .it_value = .{ .tv_sec = 0, .tv_nsec = 0 } };
     try expectEqual(expect_disarmed_timer, git);
 }
 
@@ -1128,11 +1128,11 @@ test "read with empty buffer" {
         break :blk try fs.realpathAlloc(allocator, relative_path);
     };
 
-    var file_path: []u8 = try fs.path.join(allocator, &[_][]const u8{ base_path, "some_file" });
+    const file_path: []u8 = try fs.path.join(allocator, &[_][]const u8{ base_path, "some_file" });
     var file = try fs.cwd().createFile(file_path, .{ .read = true });
     defer file.close();
 
-    var bytes = try allocator.alloc(u8, 0);
+    const bytes = try allocator.alloc(u8, 0);
 
     _ = try os.read(file.handle, bytes);
 }
@@ -1153,11 +1153,11 @@ test "pread with empty buffer" {
         break :blk try fs.realpathAlloc(allocator, relative_path);
     };
 
-    var file_path: []u8 = try fs.path.join(allocator, &[_][]const u8{ base_path, "some_file" });
+    const file_path: []u8 = try fs.path.join(allocator, &[_][]const u8{ base_path, "some_file" });
     var file = try fs.cwd().createFile(file_path, .{ .read = true });
     defer file.close();
 
-    var bytes = try allocator.alloc(u8, 0);
+    const bytes = try allocator.alloc(u8, 0);
 
     _ = try os.pread(file.handle, bytes, 0);
 }
@@ -1178,11 +1178,11 @@ test "write with empty buffer" {
         break :blk try fs.realpathAlloc(allocator, relative_path);
     };
 
-    var file_path: []u8 = try fs.path.join(allocator, &[_][]const u8{ base_path, "some_file" });
+    const file_path: []u8 = try fs.path.join(allocator, &[_][]const u8{ base_path, "some_file" });
     var file = try fs.cwd().createFile(file_path, .{});
     defer file.close();
 
-    var bytes = try allocator.alloc(u8, 0);
+    const bytes = try allocator.alloc(u8, 0);
 
     _ = try os.write(file.handle, bytes);
 }
@@ -1203,11 +1203,11 @@ test "pwrite with empty buffer" {
         break :blk try fs.realpathAlloc(allocator, relative_path);
     };
 
-    var file_path: []u8 = try fs.path.join(allocator, &[_][]const u8{ base_path, "some_file" });
+    const file_path: []u8 = try fs.path.join(allocator, &[_][]const u8{ base_path, "some_file" });
     var file = try fs.cwd().createFile(file_path, .{});
     defer file.close();
 
-    var bytes = try allocator.alloc(u8, 0);
+    const bytes = try allocator.alloc(u8, 0);
 
     _ = try os.pwrite(file.handle, bytes, 0);
 }
lib/std/os/uefi.zig
@@ -149,11 +149,10 @@ pub const TimeCapabilities = extern struct {
 pub const FileHandle = *opaque {};
 
 test "GUID formatting" {
-    var bytes = [_]u8{ 137, 60, 203, 50, 128, 128, 124, 66, 186, 19, 80, 73, 135, 59, 194, 135 };
+    const bytes = [_]u8{ 137, 60, 203, 50, 128, 128, 124, 66, 186, 19, 80, 73, 135, 59, 194, 135 };
+    const guid: Guid = @bitCast(bytes);
 
-    var guid = @as(Guid, @bitCast(bytes));
-
-    var str = try std.fmt.allocPrint(std.testing.allocator, "{}", .{guid});
+    const str = try std.fmt.allocPrint(std.testing.allocator, "{}", .{guid});
     defer std.testing.allocator.free(str);
 
     try std.testing.expect(std.mem.eql(u8, str, "32cb3c89-8080-427c-ba13-5049873bc287"));
lib/std/os/windows.zig
@@ -1166,7 +1166,7 @@ test "QueryObjectName" {
     const handle = tmp.dir.fd;
     var out_buffer: [PATH_MAX_WIDE]u16 = undefined;
 
-    var result_path = try QueryObjectName(handle, &out_buffer);
+    const result_path = try QueryObjectName(handle, &out_buffer);
     const required_len_in_u16 = result_path.len + @divExact(@intFromPtr(result_path.ptr) - @intFromPtr(&out_buffer), 2) + 1;
     //insufficient size
     try std.testing.expectError(error.NameTooLong, QueryObjectName(handle, out_buffer[0 .. required_len_in_u16 - 1]));
@@ -2045,8 +2045,8 @@ pub fn eqlIgnoreCaseUtf8(a: []const u8, b: []const u8) bool {
     };
 
     while (true) {
-        var a_cp = a_utf8_it.nextCodepoint() orelse break;
-        var b_cp = b_utf8_it.nextCodepoint() orelse return false;
+        const a_cp = a_utf8_it.nextCodepoint() orelse break;
+        const b_cp = b_utf8_it.nextCodepoint() orelse return false;
 
         if (a_cp <= std.math.maxInt(u16) and b_cp <= std.math.maxInt(u16)) {
             if (a_cp != b_cp and upcaseImpl(@intCast(a_cp)) != upcaseImpl(@intCast(b_cp))) {
lib/std/rand/test.zig
@@ -332,13 +332,13 @@ test "Random float chi-square goodness of fit" {
     while (i < num_numbers) : (i += 1) {
         const rand_f32 = random.float(f32);
         const rand_f64 = random.float(f64);
-        var f32_put = try f32_hist.getOrPut(@as(u32, @intFromFloat(rand_f32 * @as(f32, @floatFromInt(num_buckets)))));
+        const f32_put = try f32_hist.getOrPut(@as(u32, @intFromFloat(rand_f32 * @as(f32, @floatFromInt(num_buckets)))));
         if (f32_put.found_existing) {
             f32_put.value_ptr.* += 1;
         } else {
             f32_put.value_ptr.* = 1;
         }
-        var f64_put = try f64_hist.getOrPut(@as(u32, @intFromFloat(rand_f64 * @as(f64, @floatFromInt(num_buckets)))));
+        const f64_put = try f64_hist.getOrPut(@as(u32, @intFromFloat(rand_f64 * @as(f64, @floatFromInt(num_buckets)))));
         if (f64_put.found_existing) {
             f64_put.value_ptr.* += 1;
         } else {
lib/std/sort/block.zig
@@ -302,8 +302,8 @@ pub fn block(
             } else {
                 iterator.begin();
                 while (!iterator.finished()) {
-                    var A = iterator.nextRange();
-                    var B = iterator.nextRange();
+                    const A = iterator.nextRange();
+                    const B = iterator.nextRange();
 
                     if (lessThan(context, items[B.end - 1], items[A.start])) {
                         // the two ranges are in reverse order, so a simple rotation should fix it
lib/std/sort/pdq.zig
@@ -276,10 +276,10 @@ fn chosePivot(a: usize, b: usize, pivot: *usize, context: anytype) Hint {
     // max_swaps is the maximum number of swaps allowed in this function
     const max_swaps = 4 * 3;
 
-    var len = b - a;
-    var i = a + len / 4 * 1;
-    var j = a + len / 4 * 2;
-    var k = a + len / 4 * 3;
+    const len = b - a;
+    const i = a + len / 4 * 1;
+    const j = a + len / 4 * 2;
+    const k = a + len / 4 * 3;
     var swaps: usize = 0;
 
     if (len >= 8) {
lib/std/Thread/WaitGroup.zig
@@ -25,7 +25,7 @@ pub fn finish(self: *WaitGroup) void {
 }
 
 pub fn wait(self: *WaitGroup) void {
-    var state = self.state.fetchAdd(is_waiting, .Acquire);
+    const state = self.state.fetchAdd(is_waiting, .Acquire);
     assert(state & is_waiting == 0);
 
     if ((state / one_pending) > 0) {
lib/std/zig/system/NativeTargetInfo.zig
@@ -189,7 +189,7 @@ pub fn detect(cross_target: CrossTarget) DetectError!NativeTargetInfo {
     // native CPU architecture as being different than the current target), we use this:
     const cpu_arch = cross_target.getCpuArch();
 
-    var cpu = switch (cross_target.cpu_model) {
+    const cpu = switch (cross_target.cpu_model) {
         .native => detectNativeCpuAndFeatures(cpu_arch, os, cross_target),
         .baseline => Target.Cpu.baseline(cpu_arch),
         .determined_by_cpu_arch => if (cross_target.cpu_arch == null)
lib/std/zig/c_translation.zig
@@ -129,6 +129,7 @@ test "cast" {
     try testing.expectEqual(@as(?*anyopaque, @ptrFromInt(2)), cast(?*anyopaque, @as(*u8, @ptrFromInt(2))));
 
     var foo: c_int = -1;
+    _ = &foo;
     try testing.expect(cast(*anyopaque, -1) == @as(*anyopaque, @ptrFromInt(@as(usize, @bitCast(@as(isize, -1))))));
     try testing.expect(cast(*anyopaque, foo) == @as(*anyopaque, @ptrFromInt(@as(usize, @bitCast(@as(isize, -1))))));
     try testing.expect(cast(?*anyopaque, -1) == @as(?*anyopaque, @ptrFromInt(@as(usize, @bitCast(@as(isize, -1))))));
@@ -601,22 +602,22 @@ test "WL_CONTAINER_OF" {
         a: u32 = 0,
         b: u32 = 0,
     };
-    var x = S{};
-    var y = S{};
-    var ptr = Macros.WL_CONTAINER_OF(&x.b, &y, "b");
+    const x = S{};
+    const y = S{};
+    const ptr = Macros.WL_CONTAINER_OF(&x.b, &y, "b");
     try testing.expectEqual(&x, ptr);
 }
 
 test "CAST_OR_CALL casting" {
-    var arg = @as(c_int, 1000);
-    var casted = Macros.CAST_OR_CALL(u8, arg);
+    const arg: c_int = 1000;
+    const casted = Macros.CAST_OR_CALL(u8, arg);
     try testing.expectEqual(cast(u8, arg), casted);
 
     const S = struct {
         x: u32 = 0,
     };
-    var s = S{};
-    var casted_ptr = Macros.CAST_OR_CALL(*u8, &s);
+    var s: S = .{};
+    const casted_ptr = Macros.CAST_OR_CALL(*u8, &s);
     try testing.expectEqual(cast(*u8, &s), casted_ptr);
 }
 
lib/std/zig/Parse.zig
@@ -3516,7 +3516,6 @@ fn parsePtrModifiers(p: *Parse) !PtrModifiers {
     var saw_const = false;
     var saw_volatile = false;
     var saw_allowzero = false;
-    var saw_addrspace = false;
     while (true) {
         switch (p.token_tags[p.tok_i]) {
             .keyword_align => {
@@ -3557,7 +3556,7 @@ fn parsePtrModifiers(p: *Parse) !PtrModifiers {
                 saw_allowzero = true;
             },
             .keyword_addrspace => {
-                if (saw_addrspace) {
+                if (result.addrspace_node != 0) {
                     try p.warn(.extra_addrspace_qualifier);
                 }
                 result.addrspace_node = try p.parseAddrSpace();
lib/std/zig/perf_test.zig
@@ -32,7 +32,7 @@ pub fn main() !void {
 
 fn testOnce() usize {
     var fixed_buf_alloc = std.heap.FixedBufferAllocator.init(fixed_buffer_mem[0..]);
-    var allocator = fixed_buf_alloc.allocator();
+    const allocator = fixed_buf_alloc.allocator();
     _ = std.zig.Ast.parse(allocator, source, .zig) catch @panic("parse failure");
     return fixed_buf_alloc.end_index;
 }
lib/std/zig/render.zig
@@ -3495,7 +3495,7 @@ fn AutoIndentingStream(comptime UnderlyingWriter: type) type {
         /// Turns all one-shot indents into regular indents
         /// Returns number of indents that must now be manually popped
         pub fn lockOneShotIndent(self: *Self) usize {
-            var locked_count = self.indent_one_shot_count;
+            const locked_count = self.indent_one_shot_count;
             self.indent_one_shot_count = 0;
             return locked_count;
         }
lib/std/zig/string_literal.zig
@@ -288,7 +288,7 @@ test "parse" {
 
     var fixed_buf_mem: [64]u8 = undefined;
     var fixed_buf_alloc = std.heap.FixedBufferAllocator.init(&fixed_buf_mem);
-    var alloc = fixed_buf_alloc.allocator();
+    const alloc = fixed_buf_alloc.allocator();
 
     try expectError(error.InvalidLiteral, parseAlloc(alloc, "\"\\x6\""));
     try expect(eql(u8, "foo\nbar", try parseAlloc(alloc, "\"foo\\nbar\"")));
lib/std/array_hash_map.zig
@@ -2076,11 +2076,11 @@ test "iterator hash map" {
     try reset_map.putNoClobber(1, 22);
     try reset_map.putNoClobber(2, 33);
 
-    var keys = [_]i32{
+    const keys = [_]i32{
         0, 2, 1,
     };
 
-    var values = [_]i32{
+    const values = [_]i32{
         11, 33, 22,
     };
 
@@ -2116,7 +2116,7 @@ test "iterator hash map" {
     }
 
     it.reset();
-    var entry = it.next().?;
+    const entry = it.next().?;
     try testing.expect(entry.key_ptr.* == first_entry.key_ptr.*);
     try testing.expect(entry.value_ptr.* == first_entry.value_ptr.*);
 }
lib/std/array_list.zig
@@ -979,7 +979,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ
         pub fn ensureTotalCapacity(self: *Self, allocator: Allocator, new_capacity: usize) Allocator.Error!void {
             if (self.capacity >= new_capacity) return;
 
-            var better_capacity = growCapacity(self.capacity, new_capacity);
+            const better_capacity = growCapacity(self.capacity, new_capacity);
             return self.ensureTotalCapacityPrecise(allocator, better_capacity);
         }
 
@@ -1159,7 +1159,7 @@ test "std.ArrayList/ArrayListUnmanaged.init" {
     }
 
     {
-        var list = ArrayListUnmanaged(i32){};
+        const list = ArrayListUnmanaged(i32){};
 
         try testing.expect(list.items.len == 0);
         try testing.expect(list.capacity == 0);
lib/std/base64.zig
@@ -239,7 +239,7 @@ pub const Base64Decoder = struct {
             if ((bits & invalid_char_tst) != 0) return error.InvalidCharacter;
             std.mem.writeInt(u32, dest[dest_idx..][0..4], bits, .little);
         }
-        var remaining = source[fast_src_idx..];
+        const remaining = source[fast_src_idx..];
         for (remaining, fast_src_idx..) |c, src_idx| {
             const d = decoder.char_to_index[c];
             if (d == invalid_char) {
@@ -259,7 +259,7 @@ pub const Base64Decoder = struct {
             return error.InvalidPadding;
         }
         if (leftover_idx == null) return;
-        var leftover = source[leftover_idx.?..];
+        const leftover = source[leftover_idx.?..];
         if (decoder.pad_char) |pad_char| {
             const padding_len = acc_len / 2;
             var padding_chars: usize = 0;
@@ -338,7 +338,7 @@ pub const Base64DecoderWithIgnore = struct {
             if (decoder.pad_char != null and padding_len != 0) return error.InvalidPadding;
             return dest_idx;
         }
-        var leftover = source[leftover_idx.?..];
+        const leftover = source[leftover_idx.?..];
         if (decoder.pad_char) |pad_char| {
             var padding_chars: usize = 0;
             for (leftover) |c| {
@@ -483,7 +483,7 @@ fn testAllApis(codecs: Codecs, expected_decoded: []const u8, expected_encoded: [
     // Base64Decoder
     {
         var buffer: [0x100]u8 = undefined;
-        var decoded = buffer[0..try codecs.Decoder.calcSizeForSlice(expected_encoded)];
+        const decoded = buffer[0..try codecs.Decoder.calcSizeForSlice(expected_encoded)];
         try codecs.Decoder.decode(decoded, expected_encoded);
         try testing.expectEqualSlices(u8, expected_decoded, decoded);
     }
@@ -492,8 +492,8 @@ fn testAllApis(codecs: Codecs, expected_decoded: []const u8, expected_encoded: [
     {
         const decoder_ignore_nothing = codecs.decoderWithIgnore("");
         var buffer: [0x100]u8 = undefined;
-        var decoded = buffer[0..try decoder_ignore_nothing.calcSizeUpperBound(expected_encoded.len)];
-        var written = try decoder_ignore_nothing.decode(decoded, expected_encoded);
+        const decoded = buffer[0..try decoder_ignore_nothing.calcSizeUpperBound(expected_encoded.len)];
+        const written = try decoder_ignore_nothing.decode(decoded, expected_encoded);
         try testing.expect(written <= decoded.len);
         try testing.expectEqualSlices(u8, expected_decoded, decoded[0..written]);
     }
@@ -502,8 +502,8 @@ fn testAllApis(codecs: Codecs, expected_decoded: []const u8, expected_encoded: [
 fn testDecodeIgnoreSpace(codecs: Codecs, expected_decoded: []const u8, encoded: []const u8) !void {
     const decoder_ignore_space = codecs.decoderWithIgnore(" ");
     var buffer: [0x100]u8 = undefined;
-    var decoded = buffer[0..try decoder_ignore_space.calcSizeUpperBound(encoded.len)];
-    var written = try decoder_ignore_space.decode(decoded, encoded);
+    const decoded = buffer[0..try decoder_ignore_space.calcSizeUpperBound(encoded.len)];
+    const written = try decoder_ignore_space.decode(decoded, encoded);
     try testing.expectEqualSlices(u8, expected_decoded, decoded[0..written]);
 }
 
@@ -511,7 +511,7 @@ fn testError(codecs: Codecs, encoded: []const u8, expected_err: anyerror) !void
     const decoder_ignore_space = codecs.decoderWithIgnore(" ");
     var buffer: [0x100]u8 = undefined;
     if (codecs.Decoder.calcSizeForSlice(encoded)) |decoded_size| {
-        var decoded = buffer[0..decoded_size];
+        const decoded = buffer[0..decoded_size];
         if (codecs.Decoder.decode(decoded, encoded)) |_| {
             return error.ExpectedError;
         } else |err| if (err != expected_err) return err;
@@ -525,7 +525,7 @@ fn testError(codecs: Codecs, encoded: []const u8, expected_err: anyerror) !void
 fn testNoSpaceLeftError(codecs: Codecs, encoded: []const u8) !void {
     const decoder_ignore_space = codecs.decoderWithIgnore(" ");
     var buffer: [0x100]u8 = undefined;
-    var decoded = buffer[0 .. (try codecs.Decoder.calcSizeForSlice(encoded)) - 1];
+    const decoded = buffer[0 .. (try codecs.Decoder.calcSizeForSlice(encoded)) - 1];
     if (decoder_ignore_space.decode(decoded, encoded)) |_| {
         return error.ExpectedError;
     } else |err| if (err != error.NoSpaceLeft) return err;
@@ -534,7 +534,7 @@ fn testNoSpaceLeftError(codecs: Codecs, encoded: []const u8) !void {
 fn testFourBytesDestNoSpaceLeftError(codecs: Codecs, encoded: []const u8) !void {
     const decoder_ignore_space = codecs.decoderWithIgnore(" ");
     var buffer: [0x100]u8 = undefined;
-    var decoded = buffer[0..4];
+    const decoded = buffer[0..4];
     if (decoder_ignore_space.decode(decoded, encoded)) |_| {
         return error.ExpectedError;
     } else |err| if (err != error.NoSpaceLeft) return err;
lib/std/buf_map.zig
@@ -15,8 +15,7 @@ pub const BufMap = struct {
     /// That allocator will be used for both backing allocations
     /// and string deduplication.
     pub fn init(allocator: Allocator) BufMap {
-        var self = BufMap{ .hash_map = BufMapHashMap.init(allocator) };
-        return self;
+        return .{ .hash_map = BufMapHashMap.init(allocator) };
     }
 
     /// Free the backing storage of the map, as well as all
lib/std/buf_set.zig
@@ -17,8 +17,7 @@ pub const BufSet = struct {
     /// be used internally for both backing allocations and
     /// string duplication.
     pub fn init(a: Allocator) BufSet {
-        var self = BufSet{ .hash_map = BufSetHashMap.init(a) };
-        return self;
+        return .{ .hash_map = BufSetHashMap.init(a) };
     }
 
     /// Free a BufSet along with all stored keys.
@@ -76,8 +75,8 @@ pub const BufSet = struct {
         self: *const BufSet,
         new_allocator: Allocator,
     ) Allocator.Error!BufSet {
-        var cloned_hashmap = try self.hash_map.cloneWithAllocator(new_allocator);
-        var cloned = BufSet{ .hash_map = cloned_hashmap };
+        const cloned_hashmap = try self.hash_map.cloneWithAllocator(new_allocator);
+        const cloned = BufSet{ .hash_map = cloned_hashmap };
         var it = cloned.hash_map.keyIterator();
         while (it.next()) |key_ptr| {
             key_ptr.* = try cloned.copy(key_ptr.*);
@@ -134,7 +133,7 @@ test "BufSet clone" {
 }
 
 test "BufSet.clone with arena" {
-    var allocator = std.testing.allocator;
+    const allocator = std.testing.allocator;
     var arena = std.heap.ArenaAllocator.init(allocator);
     defer arena.deinit();
 
lib/std/builtin.zig
@@ -777,9 +777,8 @@ pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace, ret_addr
                     }
 
                     var fmt: [256]u8 = undefined;
-                    var slice = try std.fmt.bufPrint(&fmt, "\r\nerr: {s}\r\n", .{exit_msg});
-
-                    var len = try std.unicode.utf8ToUtf16Le(utf16, slice);
+                    const slice = try std.fmt.bufPrint(&fmt, "\r\nerr: {s}\r\n", .{exit_msg});
+                    const len = try std.unicode.utf8ToUtf16Le(utf16, slice);
 
                     utf16[len] = 0;
 
@@ -790,7 +789,7 @@ pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace, ret_addr
             };
 
             var exit_size: usize = 0;
-            var exit_data = ExitData.create_exit_data(msg, &exit_size) catch null;
+            const exit_data = ExitData.create_exit_data(msg, &exit_size) catch null;
 
             if (exit_data) |data| {
                 if (uefi.system_table.std_err) |out| {
lib/std/child_process.zig
@@ -847,7 +847,7 @@ pub const ChildProcess = struct {
             }
 
             windowsCreateProcessPathExt(self.allocator, &dir_buf, &app_buf, PATHEXT, cmd_line_w.ptr, envp_ptr, cwd_w_ptr, &siStartInfo, &piProcInfo) catch |no_path_err| {
-                var original_err = switch (no_path_err) {
+                const original_err = switch (no_path_err) {
                     error.FileNotFound, error.InvalidExe, error.AccessDenied => |e| e,
                     error.UnrecoverableInvalidExe => return error.InvalidExe,
                     else => |e| return e,
lib/std/coff.zig
@@ -1075,7 +1075,7 @@ pub const Coff = struct {
         var stream = std.io.fixedBufferStream(data);
         const reader = stream.reader();
         try stream.seekTo(pe_pointer_offset);
-        var coff_header_offset = try reader.readInt(u32, .little);
+        const coff_header_offset = try reader.readInt(u32, .little);
         try stream.seekTo(coff_header_offset);
         var buf: [4]u8 = undefined;
         try reader.readNoEof(&buf);
lib/std/debug.zig
@@ -812,7 +812,7 @@ pub fn writeStackTraceWindows(
     var addr_buf: [1024]usize = undefined;
     const n = walkStackWindows(addr_buf[0..], context);
     const addrs = addr_buf[0..n];
-    var start_i: usize = if (start_addr) |saddr| blk: {
+    const start_i: usize = if (start_addr) |saddr| blk: {
         for (addrs, 0..) |addr, i| {
             if (addr == saddr) break :blk i;
         }
@@ -1158,7 +1158,7 @@ pub fn readElfDebugInfo(
                 var zlib_stream = std.compress.zlib.decompressStream(allocator, section_stream.reader()) catch continue;
                 defer zlib_stream.deinit();
 
-                var decompressed_section = try allocator.alloc(u8, chdr.ch_size);
+                const decompressed_section = try allocator.alloc(u8, chdr.ch_size);
                 errdefer allocator.free(decompressed_section);
 
                 const read = zlib_stream.reader().readAll(decompressed_section) catch continue;
@@ -2046,7 +2046,7 @@ pub const ModuleDebugInfo = switch (native_os) {
             };
 
             try DW.openDwarfDebugInfo(&di, allocator);
-            var info = OFileInfo{
+            const info = OFileInfo{
                 .di = di,
                 .addr_table = addr_table,
             };
@@ -2122,7 +2122,7 @@ pub const ModuleDebugInfo = switch (native_os) {
 
                 // Check if its debug infos are already in the cache
                 const o_file_path = mem.sliceTo(self.strings[symbol.ofile..], 0);
-                var o_file_info = self.ofiles.getPtr(o_file_path) orelse
+                const o_file_info = self.ofiles.getPtr(o_file_path) orelse
                     (self.loadOFile(allocator, o_file_path) catch |err| switch (err) {
                     error.FileNotFound,
                     error.MissingDebugInfo,
lib/std/dwarf.zig
@@ -622,7 +622,7 @@ fn parseFormValue(allocator: mem.Allocator, in_stream: anytype, form_id: u64, en
                 return parseFormValue(allocator, in_stream, child_form_id, endian, is_64);
             }
             const F = @TypeOf(async parseFormValue(allocator, in_stream, child_form_id, endian, is_64));
-            var frame = try allocator.create(F);
+            const frame = try allocator.create(F);
             defer allocator.destroy(frame);
             return await @asyncCall(frame, {}, parseFormValue, .{ allocator, in_stream, child_form_id, endian, is_64 });
         },
@@ -1034,7 +1034,7 @@ pub const DwarfInfo = struct {
             // specified by DW_AT.low_pc or to some other value encoded
             // in the list itself.
             // If no starting value is specified use zero.
-            var base_address = compile_unit.die.getAttrAddr(di, AT.low_pc, compile_unit.*) catch |err| switch (err) {
+            const base_address = compile_unit.die.getAttrAddr(di, AT.low_pc, compile_unit.*) catch |err| switch (err) {
                 error.MissingDebugInfo => @as(u64, 0), // TODO https://github.com/ziglang/zig/issues/11135
                 else => return err,
             };
@@ -1438,7 +1438,7 @@ pub const DwarfInfo = struct {
             if (opcode == LNS.extended_op) {
                 const op_size = try leb.readULEB128(u64, in);
                 if (op_size < 1) return badDwarf();
-                var sub_op = try in.readByte();
+                const sub_op = try in.readByte();
                 switch (sub_op) {
                     LNE.end_sequence => {
                         prog.end_sequence = true;
@@ -2308,7 +2308,7 @@ fn readEhPointer(reader: anytype, enc: u8, addr_size_bytes: u8, ctx: EhPointerCo
         else => return badDwarf(),
     };
 
-    var base = switch (enc & EH.PE.rel_mask) {
+    const base = switch (enc & EH.PE.rel_mask) {
         EH.PE.pcrel => ctx.pc_rel_base,
         EH.PE.textrel => ctx.text_rel_base orelse return error.PointerBaseNotSpecified,
         EH.PE.datarel => ctx.data_rel_base orelse return error.PointerBaseNotSpecified,
@@ -2624,7 +2624,7 @@ pub const CommonInformationEntry = struct {
         var has_aug_data = false;
 
         var aug_str_len: usize = 0;
-        var aug_str_start = stream.pos;
+        const aug_str_start = stream.pos;
         var aug_byte = try reader.readByte();
         while (aug_byte != 0) : (aug_byte = try reader.readByte()) {
             switch (aug_byte) {
lib/std/enums.zig
@@ -123,6 +123,7 @@ pub fn directEnumArray(
 test "std.enums.directEnumArray" {
     const E = enum(i4) { a = 4, b = 6, c = 2 };
     var runtime_false: bool = false;
+    _ = &runtime_false;
     const array = directEnumArray(E, bool, 4, .{
         .a = true,
         .b = runtime_false,
@@ -165,6 +166,7 @@ pub fn directEnumArrayDefault(
 test "std.enums.directEnumArrayDefault" {
     const E = enum(i4) { a = 4, b = 6, c = 2 };
     var runtime_false: bool = false;
+    _ = &runtime_false;
     const array = directEnumArrayDefault(E, bool, false, 4, .{
         .a = true,
         .b = runtime_false,
@@ -179,6 +181,7 @@ test "std.enums.directEnumArrayDefault" {
 test "std.enums.directEnumArrayDefault slice" {
     const E = enum(i4) { a = 4, b = 6, c = 2 };
     var runtime_b = "b";
+    _ = &runtime_b;
     const array = directEnumArrayDefault(E, []const u8, "default", 4, .{
         .a = "a",
         .b = runtime_b,
@@ -196,7 +199,7 @@ pub fn nameCast(comptime E: type, comptime value: anytype) E {
     return comptime blk: {
         const V = @TypeOf(value);
         if (V == E) break :blk value;
-        var name: ?[]const u8 = switch (@typeInfo(V)) {
+        const name: ?[]const u8 = switch (@typeInfo(V)) {
             .EnumLiteral, .Enum => @tagName(value),
             .Pointer => if (std.meta.trait.isZigString(V)) value else null,
             else => null,
lib/std/fmt.zig
@@ -1296,10 +1296,10 @@ pub fn formatFloatDecimal(
         errol.roundToPrecision(&float_decimal, precision, errol.RoundMode.Decimal);
 
         // exp < 0 means the leading is always 0 as errol result is normalized.
-        var num_digits_whole = if (float_decimal.exp > 0) @as(usize, @intCast(float_decimal.exp)) else 0;
+        const num_digits_whole = if (float_decimal.exp > 0) @as(usize, @intCast(float_decimal.exp)) else 0;
 
         // the actual slice into the buffer, we may need to zero-pad between num_digits_whole and this.
-        var num_digits_whole_no_pad = @min(num_digits_whole, float_decimal.digits.len);
+        const num_digits_whole_no_pad = @min(num_digits_whole, float_decimal.digits.len);
 
         if (num_digits_whole > 0) {
             // We may have to zero pad, for instance 1e4 requires zero padding.
@@ -1354,10 +1354,10 @@ pub fn formatFloatDecimal(
         }
     } else {
         // exp < 0 means the leading is always 0 as errol result is normalized.
-        var num_digits_whole = if (float_decimal.exp > 0) @as(usize, @intCast(float_decimal.exp)) else 0;
+        const num_digits_whole = if (float_decimal.exp > 0) @as(usize, @intCast(float_decimal.exp)) else 0;
 
         // the actual slice into the buffer, we may need to zero-pad between num_digits_whole and this.
-        var num_digits_whole_no_pad = @min(num_digits_whole, float_decimal.digits.len);
+        const num_digits_whole_no_pad = @min(num_digits_whole, float_decimal.digits.len);
 
         if (num_digits_whole > 0) {
             // We may have to zero pad, for instance 1e4 requires zero padding.
@@ -2218,6 +2218,7 @@ test "slice" {
     }
     {
         var runtime_zero: usize = 0;
+        _ = &runtime_zero;
         const value = @as([*]align(1) const []const u8, @ptrFromInt(0xdeadbeef))[runtime_zero..runtime_zero];
         try expectFmt("slice: []const u8@deadbeef\n", "slice: {*}\n", .{value});
     }
@@ -2232,6 +2233,7 @@ test "slice" {
     {
         var int_slice = [_]u32{ 1, 4096, 391891, 1111111111 };
         var runtime_zero: usize = 0;
+        _ = &runtime_zero;
         try expectFmt("int: { 1, 4096, 391891, 1111111111 }", "int: {any}", .{int_slice[runtime_zero..]});
         try expectFmt("int: { 1, 4096, 391891, 1111111111 }", "int: {d}", .{int_slice[runtime_zero..]});
         try expectFmt("int: { 1, 1000, 5fad3, 423a35c7 }", "int: {x}", .{int_slice[runtime_zero..]});
@@ -2794,14 +2796,14 @@ test "padding" {
 }
 
 test "decimal float padding" {
-    var number: f32 = 3.1415;
+    const number: f32 = 3.1415;
     try expectFmt("left-pad:   **3.141\n", "left-pad:   {d:*>7.3}\n", .{number});
     try expectFmt("center-pad: *3.141*\n", "center-pad: {d:*^7.3}\n", .{number});
     try expectFmt("right-pad:  3.141**\n", "right-pad:  {d:*<7.3}\n", .{number});
 }
 
 test "sci float padding" {
-    var number: f32 = 3.1415;
+    const number: f32 = 3.1415;
     try expectFmt("left-pad:   **3.141e+00\n", "left-pad:   {e:*>11.3}\n", .{number});
     try expectFmt("center-pad: *3.141e+00*\n", "center-pad: {e:*^11.3}\n", .{number});
     try expectFmt("right-pad:  3.141e+00**\n", "right-pad:  {e:*<11.3}\n", .{number});
@@ -2825,7 +2827,7 @@ test "named arguments" {
 }
 
 test "runtime width specifier" {
-    var width: usize = 9;
+    const width: usize = 9;
     try expectFmt("~~hello~~", "{s:~^[1]}", .{ "hello", width });
     try expectFmt("~~hello~~", "{s:~^[width]}", .{ .string = "hello", .width = width });
     try expectFmt("    hello", "{s:[1]}", .{ "hello", width });
@@ -2833,8 +2835,8 @@ test "runtime width specifier" {
 }
 
 test "runtime precision specifier" {
-    var number: f32 = 3.1415;
-    var precision: usize = 2;
+    const number: f32 = 3.1415;
+    const precision: usize = 2;
     try expectFmt("3.14e+00", "{:1.[1]}", .{ number, precision });
     try expectFmt("3.14e+00", "{:1.[precision]}", .{ .number = number, .precision = precision });
 }
lib/std/fs.zig
@@ -1689,7 +1689,7 @@ pub const Dir = struct {
         }
         if (builtin.os.tag == .windows) {
             var dir_path_buffer: [os.windows.PATH_MAX_WIDE]u16 = undefined;
-            var dir_path = try os.windows.GetFinalPathNameByHandle(self.fd, .{}, &dir_path_buffer);
+            const dir_path = try os.windows.GetFinalPathNameByHandle(self.fd, .{}, &dir_path_buffer);
             if (builtin.link_libc) {
                 return os.chdirW(dir_path);
             }
@@ -1810,7 +1810,7 @@ pub const Dir = struct {
         const base_flags = w.STANDARD_RIGHTS_READ | w.FILE_READ_ATTRIBUTES | w.FILE_READ_EA |
             w.SYNCHRONIZE | w.FILE_TRAVERSE;
         const flags: u32 = if (iterable) base_flags | w.FILE_LIST_DIRECTORY else base_flags;
-        var dir = try self.makeOpenDirAccessMaskW(sub_path_w, flags, .{
+        const dir = try self.makeOpenDirAccessMaskW(sub_path_w, flags, .{
             .no_follow = args.no_follow,
             .create_disposition = w.FILE_OPEN,
         });
lib/std/hash_map.zig
@@ -1484,8 +1484,8 @@ pub fn HashMapUnmanaged(
 
             var i: Size = 0;
             var metadata = self.metadata.?;
-            var keys_ptr = self.keys();
-            var values_ptr = self.values();
+            const keys_ptr = self.keys();
+            const values_ptr = self.values();
             while (i < self.capacity()) : (i += 1) {
                 if (metadata[i].isUsed()) {
                     other.putAssumeCapacityNoClobberContext(keys_ptr[i], values_ptr[i], new_ctx);
@@ -1521,8 +1521,8 @@ pub fn HashMapUnmanaged(
                 const old_capacity = self.capacity();
                 var i: Size = 0;
                 var metadata = self.metadata.?;
-                var keys_ptr = self.keys();
-                var values_ptr = self.values();
+                const keys_ptr = self.keys();
+                const values_ptr = self.values();
                 while (i < old_capacity) : (i += 1) {
                     if (metadata[i].isUsed()) {
                         map.putAssumeCapacityNoClobberContext(keys_ptr[i], values_ptr[i], ctx);
lib/std/heap.zig
@@ -81,10 +81,10 @@ const CAllocator = struct {
         // Thin wrapper around regular malloc, overallocate to account for
         // alignment padding and store the original malloc()'ed pointer before
         // the aligned address.
-        var unaligned_ptr = @as([*]u8, @ptrCast(c.malloc(len + alignment - 1 + @sizeOf(usize)) orelse return null));
+        const unaligned_ptr = @as([*]u8, @ptrCast(c.malloc(len + alignment - 1 + @sizeOf(usize)) orelse return null));
         const unaligned_addr = @intFromPtr(unaligned_ptr);
         const aligned_addr = mem.alignForward(usize, unaligned_addr + @sizeOf(usize), alignment);
-        var aligned_ptr = unaligned_ptr + (aligned_addr - unaligned_addr);
+        const aligned_ptr = unaligned_ptr + (aligned_addr - unaligned_addr);
         getHeader(aligned_ptr).* = unaligned_ptr;
 
         return aligned_ptr;
@@ -661,12 +661,12 @@ test "FixedBufferAllocator.reset" {
     const X = 0xeeeeeeeeeeeeeeee;
     const Y = 0xffffffffffffffff;
 
-    var x = try allocator.create(u64);
+    const x = try allocator.create(u64);
     x.* = X;
     try testing.expectError(error.OutOfMemory, allocator.create(u64));
 
     fba.reset();
-    var y = try allocator.create(u64);
+    const y = try allocator.create(u64);
     y.* = Y;
 
     // we expect Y to have overwritten X.
@@ -691,9 +691,9 @@ test "FixedBufferAllocator Reuse memory on realloc" {
         var fixed_buffer_allocator = FixedBufferAllocator.init(small_fixed_buffer[0..]);
         const allocator = fixed_buffer_allocator.allocator();
 
-        var slice0 = try allocator.alloc(u8, 5);
+        const slice0 = try allocator.alloc(u8, 5);
         try testing.expect(slice0.len == 5);
-        var slice1 = try allocator.realloc(slice0, 10);
+        const slice1 = try allocator.realloc(slice0, 10);
         try testing.expect(slice1.ptr == slice0.ptr);
         try testing.expect(slice1.len == 10);
         try testing.expectError(error.OutOfMemory, allocator.realloc(slice1, 11));
@@ -706,8 +706,8 @@ test "FixedBufferAllocator Reuse memory on realloc" {
         var slice0 = try allocator.alloc(u8, 2);
         slice0[0] = 1;
         slice0[1] = 2;
-        var slice1 = try allocator.alloc(u8, 2);
-        var slice2 = try allocator.realloc(slice0, 4);
+        const slice1 = try allocator.alloc(u8, 2);
+        const slice2 = try allocator.realloc(slice0, 4);
         try testing.expect(slice0.ptr != slice2.ptr);
         try testing.expect(slice1.ptr != slice2.ptr);
         try testing.expect(slice2[0] == 1);
@@ -757,7 +757,7 @@ pub fn testAllocator(base_allocator: mem.Allocator) !void {
     allocator.free(slice);
 
     // Zero-length allocation
-    var empty = try allocator.alloc(u8, 0);
+    const empty = try allocator.alloc(u8, 0);
     allocator.free(empty);
     // Allocation with zero-sized types
     const zero_bit_ptr = try allocator.create(u0);
lib/std/math.zig
@@ -427,6 +427,7 @@ test "clamp" {
 
     // Mix of comptime and non-comptime
     var i: i32 = 1;
+    _ = &i;
     try testing.expect(std.math.clamp(i, 0, 1) == 1);
 }
 
@@ -1113,7 +1114,7 @@ pub fn ceilPowerOfTwo(comptime T: type, value: T) (error{Overflow}!T) {
     comptime assert(info.signedness == .unsigned);
     const PromotedType = std.meta.Int(info.signedness, info.bits + 1);
     const overflowBit = @as(PromotedType, 1) << info.bits;
-    var x = ceilPowerOfTwoPromote(T, value);
+    const x = ceilPowerOfTwoPromote(T, value);
     if (overflowBit & x != 0) {
         return error.Overflow;
     }
lib/std/mem.zig
@@ -403,11 +403,11 @@ test "zeroes" {
         b: u32,
     };
 
-    var c = zeroes(C_union);
+    const c = zeroes(C_union);
     try testing.expectEqual(@as(u8, 0), c.a);
     try testing.expectEqual(@as(u32, 0), c.b);
 
-    comptime var comptime_union = zeroes(C_union);
+    const comptime_union = comptime zeroes(C_union);
     try testing.expectEqual(@as(u8, 0), comptime_union.a);
     try testing.expectEqual(@as(u32, 0), comptime_union.b);
 
@@ -3399,7 +3399,7 @@ test "reverseIterator" {
         try testing.expectEqual(@as(?i32, 3), it.nextPtr().?.*);
         try testing.expectEqual(@as(?*const i32, null), it.nextPtr());
 
-        var mut_slice: []i32 = &array;
+        const mut_slice: []i32 = &array;
         var mut_it = reverseIterator(mut_slice);
         mut_it.nextPtr().?.* += 1;
         mut_it.nextPtr().?.* += 2;
@@ -3419,7 +3419,7 @@ test "reverseIterator" {
         try testing.expectEqual(@as(?i32, 3), it.nextPtr().?.*);
         try testing.expectEqual(@as(?*const i32, null), it.nextPtr());
 
-        var mut_ptr_to_array: *[2]i32 = &array;
+        const mut_ptr_to_array: *[2]i32 = &array;
         var mut_it = reverseIterator(mut_ptr_to_array);
         mut_it.nextPtr().?.* += 1;
         mut_it.nextPtr().?.* += 2;
@@ -3581,7 +3581,7 @@ test "replacementSize" {
 
 /// Perform a replacement on an allocated buffer of pre-determined size. Caller must free returned memory.
 pub fn replaceOwned(comptime T: type, allocator: Allocator, input: []const T, needle: []const T, replacement: []const T) Allocator.Error![]T {
-    var output = try allocator.alloc(T, replacementSize(T, input, needle, replacement));
+    const output = try allocator.alloc(T, replacementSize(T, input, needle, replacement));
     _ = replace(T, input, needle, replacement, output);
     return output;
 }
@@ -3693,8 +3693,8 @@ pub fn alignPointer(ptr: anytype, align_to: usize) ?@TypeOf(ptr) {
 test "alignPointer" {
     const S = struct {
         fn checkAlign(comptime T: type, base: usize, align_to: usize, expected: usize) !void {
-            var ptr = @as(T, @ptrFromInt(base));
-            var aligned = alignPointer(ptr, align_to);
+            const ptr: T = @ptrFromInt(base);
+            const aligned = alignPointer(ptr, align_to);
             try testing.expectEqual(expected, @intFromPtr(aligned));
         }
     };
@@ -3848,7 +3848,7 @@ test "bytesAsValue" {
         .big => "\xC0\xDE\xFA\xCE",
         .little => "\xCE\xFA\xDE\xC0",
     }.*;
-    var codeface = bytesAsValue(u32, &codeface_bytes);
+    const codeface = bytesAsValue(u32, &codeface_bytes);
     try testing.expect(codeface.* == 0xC0DEFACE);
     codeface.* = 0;
     for (codeface_bytes) |b|
@@ -3941,6 +3941,7 @@ test "bytesAsSlice" {
     {
         const bytes = [_]u8{ 0xDE, 0xAD, 0xBE, 0xEF };
         var runtime_zero: usize = 0;
+        _ = &runtime_zero;
         const slice = bytesAsSlice(u16, bytes[runtime_zero..]);
         try testing.expect(slice.len == 2);
         try testing.expect(bigToNative(u16, slice[0]) == 0xDEAD);
@@ -3957,6 +3958,7 @@ test "bytesAsSlice keeps pointer alignment" {
     {
         var bytes = [_]u8{ 0x01, 0x02, 0x03, 0x04 };
         var runtime_zero: usize = 0;
+        _ = &runtime_zero;
         const numbers = bytesAsSlice(u32, bytes[runtime_zero..]);
         try comptime testing.expect(@TypeOf(numbers) == []align(@alignOf(@TypeOf(bytes))) u32);
     }
@@ -3967,8 +3969,8 @@ test "bytesAsSlice on a packed struct" {
         a: u8,
     };
 
-    var b = [1]u8{9};
-    var f = bytesAsSlice(F, &b);
+    const b: [1]u8 = .{9};
+    const f = bytesAsSlice(F, &b);
     try testing.expect(f[0].a == 9);
 }
 
@@ -4120,8 +4122,7 @@ pub const alignForwardGeneric = @compileError("renamed to alignForward");
 /// result eventually gets discarded.
 // TODO: use @declareSideEffect() when it is available - https://github.com/ziglang/zig/issues/6168
 pub fn doNotOptimizeAway(val: anytype) void {
-    var a: u8 = 0;
-    if (@typeInfo(@TypeOf(.{a})).Struct.fields[0].is_comptime) return;
+    if (@inComptime()) return;
 
     const max_gp_register_bits = @bitSizeOf(c_long);
     const t = @typeInfo(@TypeOf(val));
lib/std/meta.zig
@@ -738,7 +738,7 @@ test "std.meta.TagPayload" {
         },
     };
     const MovedEvent = TagPayload(Event, Event.Moved);
-    var e: Event = undefined;
+    const e: Event = .{ .Moved = undefined };
     try testing.expect(MovedEvent == @TypeOf(e.Moved));
 }
 
@@ -839,9 +839,9 @@ test "std.meta.eql" {
     try testing.expect(eql(u_1, u_3));
     try testing.expect(!eql(u_1, u_2));
 
-    var a1 = "abcdef".*;
-    var a2 = "abcdef".*;
-    var a3 = "ghijkl".*;
+    const a1 = "abcdef".*;
+    const a2 = "abcdef".*;
+    const a3 = "ghijkl".*;
 
     try testing.expect(eql(a1, a2));
     try testing.expect(!eql(a1, a3));
@@ -859,9 +859,9 @@ test "std.meta.eql" {
     try testing.expect(!eql(EU.tst(false), EU.tst(true)));
 
     const V = @Vector(4, u32);
-    var v1: V = @splat(1);
-    var v2: V = @splat(1);
-    var v3: V = @splat(2);
+    const v1: V = @splat(1);
+    const v2: V = @splat(1);
+    const v3: V = @splat(2);
 
     try testing.expect(eql(v1, v2));
     try testing.expect(!eql(v1, v3));
@@ -879,6 +879,8 @@ test "intToEnum with error return" {
 
     var zero: u8 = 0;
     var one: u16 = 1;
+    _ = &zero;
+    _ = &one;
     try testing.expect(intToEnum(E1, zero) catch unreachable == E1.A);
     try testing.expect(intToEnum(E2, one) catch unreachable == E2.B);
     try testing.expect(intToEnum(E3, zero) catch unreachable == E3.A);
lib/std/net.zig
@@ -662,7 +662,7 @@ pub fn connectUnixSocket(path: []const u8) !Stream {
 fn if_nametoindex(name: []const u8) !u32 {
     if (builtin.target.os.tag == .linux) {
         var ifr: os.ifreq = undefined;
-        var sockfd = try os.socket(os.AF.UNIX, os.SOCK.DGRAM | os.SOCK.CLOEXEC, 0);
+        const sockfd = try os.socket(os.AF.UNIX, os.SOCK.DGRAM | os.SOCK.CLOEXEC, 0);
         defer os.closeSocket(sockfd);
 
         @memcpy(ifr.ifrn.name[0..name.len], name);
@@ -1375,7 +1375,7 @@ fn linuxLookupNameFromDns(
     rc: ResolvConf,
     port: u16,
 ) !void {
-    var ctx = dpc_ctx{
+    const ctx = dpc_ctx{
         .addrs = addrs,
         .canon = canon,
         .port = port,
@@ -1591,8 +1591,8 @@ fn resMSendRc(
     }};
     const retry_interval = timeout / attempts;
     var next: u32 = 0;
-    var t2: u64 = @as(u64, @bitCast(std.time.milliTimestamp()));
-    var t0 = t2;
+    var t2: u64 = @bitCast(std.time.milliTimestamp());
+    const t0 = t2;
     var t1 = t2 - retry_interval;
 
     var servfail_retry: usize = undefined;
lib/std/os.zig
@@ -4642,7 +4642,7 @@ pub fn faccessat(dirfd: fd_t, path: []const u8, mode: u32, flags: u32) AccessErr
         const path_w = try windows.sliceToPrefixedFileW(dirfd, path);
         return faccessatW(dirfd, path_w.span().ptr, mode, flags);
     } else if (builtin.os.tag == .wasi and !builtin.link_libc) {
-        var resolved = RelativePathWasi{ .dir_fd = dirfd, .relative_path = path };
+        const resolved = RelativePathWasi{ .dir_fd = dirfd, .relative_path = path };
 
         const file = blk: {
             break :blk fstatat(dirfd, path, flags);
@@ -4775,7 +4775,7 @@ pub fn pipe2(flags: u32) PipeError![2]fd_t {
         }
     }
 
-    var fds: [2]fd_t = try pipe();
+    const fds: [2]fd_t = try pipe();
     errdefer {
         close(fds[0]);
         close(fds[1]);
@@ -6709,7 +6709,7 @@ pub fn dn_expand(
         // loop invariants: p<end, dest<dend
         if ((p[0] & 0xc0) != 0) {
             if (p + 1 == end) return error.InvalidDnsPacket;
-            var j = ((p[0] & @as(usize, 0x3f)) << 8) | p[1];
+            const j = ((p[0] & @as(usize, 0x3f)) << 8) | p[1];
             if (len == std.math.maxInt(usize)) len = @intFromPtr(p) + 2 - @intFromPtr(comp_dn.ptr);
             if (j >= msg.len) return error.InvalidDnsPacket;
             p = msg.ptr + j;
@@ -7285,7 +7285,7 @@ pub const TimerFdGetError = error{InvalidHandle} || UnexpectedError;
 pub const TimerFdSetError = TimerFdGetError || error{Canceled};
 
 pub fn timerfd_create(clokid: i32, flags: u32) TimerFdCreateError!fd_t {
-    var rc = linux.timerfd_create(clokid, flags);
+    const rc = linux.timerfd_create(clokid, flags);
     return switch (errno(rc)) {
         .SUCCESS => @as(fd_t, @intCast(rc)),
         .INVAL => unreachable,
@@ -7299,7 +7299,7 @@ pub fn timerfd_create(clokid: i32, flags: u32) TimerFdCreateError!fd_t {
 }
 
 pub fn timerfd_settime(fd: i32, flags: u32, new_value: *const linux.itimerspec, old_value: ?*linux.itimerspec) TimerFdSetError!void {
-    var rc = linux.timerfd_settime(fd, flags, new_value, old_value);
+    const rc = linux.timerfd_settime(fd, flags, new_value, old_value);
     return switch (errno(rc)) {
         .SUCCESS => {},
         .BADF => error.InvalidHandle,
@@ -7312,7 +7312,7 @@ pub fn timerfd_settime(fd: i32, flags: u32, new_value: *const linux.itimerspec,
 
 pub fn timerfd_gettime(fd: i32) TimerFdGetError!linux.itimerspec {
     var curr_value: linux.itimerspec = undefined;
-    var rc = linux.timerfd_gettime(fd, &curr_value);
+    const rc = linux.timerfd_gettime(fd, &curr_value);
     return switch (errno(rc)) {
         .SUCCESS => return curr_value,
         .BADF => error.InvalidHandle,
lib/std/pdb.zig
@@ -897,7 +897,7 @@ const Msf = struct {
             return error.UnhandledBigDirectoryStream; // cf. BlockMapAddr comment.
 
         try file.seekTo(superblock.BlockSize * superblock.BlockMapAddr);
-        var dir_blocks = try allocator.alloc(u32, dir_block_count);
+        const dir_blocks = try allocator.alloc(u32, dir_block_count);
         for (dir_blocks) |*b| {
             b.* = try in.readInt(u32, .little);
         }
lib/std/priority_dequeue.zig
@@ -82,8 +82,8 @@ pub fn PriorityDequeue(comptime T: type, comptime Context: type, comptime compar
         };
 
         fn getStartForSiftUp(self: Self, child: T, index: usize) StartIndexAndLayer {
-            var child_index = index;
-            var parent_index = parentIndex(child_index);
+            const child_index = index;
+            const parent_index = parentIndex(child_index);
             const parent = self.items[parent_index];
 
             const min_layer = self.nextIsMinLayer();
@@ -115,7 +115,7 @@ pub fn PriorityDequeue(comptime T: type, comptime Context: type, comptime compar
         fn doSiftUp(self: *Self, start_index: usize, target_order: Order) void {
             var child_index = start_index;
             while (child_index > 2) {
-                var grandparent_index = grandparentIndex(child_index);
+                const grandparent_index = grandparentIndex(child_index);
                 const child = self.items[child_index];
                 const grandparent = self.items[grandparent_index];
 
@@ -286,8 +286,8 @@ pub fn PriorityDequeue(comptime T: type, comptime Context: type, comptime compar
         }
 
         fn bestItemAtIndices(self: Self, index1: usize, index2: usize, target_order: Order) ItemAndIndex {
-            var item1 = self.getItem(index1);
-            var item2 = self.getItem(index2);
+            const item1 = self.getItem(index1);
+            const item2 = self.getItem(index2);
             return self.bestItem(item1, item2, target_order);
         }
 
lib/std/priority_queue.zig
@@ -470,7 +470,7 @@ test "std.PriorityQueue: remove at index" {
             break idx;
         idx += 1;
     } else unreachable;
-    var sorted_items = [_]u32{ 1, 3, 4, 5, 8, 9 };
+    const sorted_items = [_]u32{ 1, 3, 4, 5, 8, 9 };
     try expectEqual(queue.removeIndex(two_idx), 2);
 
     var i: usize = 0;
lib/std/process.zig
@@ -298,9 +298,9 @@ pub fn getEnvMap(allocator: Allocator) !EnvMap {
             return result;
         }
 
-        var environ = try allocator.alloc([*:0]u8, environ_count);
+        const environ = try allocator.alloc([*:0]u8, environ_count);
         defer allocator.free(environ);
-        var environ_buf = try allocator.alloc(u8, environ_buf_size);
+        const environ_buf = try allocator.alloc(u8, environ_buf_size);
         defer allocator.free(environ_buf);
 
         const environ_get_ret = os.wasi.environ_get(environ.ptr, environ_buf.ptr);
@@ -412,7 +412,7 @@ pub fn hasEnvVar(allocator: Allocator, key: []const u8) error{OutOfMemory}!bool
 }
 
 test "os.getEnvVarOwned" {
-    var ga = std.testing.allocator;
+    const ga = std.testing.allocator;
     try testing.expectError(error.EnvironmentVariableNotFound, getEnvVarOwned(ga, "BADENV"));
 }
 
@@ -477,10 +477,10 @@ pub const ArgIteratorWasi = struct {
             return &[_][:0]u8{};
         }
 
-        var argv = try allocator.alloc([*:0]u8, count);
+        const argv = try allocator.alloc([*:0]u8, count);
         defer allocator.free(argv);
 
-        var argv_buf = try allocator.alloc(u8, buf_size);
+        const argv_buf = try allocator.alloc(u8, buf_size);
 
         switch (w.args_get(argv.ptr, argv_buf.ptr)) {
             .SUCCESS => {},
@@ -551,7 +551,7 @@ pub fn ArgIteratorGeneral(comptime options: ArgIteratorGeneralOptions) type {
 
         /// cmd_line_utf8 MUST remain valid and constant while using this instance
         pub fn init(allocator: Allocator, cmd_line_utf8: []const u8) InitError!Self {
-            var buffer = try allocator.alloc(u8, cmd_line_utf8.len + 1);
+            const buffer = try allocator.alloc(u8, cmd_line_utf8.len + 1);
             errdefer allocator.free(buffer);
 
             return Self{
@@ -564,7 +564,7 @@ pub fn ArgIteratorGeneral(comptime options: ArgIteratorGeneralOptions) type {
 
         /// cmd_line_utf8 will be free'd (with the allocator) on deinit()
         pub fn initTakeOwnership(allocator: Allocator, cmd_line_utf8: []const u8) InitError!Self {
-            var buffer = try allocator.alloc(u8, cmd_line_utf8.len + 1);
+            const buffer = try allocator.alloc(u8, cmd_line_utf8.len + 1);
             errdefer allocator.free(buffer);
 
             return Self{
@@ -577,8 +577,8 @@ pub fn ArgIteratorGeneral(comptime options: ArgIteratorGeneralOptions) type {
 
         /// cmd_line_utf16le MUST be encoded UTF16-LE, and is converted to UTF-8 in an internal buffer
         pub fn initUtf16le(allocator: Allocator, cmd_line_utf16le: [*:0]const u16) InitUtf16leError!Self {
-            var utf16le_slice = mem.sliceTo(cmd_line_utf16le, 0);
-            var cmd_line = std.unicode.utf16leToUtf8Alloc(allocator, utf16le_slice) catch |err| switch (err) {
+            const utf16le_slice = mem.sliceTo(cmd_line_utf16le, 0);
+            const cmd_line = std.unicode.utf16leToUtf8Alloc(allocator, utf16le_slice) catch |err| switch (err) {
                 error.ExpectedSecondSurrogateHalf,
                 error.DanglingSurrogateHalf,
                 error.UnexpectedSecondSurrogateHalf,
@@ -588,7 +588,7 @@ pub fn ArgIteratorGeneral(comptime options: ArgIteratorGeneralOptions) type {
             };
             errdefer allocator.free(cmd_line);
 
-            var buffer = try allocator.alloc(u8, cmd_line.len + 1);
+            const buffer = try allocator.alloc(u8, cmd_line.len + 1);
             errdefer allocator.free(buffer);
 
             return Self{
@@ -681,7 +681,7 @@ pub fn ArgIteratorGeneral(comptime options: ArgIteratorGeneralOptions) type {
                     0 => {
                         self.emitBackslashes(backslash_count);
                         self.buffer[self.end] = 0;
-                        var token = self.buffer[self.start..self.end :0];
+                        const token = self.buffer[self.start..self.end :0];
                         self.end += 1;
                         self.start = self.end;
                         return token;
@@ -713,7 +713,7 @@ pub fn ArgIteratorGeneral(comptime options: ArgIteratorGeneralOptions) type {
                             self.emitCharacter(character);
                         } else {
                             self.buffer[self.end] = 0;
-                            var token = self.buffer[self.start..self.end :0];
+                            const token = self.buffer[self.start..self.end :0];
                             self.end += 1;
                             self.start = self.end;
                             return token;
lib/std/Progress.zig
@@ -397,6 +397,7 @@ fn bufWrite(self: *Progress, end: *usize, comptime format: []const u8, args: any
 
 test "basic functionality" {
     var disable = true;
+    _ = &disable;
     if (disable) {
         // This test is disabled because it uses time.sleep() and is therefore slow. It also
         // prints bogus progress data to stderr.
lib/std/sort.zig
@@ -387,7 +387,7 @@ test "sort fuzz testing" {
         var i: usize = 0;
         while (i < test_case_count) : (i += 1) {
             const array_size = random.intRangeLessThan(usize, 0, 1000);
-            var array = try testing.allocator.alloc(i32, array_size);
+            const array = try testing.allocator.alloc(i32, array_size);
             defer testing.allocator.free(array);
             // populate with random data
             for (array) |*item| {
lib/std/tar.zig
@@ -218,7 +218,7 @@ pub fn pipeToFileSystem(dir: std.fs.Dir, reader: anytype, options: Options) !voi
                 if (file_size == 0 and unstripped_file_name.len == 0) return;
                 const file_name = try stripComponents(unstripped_file_name, options.strip_components);
 
-                var file = dir.createFile(file_name, .{}) catch |err| switch (err) {
+                const file = dir.createFile(file_name, .{}) catch |err| switch (err) {
                     error.FileNotFound => again: {
                         const code = code: {
                             if (std.fs.path.dirname(file_name)) |dir_name| {
lib/std/testing.zig
@@ -399,7 +399,7 @@ fn SliceDiffer(comptime T: type) type {
 
         pub fn write(self: Self, writer: anytype) !void {
             for (self.expected, 0..) |value, i| {
-                var full_index = self.start_index + i;
+                const full_index = self.start_index + i;
                 const diff = if (i < self.actual.len) !std.meta.eql(self.actual[i], value) else true;
                 if (diff) try self.ttyconf.setColor(writer, .red);
                 if (@typeInfo(T) == .Pointer) {
@@ -424,7 +424,7 @@ const BytesDiffer = struct {
             // to avoid having to calculate diffs twice per chunk
             var diffs: std.bit_set.IntegerBitSet(16) = .{ .mask = 0 };
             for (chunk, 0..) |byte, i| {
-                var absolute_byte_index = (expected_iterator.index - chunk.len) + i;
+                const absolute_byte_index = (expected_iterator.index - chunk.len) + i;
                 const diff = if (absolute_byte_index < self.actual.len) self.actual[absolute_byte_index] != byte else true;
                 if (diff) diffs.set(i);
                 try self.writeByteDiff(writer, "{X:0>2} ", byte, diff);
@@ -565,13 +565,13 @@ pub fn tmpDir(opts: std.fs.Dir.OpenDirOptions) TmpDir {
     var sub_path: [TmpDir.sub_path_len]u8 = undefined;
     _ = std.fs.base64_encoder.encode(&sub_path, &random_bytes);
 
-    var cwd = std.fs.cwd();
+    const cwd = std.fs.cwd();
     var cache_dir = cwd.makeOpenPath("zig-cache", .{}) catch
         @panic("unable to make tmp dir for testing: unable to make and open zig-cache dir");
     defer cache_dir.close();
-    var parent_dir = cache_dir.makeOpenPath("tmp", .{}) catch
+    const parent_dir = cache_dir.makeOpenPath("tmp", .{}) catch
         @panic("unable to make tmp dir for testing: unable to make and open zig-cache/tmp dir");
-    var dir = parent_dir.makeOpenPath(&sub_path, opts) catch
+    const dir = parent_dir.makeOpenPath(&sub_path, opts) catch
         @panic("unable to make tmp dir for testing: unable to make and open the tmp dir");
 
     return .{
@@ -587,13 +587,13 @@ pub fn tmpIterableDir(opts: std.fs.Dir.OpenDirOptions) TmpIterableDir {
     var sub_path: [TmpIterableDir.sub_path_len]u8 = undefined;
     _ = std.fs.base64_encoder.encode(&sub_path, &random_bytes);
 
-    var cwd = std.fs.cwd();
+    const cwd = std.fs.cwd();
     var cache_dir = cwd.makeOpenPath("zig-cache", .{}) catch
         @panic("unable to make tmp dir for testing: unable to make and open zig-cache dir");
     defer cache_dir.close();
-    var parent_dir = cache_dir.makeOpenPath("tmp", .{}) catch
+    const parent_dir = cache_dir.makeOpenPath("tmp", .{}) catch
         @panic("unable to make tmp dir for testing: unable to make and open zig-cache/tmp dir");
-    var dir = parent_dir.makeOpenPathIterable(&sub_path, opts) catch
+    const dir = parent_dir.makeOpenPathIterable(&sub_path, opts) catch
         @panic("unable to make tmp dir for testing: unable to make and open the tmp dir");
 
     return .{
@@ -618,8 +618,8 @@ test "expectEqual nested array" {
 }
 
 test "expectEqual vector" {
-    var a: @Vector(4, u32) = @splat(4);
-    var b: @Vector(4, u32) = @splat(4);
+    const a: @Vector(4, u32) = @splat(4);
+    const b: @Vector(4, u32) = @splat(4);
 
     try expectEqual(a, b);
 }
lib/std/treap.zig
@@ -379,7 +379,7 @@ test "std.Treap: insert, find, replace, remove" {
         const key = node.key;
 
         // find the entry by-key and by-node after having been inserted.
-        var entry = treap.getEntryFor(node.key);
+        const entry = treap.getEntryFor(node.key);
         try testing.expectEqual(entry.key, key);
         try testing.expectEqual(entry.node, node);
         try testing.expectEqual(entry.node, treap.getEntryForExisting(node).node);
lib/std/unicode.zig
@@ -242,7 +242,7 @@ pub fn utf8ValidateSlice(input: []const u8) bool {
         s5, s6, s6, s6, s7, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx,
     };
 
-    var n = remaining.len;
+    const n = remaining.len;
     var i: usize = 0;
     while (i < n) {
         const first_byte = remaining[i];
lib/build_runner.zig
@@ -24,7 +24,7 @@ pub fn main() !void {
     };
     const arena = thread_safe_arena.allocator();
 
-    var args = try process.argsAlloc(arena);
+    const args = try process.argsAlloc(arena);
 
     // skip my own exe name
     var arg_idx: usize = 1;